TEST-INFRA: [flaky-tests] Replace time.sleep() with time mocking in uko_indexer_watcher tests #3759

Open
opened 2026-04-05 22:31:32 +00:00 by freemo · 0 comments
Owner

Metadata

  • Branch: test/uko-indexer-watcher-time-mocking
  • Commit Message: test(uko_indexer): replace time.sleep() with time mocking in watcher step definitions
  • Milestone: Backlog
  • Parent Epic: #1678

Background and Context

The Behave tests for the UKO Indexer file watcher in features/steps/uko_indexer_watcher_steps.py use time.sleep(float(secs)) in the step_fw_wait function to wait for a debounce period to elapse. Tests that rely on fixed-time waits are slow and unreliable — they are sensitive to system load, CI runner performance, and timing jitter, which can cause intermittent failures (flaky tests).

Per project conventions, all mock code, fakes, stubs, and other test doubles belong exclusively in the features/mocks/ directory. Replacing the real time.sleep() call with a controlled mock will make the tests faster, deterministic, and more robust.

Expected Behavior

The step_fw_wait function in features/steps/uko_indexer_watcher_steps.py should use a mocked time.sleep() (placed in features/mocks/) so that debounce timing can be controlled directly in tests without incurring real wall-clock delays.

Subtasks

  • Create or extend a time mock in features/mocks/ that allows controlling time.sleep() behaviour
  • Update features/steps/uko_indexer_watcher_steps.py step_fw_wait to use the mock instead of time.sleep(float(secs))
  • Ensure the UKO Indexer watcher Behave scenarios still pass after the change
  • Verify tests are faster and deterministic (no real wall-clock waits)
  • Run nox (all default sessions), fix any errors
  • Verify coverage ≥ 97% via nox -s coverage_report

Definition of Done

This issue is complete when:

  • All subtasks above are completed and checked off.
  • The time.sleep() call in features/steps/uko_indexer_watcher_steps.py has been replaced with a time mocking mechanism located in features/mocks/.
  • All UKO Indexer watcher Behave scenarios pass without real wall-clock delays.
  • A Git commit is created where the first line of the commit message matches the Commit Message in Metadata exactly.
  • The commit is pushed to the remote on the branch matching the Branch in Metadata exactly.
  • The commit is submitted as a pull request to master, reviewed, and merged.
  • All nox stages pass.
  • Coverage ≥ 97%.

Backlog note: This issue was discovered during autonomous operation
on milestone v3.7.0. It does not block milestone completion and has been
placed in the backlog for human review and future milestone assignment.


Automated by CleverAgents Bot
Supervisor: Test Infrastructure | Agent: ca-new-issue-creator

## Metadata - **Branch**: `test/uko-indexer-watcher-time-mocking` - **Commit Message**: `test(uko_indexer): replace time.sleep() with time mocking in watcher step definitions` - **Milestone**: Backlog - **Parent Epic**: #1678 ## Background and Context The Behave tests for the UKO Indexer file watcher in `features/steps/uko_indexer_watcher_steps.py` use `time.sleep(float(secs))` in the `step_fw_wait` function to wait for a debounce period to elapse. Tests that rely on fixed-time waits are slow and unreliable — they are sensitive to system load, CI runner performance, and timing jitter, which can cause intermittent failures (flaky tests). Per project conventions, all mock code, fakes, stubs, and other test doubles belong exclusively in the `features/mocks/` directory. Replacing the real `time.sleep()` call with a controlled mock will make the tests faster, deterministic, and more robust. ## Expected Behavior The `step_fw_wait` function in `features/steps/uko_indexer_watcher_steps.py` should use a mocked `time.sleep()` (placed in `features/mocks/`) so that debounce timing can be controlled directly in tests without incurring real wall-clock delays. ## Subtasks - [ ] Create or extend a time mock in `features/mocks/` that allows controlling `time.sleep()` behaviour - [ ] Update `features/steps/uko_indexer_watcher_steps.py` `step_fw_wait` to use the mock instead of `time.sleep(float(secs))` - [ ] Ensure the UKO Indexer watcher Behave scenarios still pass after the change - [ ] Verify tests are faster and deterministic (no real wall-clock waits) - [ ] Run `nox` (all default sessions), fix any errors - [ ] Verify coverage ≥ 97% via `nox -s coverage_report` ## Definition of Done This issue is complete when: - All subtasks above are completed and checked off. - The `time.sleep()` call in `features/steps/uko_indexer_watcher_steps.py` has been replaced with a time mocking mechanism located in `features/mocks/`. - All UKO Indexer watcher Behave scenarios pass without real wall-clock delays. - A Git commit is created where the **first line** of the commit message matches the Commit Message in Metadata exactly. - The commit is pushed to the remote on the branch matching the **Branch** in Metadata exactly. - The commit is submitted as a **pull request** to `master`, reviewed, and **merged**. - All nox stages pass. - Coverage ≥ 97%. > **Backlog note:** This issue was discovered during autonomous operation > on milestone v3.7.0. It does not block milestone completion and has been > placed in the backlog for human review and future milestone assignment. --- **Automated by CleverAgents Bot** Supervisor: Test Infrastructure | Agent: ca-new-issue-creator
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
cleveragents/cleveragents-core#3759
No description provided.