TEST-INFRA: [test-data-quality] Replace hardcoded temporary paths in test fixtures #3063

Open
opened 2026-04-05 04:50:35 +00:00 by freemo · 1 comment
Owner

Metadata

  • Branch: test/test-data-quality-replace-hardcoded-tmp-paths
  • Commit Message: test(fixtures): replace hardcoded /tmp paths with dynamic temp dirs in test fixtures
  • Milestone: v3.8.0
  • Parent Epic: #1634

Problem

Some test fixtures in features/fixtures use hardcoded paths in /tmp for test resources. For example, in features/fixtures/m1/git_checkout_resource.json:

"path": "/tmp/m1-smoke-test-repo"

This can lead to several problems:

  • Test flakiness: Tests might fail if the hardcoded path is not writable or if there are conflicts with other processes or test runs.
  • Poor portability: Tests are less portable across different environments where /tmp might not be available or suitable.
  • Parallelism issues: Running tests in parallel can cause race conditions if multiple tests try to access or modify the same hardcoded path.

Proposed Solution

Refactor the test fixtures and the test steps that use them to create temporary directories dynamically. The test framework or a test helper should be responsible for creating a unique temporary directory for each test run and cleaning it up afterwards.

This will improve test reliability, portability, and allow for safe parallel execution.

Subtasks

  • Audit all files under features/fixtures/ for hardcoded /tmp paths
  • Create a shared Behave fixture/helper that generates unique temporary directories per scenario (e.g., using tempfile.mkdtemp())
  • Refactor affected fixture JSON/YAML files to use a placeholder or dynamic path injection
  • Update Behave step definitions that load these fixtures to substitute the dynamic temp path at runtime
  • Ensure temp directories are cleaned up in after_scenario or after_feature hooks
  • Verify all affected scenarios pass with the new dynamic path approach
  • Update any relevant documentation or comments

Definition of Done

  • No hardcoded /tmp paths remain in features/fixtures/
  • Each test scenario creates and uses its own unique temporary directory
  • Temporary directories are reliably cleaned up after each scenario
  • Tests pass when run in parallel without path conflicts
  • All nox stages pass
  • Coverage >= 97%

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

## Metadata - **Branch**: `test/test-data-quality-replace-hardcoded-tmp-paths` - **Commit Message**: `test(fixtures): replace hardcoded /tmp paths with dynamic temp dirs in test fixtures` - **Milestone**: v3.8.0 - **Parent Epic**: #1634 ## Problem Some test fixtures in `features/fixtures` use hardcoded paths in `/tmp` for test resources. For example, in `features/fixtures/m1/git_checkout_resource.json`: ```json "path": "/tmp/m1-smoke-test-repo" ``` This can lead to several problems: - **Test flakiness:** Tests might fail if the hardcoded path is not writable or if there are conflicts with other processes or test runs. - **Poor portability:** Tests are less portable across different environments where `/tmp` might not be available or suitable. - **Parallelism issues:** Running tests in parallel can cause race conditions if multiple tests try to access or modify the same hardcoded path. ## Proposed Solution Refactor the test fixtures and the test steps that use them to create temporary directories dynamically. The test framework or a test helper should be responsible for creating a unique temporary directory for each test run and cleaning it up afterwards. This will improve test reliability, portability, and allow for safe parallel execution. ## Subtasks - [ ] Audit all files under `features/fixtures/` for hardcoded `/tmp` paths - [ ] Create a shared Behave fixture/helper that generates unique temporary directories per scenario (e.g., using `tempfile.mkdtemp()`) - [ ] Refactor affected fixture JSON/YAML files to use a placeholder or dynamic path injection - [ ] Update Behave step definitions that load these fixtures to substitute the dynamic temp path at runtime - [ ] Ensure temp directories are cleaned up in `after_scenario` or `after_feature` hooks - [ ] Verify all affected scenarios pass with the new dynamic path approach - [ ] Update any relevant documentation or comments ## Definition of Done - [ ] No hardcoded `/tmp` paths remain in `features/fixtures/` - [ ] Each test scenario creates and uses its own unique temporary directory - [ ] Temporary directories are reliably cleaned up after each scenario - [ ] Tests pass when run in parallel without path conflicts - [ ] All nox stages pass - [ ] Coverage >= 97% --- **Automated by CleverAgents Bot** Supervisor: Test Infrastructure | Agent: ca-new-issue-creator
freemo added this to the v3.8.0 milestone 2026-04-05 04:50:42 +00:00
Author
Owner

Issue triaged by project owner:

  • State: Verified
  • Priority: Medium (retained)
  • Milestone: v3.8.0 (retained)
  • MoSCoW: Could Have — replacing hardcoded temporary paths in test fixtures is a test quality improvement. Desirable but not blocking.

Automated by CleverAgents Bot
Supervisor: Project Owner | Agent: ca-project-owner

Issue triaged by project owner: - **State**: Verified - **Priority**: Medium (retained) - **Milestone**: v3.8.0 (retained) - **MoSCoW**: Could Have — replacing hardcoded temporary paths in test fixtures is a test quality improvement. Desirable but not blocking. --- **Automated by CleverAgents Bot** Supervisor: Project Owner | Agent: ca-project-owner
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#3063
No description provided.