Refactor tests directory structure - #894

Merged
jan-janssen merged 8 commits into
mainfrom
refactor-tests-structure-8663878069429888553
Feb 1, 2026
Merged

Refactor tests directory structure#894
jan-janssen merged 8 commits into
mainfrom
refactor-tests-structure-8663878069429888553

Conversation

@jan-janssen

@jan-janssenjan-janssen commented Feb 1, 2026

Copy link
Copy Markdown
Member

This change restructures the tests/ folder to better reflect the internal organization of the executorlib library. Test files are now grouped by the module they test (backend, executor, standalone, task_scheduler). Relative paths within the tests have been updated to ensure that they continue to correctly reference external scripts and the library's internal backend files. Temporary files and auto-generated version files were excluded from the final submission.


PR created automatically by Jules for task 8663878069429888553 started by @jan-janssen

Summary by CodeRabbit

Release Notes

  • Tests

    • Reorganized unit test module structure and updated test file paths across the codebase.
  • Chores

    • Updated CI/CD pipeline configuration to reference the new test module locations and execution paths.

✏️ Tip: You can customize this high-level summary in your review settings.

- Created subdirectories in tests/: backend, executor, standalone, task_scheduler.
- Moved and renamed test files to corresponding subdirectories.
- Updated relative paths in test files for executables and backends.
- Added __init__.py files to new test packages.
Co-authored-by: jan-janssen <3854739+jan-janssen@users.noreply.github.com>
@google-labs-jules

Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@coderabbitai

coderabbitaiBot commented Feb 1, 2026

Copy link
Copy Markdown
Contributor

Warning

Rate limit exceeded

@jan-janssen has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 4 minutes and 16 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📝 Walkthrough

Walkthrough

This PR updates test file paths and invocation commands across the repository as part of a test directory structure reorganization. The changes include updating CI workflow test targets, adjusting import/path resolution in multiple test files to reflect the new test directory hierarchy, and ensuring test artifacts are created in correct locations.

Changes

Cohort / File(s)Summary
CI Workflow Configuration
.github/workflows/pipeline.yml
Updated test invocation paths in Flux and Slurm workflow steps to reference reorganized unit test module locations (e.g., from tests/test_fluxpythonspawner.py to tests/unit/task_scheduler/interactive/test_spawner_flux.py; from test_slurmjobexecutor.py to executor/test_slurm_job.py).
Flux Test Path Resolution
tests/unit/executor/test_flux_job.py
Changed dirname calculation from one level up to two levels up, adjusting the base directory context for flux.out and flux.err file paths.
Test Executable Path Updates
tests/unit/executor/test_single_shell_interactive.py, tests/unit/task_scheduler/file/test_serial.py
Updated executable paths to reference correct locations in reorganized directory structure (e.g., from executor/executables/ to parent executables/ directory).
Module Path Resolution
tests/unit/standalone/interactive/test_communication.py
Modified path traversal logic in interface tests to correctly locate src module using os.path.dirname(__file__) followed by upward directory navigation; preserved existing test logic.
Test Artifact Handling
tests/unit/task_scheduler/file/test_serial.py
Added exist_ok=True to directory creation to prevent errors when directories already exist; updated path constructions for robust and portable test artifact handling.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • Test with SLURM #726: Updates CI test targets for Slurm tests that were previously added; this PR complements that work by updating test invocation paths to new organized locations.
  • Refactor Test Environment #611: Modifies test invocation commands in the pipeline workflow, sharing similar scope of CI configuration updates.
  • Refactor Task scheduler #637: Part of the same repository reorganization effort, adjusting test path resolution as follow-up work to the original structural refactor.

Suggested reviewers

  • liamhuber

Poem

🐰 Paths reorganized with care so true,
Tests marching to their directories new,
From flat to nested, a structure refined,
Each fixture finds its home, aligned,
One hop up, two hops down—the journey's kind! 🌿

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check nameStatusExplanationResolution
Docstring Coverage⚠️ WarningDocstring coverage is 0.00% which is insufficient. The required threshold is 80.00%.Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check nameStatusExplanation
Description Check✅ PassedCheck skipped - CodeRabbit’s high-level summary is enabled.
Title check✅ PassedThe title 'Refactor tests directory structure' directly and clearly summarizes the main change: reorganizing the tests folder into subdirectories by module type (backend, executor, standalone, task_scheduler) with corresponding path updates.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch refactor-tests-structure-8663878069429888553

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitaicoderabbitaiBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
tests/executor/test_flux_job.py (1)

113-133: ⚠️ Potential issue | 🟠 Major

Avoid shared flux.out/flux.err at repo root in parallel runs.

This now writes to the same filenames and directory as test_output_files_abs, which can race under pytest -n or similar. Use a unique temp directory to keep tests isolated.

💡 Suggested fix (isolate output files per test)
+import tempfile
@@
def test_output_files_cwd(self):
- dirname = os.path.abspath(os.path.join(os.path.dirname(__file__), "..", ".."))- os.makedirs(dirname, exist_ok=True)- file_stdout = os.path.join(dirname, "flux.out")- file_stderr = os.path.join(dirname, "flux.err")- with FluxJobExecutor(- max_cores=1,- resource_dict={"cores": 1, "cwd": dirname},- flux_executor=self.executor,- block_allocation=True,- flux_log_files=True,- ) as p:- output = list(p.map(calc, [1, 2, 3]))+ with tempfile.TemporaryDirectory() as tmpdir:+ file_stdout = os.path.join(tmpdir, "flux.out")+ file_stderr = os.path.join(tmpdir, "flux.err")+ with FluxJobExecutor(+ max_cores=1,+ resource_dict={"cores": 1, "cwd": tmpdir},+ flux_executor=self.executor,+ block_allocation=True,+ flux_log_files=True,+ ) as p:+ output = list(p.map(calc, [1, 2, 3]))
self.assertEqual(
output,
[1, 2, 3],
)
self.assertTrue(os.path.exists(file_stdout))
self.assertTrue(os.path.exists(file_stderr))
- os.remove(file_stdout)- os.remove(file_stderr)
🤖 Fix all issues with AI agents
In `@tests/task_scheduler/file/test_serial.py`:
- Around line 227-229: Tests create the cache file using an absolute path under
the test file directory (variable file_name) but tearDown only cleans up the
executorlib_cache in the current working directory, leaving artifacts; change
the file creation to use the same cache directory tearDown removes (e.g. build
file_name from os.getcwd() or use a relative "executorlib_cache/test.h5") and
ensure os.makedirs and the with open(file_name, "w") as f block use that same
path so tearDown removes the created file and directory.
🧹 Nitpick comments (1)
tests/executor/test_single_shell_interactive.py (1)

13-13: Make executable_path absolute to avoid CWD-dependent failures.

🔧 Suggested tweak
-executable_path = os.path.join(os.path.dirname(__file__), "..", "executables", "count.py")+executable_path = os.path.abspath(+ os.path.join(os.path.dirname(__file__), "..", "executables", "count.py")+)

Comment on lines +227 to 229
file_name = os.path.abspath(os.path.join(os.path.dirname(__file__), "executorlib_cache", "test.h5"))
os.makedirs(os.path.dirname(file_name), exist_ok=True)
with open(file_name, "w") as f:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Keep cache directory consistent with tearDown cleanup.

This now writes under tests/task_scheduler/file/executorlib_cache, but tearDown() only removes executorlib_cache in the CWD, so artifacts will remain.

🧹 Suggested alignment with existing cache cleanup
- file_name = os.path.abspath(os.path.join(os.path.dirname(__file__), "executorlib_cache", "test.h5"))- os.makedirs(os.path.dirname(file_name), exist_ok=True)+ cache_dir = os.path.abspath("executorlib_cache")+ os.makedirs(cache_dir, exist_ok=True)+ file_name = os.path.join(cache_dir, "test.h5")
📝 Committable suggestion

‼️IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
file_name=os.path.abspath(os.path.join(os.path.dirname(__file__), "executorlib_cache", "test.h5"))
os.makedirs(os.path.dirname(file_name), exist_ok=True)
withopen(file_name, "w") asf:
cache_dir=os.path.abspath("executorlib_cache")
os.makedirs(cache_dir, exist_ok=True)
file_name=os.path.join(cache_dir, "test.h5")
withopen(file_name, "w") asf:
🤖 Prompt for AI Agents
In `@tests/task_scheduler/file/test_serial.py` around lines 227 - 229, Tests
create the cache file using an absolute path under the test file directory
(variable file_name) but tearDown only cleans up the executorlib_cache in the
current working directory, leaving artifacts; change the file creation to use
the same cache directory tearDown removes (e.g. build file_name from os.getcwd()
or use a relative "executorlib_cache/test.h5") and ensure os.makedirs and the
with open(file_name, "w") as f block use that same path so tearDown removes the
created file and directory.

@coderabbitaicoderabbitaiBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
.github/workflows/pipeline.yml (1)

290-296: ⚠️ Potential issue | 🔴 Critical

Inconsistent path on Line 296 will cause test failure.

Line 292 changes the working directory to tests/, so Line 295 correctly uses a relative path (executor/test_slurm_job.py). However, Line 296 uses tests/executor/test_slurm_cluster.py, which will resolve to tests/tests/executor/test_slurm_cluster.py and fail.

🐛 Proposed fix
 python -m unittest executor/test_slurm_job.py
- python -m unittest tests/executor/test_slurm_cluster.py+ python -m unittest executor/test_slurm_cluster.py

@codecov

codecovBot commented Feb 1, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.42%. Comparing base (41d76ff) to head (9050bd0).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@ Coverage Diff @@## main #894 +/- ##
=======================================
Coverage 93.42% 93.42% =======================================
Files 38 38 Lines 1840 1840 =======================================
Hits 1719 1719 Misses 121 121 

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@coderabbitaicoderabbitaiBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (4)
tests/unit/standalone/interactive/test_communication.py (4)

47-57: ⚠️ Potential issue | 🔴 Critical

Incorrect path traversal - missing one directory level.

The file is at tests/unit/standalone/interactive/test_communication.py. To reach src/executorlib/backend/, you need to traverse four levels up to the repository root, but the code only traverses three levels:

  • tests/unit/standalone/interactive/..tests/unit/standalone/
  • ..tests/unit/
  • ..tests/
  • Missing: → .. → repository root

This will resolve to tests/src/executorlib/backend/interactive_parallel.py, which doesn't exist.

🐛 Proposed fix
 os.path.abspath(
os.path.join(
os.path.dirname(__file__),
"..",
"..",
"..",
+ "..",
"src",
"executorlib",
"backend",
"interactive_parallel.py",
)
),

79-89: ⚠️ Potential issue | 🔴 Critical

Same path traversal issue - missing one level up.

Same issue as test_interface_mpi: needs four ".." to reach the repository root from tests/unit/standalone/interactive/.

🐛 Proposed fix
 os.path.abspath(
os.path.join(
os.path.dirname(__file__),
"..",
"..",
"..",
+ "..",
"src",
"executorlib",
"backend",
"interactive_serial.py",
)
),

111-121: ⚠️ Potential issue | 🔴 Critical

Same path traversal issue - missing one level up.

Same issue: needs four ".." to reach the repository root.

🐛 Proposed fix
 os.path.abspath(
os.path.join(
os.path.dirname(__file__),
"..",
"..",
"..",
+ "..",
"src",
"executorlib",
"backend",
"interactive_serial.py",
)
),

174-184: ⚠️ Potential issue | 🔴 Critical

Same path traversal issue - missing one level up.

Same issue: needs four ".." to reach the repository root.

🐛 Proposed fix
 os.path.abspath(
os.path.join(
os.path.dirname(__file__),
"..",
"..",
"..",
+ "..",
"src",
"executorlib",
"backend",
"interactive_serial.py",
)
),

@jan-janssen
jan-janssen merged commit 1f88c85 into mainFeb 1, 2026
35 checks passed
@jan-janssen
jan-janssen deleted the refactor-tests-structure-8663878069429888553 branch February 1, 2026 16:44
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@jan-janssen
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Add copy buttons to all \u003cpre\u003e\u003ccode\u003e blocks\n(function() {\n function addCopyButtons() {\n document.querySelectorAll('pre code').forEach(function(codeBlock) {\n if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;\n codeBlock.parentElement.setAttribute('data-copy-added', 'true');\n \n var btn = document.createElement('button');\n btn.textContent = 'Copy';\n btn.style.cssText = 'position:absolute;top:4px;right:4px;padding:2px 8px;font-size:11px;background:#4ecdc4;border:none;border-radius:4px;color:#1a1a2e;cursor:pointer;opacity:0.7;transition:opacity 0.2s;';\n btn.onmouseover = function() { this.style.opacity = '1'; };\n btn.onmouseout = function() { this.style.opacity = '0.7'; };\n btn.onclick = function() {\n navigator.clipboard.writeText(codeBlock.textContent).then(function() {\n btn.textContent = 'Copied!';\n setTimeout(function() { btn.textContent = 'Copy'; }, 1500);\n });\n };\n codeBlock.parentElement.style.position = 'relative';\n codeBlock.parentElement.appendChild(btn);\n });\n }\n \n addCopyButtons();\n \n // Re-run on dynamic content\n var observer = new MutationObserver(addCopyButtons);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Add Copy Buttons to Code Blocks"); } } catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); } })(); (function(){ try { var __m = "github.com"; var __re = new RegExp('^' + "github\\.com" + '
Skip to content

Refactor tests directory structure - #894

Merged
jan-janssen merged 8 commits into
mainfrom
refactor-tests-structure-8663878069429888553
Feb 1, 2026
Merged

Refactor tests directory structure#894
jan-janssen merged 8 commits into
mainfrom
refactor-tests-structure-8663878069429888553

Conversation

@jan-janssen

@jan-janssenjan-janssen commented Feb 1, 2026

Copy link
Copy Markdown
Member

This change restructures the tests/ folder to better reflect the internal organization of the executorlib library. Test files are now grouped by the module they test (backend, executor, standalone, task_scheduler). Relative paths within the tests have been updated to ensure that they continue to correctly reference external scripts and the library's internal backend files. Temporary files and auto-generated version files were excluded from the final submission.


PR created automatically by Jules for task 8663878069429888553 started by @jan-janssen

Summary by CodeRabbit

Release Notes

  • Tests

    • Reorganized unit test module structure and updated test file paths across the codebase.
  • Chores

    • Updated CI/CD pipeline configuration to reference the new test module locations and execution paths.

✏️ Tip: You can customize this high-level summary in your review settings.

- Created subdirectories in tests/: backend, executor, standalone, task_scheduler.
- Moved and renamed test files to corresponding subdirectories.
- Updated relative paths in test files for executables and backends.
- Added __init__.py files to new test packages.
Co-authored-by: jan-janssen <3854739+jan-janssen@users.noreply.github.com>
@google-labs-jules

Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@coderabbitai

coderabbitaiBot commented Feb 1, 2026

Copy link
Copy Markdown
Contributor

Warning

Rate limit exceeded

@jan-janssen has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 4 minutes and 16 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📝 Walkthrough

Walkthrough

This PR updates test file paths and invocation commands across the repository as part of a test directory structure reorganization. The changes include updating CI workflow test targets, adjusting import/path resolution in multiple test files to reflect the new test directory hierarchy, and ensuring test artifacts are created in correct locations.

Changes

Cohort / File(s)Summary
CI Workflow Configuration
.github/workflows/pipeline.yml
Updated test invocation paths in Flux and Slurm workflow steps to reference reorganized unit test module locations (e.g., from tests/test_fluxpythonspawner.py to tests/unit/task_scheduler/interactive/test_spawner_flux.py; from test_slurmjobexecutor.py to executor/test_slurm_job.py).
Flux Test Path Resolution
tests/unit/executor/test_flux_job.py
Changed dirname calculation from one level up to two levels up, adjusting the base directory context for flux.out and flux.err file paths.
Test Executable Path Updates
tests/unit/executor/test_single_shell_interactive.py, tests/unit/task_scheduler/file/test_serial.py
Updated executable paths to reference correct locations in reorganized directory structure (e.g., from executor/executables/ to parent executables/ directory).
Module Path Resolution
tests/unit/standalone/interactive/test_communication.py
Modified path traversal logic in interface tests to correctly locate src module using os.path.dirname(__file__) followed by upward directory navigation; preserved existing test logic.
Test Artifact Handling
tests/unit/task_scheduler/file/test_serial.py
Added exist_ok=True to directory creation to prevent errors when directories already exist; updated path constructions for robust and portable test artifact handling.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • Test with SLURM #726: Updates CI test targets for Slurm tests that were previously added; this PR complements that work by updating test invocation paths to new organized locations.
  • Refactor Test Environment #611: Modifies test invocation commands in the pipeline workflow, sharing similar scope of CI configuration updates.
  • Refactor Task scheduler #637: Part of the same repository reorganization effort, adjusting test path resolution as follow-up work to the original structural refactor.

Suggested reviewers

  • liamhuber

Poem

🐰 Paths reorganized with care so true,
Tests marching to their directories new,
From flat to nested, a structure refined,
Each fixture finds its home, aligned,
One hop up, two hops down—the journey's kind! 🌿

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check nameStatusExplanationResolution
Docstring Coverage⚠️ WarningDocstring coverage is 0.00% which is insufficient. The required threshold is 80.00%.Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check nameStatusExplanation
Description Check✅ PassedCheck skipped - CodeRabbit’s high-level summary is enabled.
Title check✅ PassedThe title 'Refactor tests directory structure' directly and clearly summarizes the main change: reorganizing the tests folder into subdirectories by module type (backend, executor, standalone, task_scheduler) with corresponding path updates.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch refactor-tests-structure-8663878069429888553

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitaicoderabbitaiBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
tests/executor/test_flux_job.py (1)

113-133: ⚠️ Potential issue | 🟠 Major

Avoid shared flux.out/flux.err at repo root in parallel runs.

This now writes to the same filenames and directory as test_output_files_abs, which can race under pytest -n or similar. Use a unique temp directory to keep tests isolated.

💡 Suggested fix (isolate output files per test)
+import tempfile
@@
def test_output_files_cwd(self):
- dirname = os.path.abspath(os.path.join(os.path.dirname(__file__), "..", ".."))- os.makedirs(dirname, exist_ok=True)- file_stdout = os.path.join(dirname, "flux.out")- file_stderr = os.path.join(dirname, "flux.err")- with FluxJobExecutor(- max_cores=1,- resource_dict={"cores": 1, "cwd": dirname},- flux_executor=self.executor,- block_allocation=True,- flux_log_files=True,- ) as p:- output = list(p.map(calc, [1, 2, 3]))+ with tempfile.TemporaryDirectory() as tmpdir:+ file_stdout = os.path.join(tmpdir, "flux.out")+ file_stderr = os.path.join(tmpdir, "flux.err")+ with FluxJobExecutor(+ max_cores=1,+ resource_dict={"cores": 1, "cwd": tmpdir},+ flux_executor=self.executor,+ block_allocation=True,+ flux_log_files=True,+ ) as p:+ output = list(p.map(calc, [1, 2, 3]))
self.assertEqual(
output,
[1, 2, 3],
)
self.assertTrue(os.path.exists(file_stdout))
self.assertTrue(os.path.exists(file_stderr))
- os.remove(file_stdout)- os.remove(file_stderr)
🤖 Fix all issues with AI agents
In `@tests/task_scheduler/file/test_serial.py`:
- Around line 227-229: Tests create the cache file using an absolute path under
the test file directory (variable file_name) but tearDown only cleans up the
executorlib_cache in the current working directory, leaving artifacts; change
the file creation to use the same cache directory tearDown removes (e.g. build
file_name from os.getcwd() or use a relative "executorlib_cache/test.h5") and
ensure os.makedirs and the with open(file_name, "w") as f block use that same
path so tearDown removes the created file and directory.
🧹 Nitpick comments (1)
tests/executor/test_single_shell_interactive.py (1)

13-13: Make executable_path absolute to avoid CWD-dependent failures.

🔧 Suggested tweak
-executable_path = os.path.join(os.path.dirname(__file__), "..", "executables", "count.py")+executable_path = os.path.abspath(+ os.path.join(os.path.dirname(__file__), "..", "executables", "count.py")+)

Comment on lines +227 to 229
file_name = os.path.abspath(os.path.join(os.path.dirname(__file__), "executorlib_cache", "test.h5"))
os.makedirs(os.path.dirname(file_name), exist_ok=True)
with open(file_name, "w") as f:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Keep cache directory consistent with tearDown cleanup.

This now writes under tests/task_scheduler/file/executorlib_cache, but tearDown() only removes executorlib_cache in the CWD, so artifacts will remain.

🧹 Suggested alignment with existing cache cleanup
- file_name = os.path.abspath(os.path.join(os.path.dirname(__file__), "executorlib_cache", "test.h5"))- os.makedirs(os.path.dirname(file_name), exist_ok=True)+ cache_dir = os.path.abspath("executorlib_cache")+ os.makedirs(cache_dir, exist_ok=True)+ file_name = os.path.join(cache_dir, "test.h5")
📝 Committable suggestion

‼️IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
file_name=os.path.abspath(os.path.join(os.path.dirname(__file__), "executorlib_cache", "test.h5"))
os.makedirs(os.path.dirname(file_name), exist_ok=True)
withopen(file_name, "w") asf:
cache_dir=os.path.abspath("executorlib_cache")
os.makedirs(cache_dir, exist_ok=True)
file_name=os.path.join(cache_dir, "test.h5")
withopen(file_name, "w") asf:
🤖 Prompt for AI Agents
In `@tests/task_scheduler/file/test_serial.py` around lines 227 - 229, Tests
create the cache file using an absolute path under the test file directory
(variable file_name) but tearDown only cleans up the executorlib_cache in the
current working directory, leaving artifacts; change the file creation to use
the same cache directory tearDown removes (e.g. build file_name from os.getcwd()
or use a relative "executorlib_cache/test.h5") and ensure os.makedirs and the
with open(file_name, "w") as f block use that same path so tearDown removes the
created file and directory.

@coderabbitaicoderabbitaiBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
.github/workflows/pipeline.yml (1)

290-296: ⚠️ Potential issue | 🔴 Critical

Inconsistent path on Line 296 will cause test failure.

Line 292 changes the working directory to tests/, so Line 295 correctly uses a relative path (executor/test_slurm_job.py). However, Line 296 uses tests/executor/test_slurm_cluster.py, which will resolve to tests/tests/executor/test_slurm_cluster.py and fail.

🐛 Proposed fix
 python -m unittest executor/test_slurm_job.py
- python -m unittest tests/executor/test_slurm_cluster.py+ python -m unittest executor/test_slurm_cluster.py

@codecov

codecovBot commented Feb 1, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.42%. Comparing base (41d76ff) to head (9050bd0).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@ Coverage Diff @@## main #894 +/- ##
=======================================
Coverage 93.42% 93.42% =======================================
Files 38 38 Lines 1840 1840 =======================================
Hits 1719 1719 Misses 121 121 

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@coderabbitaicoderabbitaiBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (4)
tests/unit/standalone/interactive/test_communication.py (4)

47-57: ⚠️ Potential issue | 🔴 Critical

Incorrect path traversal - missing one directory level.

The file is at tests/unit/standalone/interactive/test_communication.py. To reach src/executorlib/backend/, you need to traverse four levels up to the repository root, but the code only traverses three levels:

  • tests/unit/standalone/interactive/..tests/unit/standalone/
  • ..tests/unit/
  • ..tests/
  • Missing: → .. → repository root

This will resolve to tests/src/executorlib/backend/interactive_parallel.py, which doesn't exist.

🐛 Proposed fix
 os.path.abspath(
os.path.join(
os.path.dirname(__file__),
"..",
"..",
"..",
+ "..",
"src",
"executorlib",
"backend",
"interactive_parallel.py",
)
),

79-89: ⚠️ Potential issue | 🔴 Critical

Same path traversal issue - missing one level up.

Same issue as test_interface_mpi: needs four ".." to reach the repository root from tests/unit/standalone/interactive/.

🐛 Proposed fix
 os.path.abspath(
os.path.join(
os.path.dirname(__file__),
"..",
"..",
"..",
+ "..",
"src",
"executorlib",
"backend",
"interactive_serial.py",
)
),

111-121: ⚠️ Potential issue | 🔴 Critical

Same path traversal issue - missing one level up.

Same issue: needs four ".." to reach the repository root.

🐛 Proposed fix
 os.path.abspath(
os.path.join(
os.path.dirname(__file__),
"..",
"..",
"..",
+ "..",
"src",
"executorlib",
"backend",
"interactive_serial.py",
)
),

174-184: ⚠️ Potential issue | 🔴 Critical

Same path traversal issue - missing one level up.

Same issue: needs four ".." to reach the repository root.

🐛 Proposed fix
 os.path.abspath(
os.path.join(
os.path.dirname(__file__),
"..",
"..",
"..",
+ "..",
"src",
"executorlib",
"backend",
"interactive_serial.py",
)
),

@jan-janssen
jan-janssen merged commit 1f88c85 into mainFeb 1, 2026
35 checks passed
@jan-janssen
jan-janssen deleted the refactor-tests-structure-8663878069429888553 branch February 1, 2026 16:44
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@jan-janssen
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Force GitHub README to respect dark mode\n(function() {\n var style = document.createElement('style');\n style.textContent = '\n .markdown-body {\n color-scheme: dark light;\n }\n .markdown-body pre { background: #161b22 !important; }\n .markdown-body code { background: rgba(110, 118, 129, 0.4) !important; }\n .markdown-body table th, .markdown-body table td { border-color: #30363d !important; }\n .markdown-body img { background: #0d1117; }\n .markdown-body blockquote { border-left-color: #8b949e; }\n .markdown-body hr { border-color: #30363d; }\n ';\n document.head.appendChild(style);\n})();", "GitHub Dark Mode README Fix"); } } catch(__e) { console.warn('[Userscript:GitHub Dark Mode README Fix]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Refactor tests directory structure - #894

Merged
jan-janssen merged 8 commits into
mainfrom
refactor-tests-structure-8663878069429888553
Feb 1, 2026
Merged

Refactor tests directory structure#894
jan-janssen merged 8 commits into
mainfrom
refactor-tests-structure-8663878069429888553

Conversation

@jan-janssen

@jan-janssenjan-janssen commented Feb 1, 2026

Copy link
Copy Markdown
Member

This change restructures the tests/ folder to better reflect the internal organization of the executorlib library. Test files are now grouped by the module they test (backend, executor, standalone, task_scheduler). Relative paths within the tests have been updated to ensure that they continue to correctly reference external scripts and the library's internal backend files. Temporary files and auto-generated version files were excluded from the final submission.


PR created automatically by Jules for task 8663878069429888553 started by @jan-janssen

Summary by CodeRabbit

Release Notes

  • Tests

    • Reorganized unit test module structure and updated test file paths across the codebase.
  • Chores

    • Updated CI/CD pipeline configuration to reference the new test module locations and execution paths.

✏️ Tip: You can customize this high-level summary in your review settings.

- Created subdirectories in tests/: backend, executor, standalone, task_scheduler.
- Moved and renamed test files to corresponding subdirectories.
- Updated relative paths in test files for executables and backends.
- Added __init__.py files to new test packages.
Co-authored-by: jan-janssen <3854739+jan-janssen@users.noreply.github.com>
@google-labs-jules

Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@coderabbitai

coderabbitaiBot commented Feb 1, 2026

Copy link
Copy Markdown
Contributor

Warning

Rate limit exceeded

@jan-janssen has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 4 minutes and 16 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📝 Walkthrough

Walkthrough

This PR updates test file paths and invocation commands across the repository as part of a test directory structure reorganization. The changes include updating CI workflow test targets, adjusting import/path resolution in multiple test files to reflect the new test directory hierarchy, and ensuring test artifacts are created in correct locations.

Changes

Cohort / File(s)Summary
CI Workflow Configuration
.github/workflows/pipeline.yml
Updated test invocation paths in Flux and Slurm workflow steps to reference reorganized unit test module locations (e.g., from tests/test_fluxpythonspawner.py to tests/unit/task_scheduler/interactive/test_spawner_flux.py; from test_slurmjobexecutor.py to executor/test_slurm_job.py).
Flux Test Path Resolution
tests/unit/executor/test_flux_job.py
Changed dirname calculation from one level up to two levels up, adjusting the base directory context for flux.out and flux.err file paths.
Test Executable Path Updates
tests/unit/executor/test_single_shell_interactive.py, tests/unit/task_scheduler/file/test_serial.py
Updated executable paths to reference correct locations in reorganized directory structure (e.g., from executor/executables/ to parent executables/ directory).
Module Path Resolution
tests/unit/standalone/interactive/test_communication.py
Modified path traversal logic in interface tests to correctly locate src module using os.path.dirname(__file__) followed by upward directory navigation; preserved existing test logic.
Test Artifact Handling
tests/unit/task_scheduler/file/test_serial.py
Added exist_ok=True to directory creation to prevent errors when directories already exist; updated path constructions for robust and portable test artifact handling.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • Test with SLURM #726: Updates CI test targets for Slurm tests that were previously added; this PR complements that work by updating test invocation paths to new organized locations.
  • Refactor Test Environment #611: Modifies test invocation commands in the pipeline workflow, sharing similar scope of CI configuration updates.
  • Refactor Task scheduler #637: Part of the same repository reorganization effort, adjusting test path resolution as follow-up work to the original structural refactor.

Suggested reviewers

  • liamhuber

Poem

🐰 Paths reorganized with care so true,
Tests marching to their directories new,
From flat to nested, a structure refined,
Each fixture finds its home, aligned,
One hop up, two hops down—the journey's kind! 🌿

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check nameStatusExplanationResolution
Docstring Coverage⚠️ WarningDocstring coverage is 0.00% which is insufficient. The required threshold is 80.00%.Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check nameStatusExplanation
Description Check✅ PassedCheck skipped - CodeRabbit’s high-level summary is enabled.
Title check✅ PassedThe title 'Refactor tests directory structure' directly and clearly summarizes the main change: reorganizing the tests folder into subdirectories by module type (backend, executor, standalone, task_scheduler) with corresponding path updates.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch refactor-tests-structure-8663878069429888553

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitaicoderabbitaiBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
tests/executor/test_flux_job.py (1)

113-133: ⚠️ Potential issue | 🟠 Major

Avoid shared flux.out/flux.err at repo root in parallel runs.

This now writes to the same filenames and directory as test_output_files_abs, which can race under pytest -n or similar. Use a unique temp directory to keep tests isolated.

💡 Suggested fix (isolate output files per test)
+import tempfile
@@
def test_output_files_cwd(self):
- dirname = os.path.abspath(os.path.join(os.path.dirname(__file__), "..", ".."))- os.makedirs(dirname, exist_ok=True)- file_stdout = os.path.join(dirname, "flux.out")- file_stderr = os.path.join(dirname, "flux.err")- with FluxJobExecutor(- max_cores=1,- resource_dict={"cores": 1, "cwd": dirname},- flux_executor=self.executor,- block_allocation=True,- flux_log_files=True,- ) as p:- output = list(p.map(calc, [1, 2, 3]))+ with tempfile.TemporaryDirectory() as tmpdir:+ file_stdout = os.path.join(tmpdir, "flux.out")+ file_stderr = os.path.join(tmpdir, "flux.err")+ with FluxJobExecutor(+ max_cores=1,+ resource_dict={"cores": 1, "cwd": tmpdir},+ flux_executor=self.executor,+ block_allocation=True,+ flux_log_files=True,+ ) as p:+ output = list(p.map(calc, [1, 2, 3]))
self.assertEqual(
output,
[1, 2, 3],
)
self.assertTrue(os.path.exists(file_stdout))
self.assertTrue(os.path.exists(file_stderr))
- os.remove(file_stdout)- os.remove(file_stderr)
🤖 Fix all issues with AI agents
In `@tests/task_scheduler/file/test_serial.py`:
- Around line 227-229: Tests create the cache file using an absolute path under
the test file directory (variable file_name) but tearDown only cleans up the
executorlib_cache in the current working directory, leaving artifacts; change
the file creation to use the same cache directory tearDown removes (e.g. build
file_name from os.getcwd() or use a relative "executorlib_cache/test.h5") and
ensure os.makedirs and the with open(file_name, "w") as f block use that same
path so tearDown removes the created file and directory.
🧹 Nitpick comments (1)
tests/executor/test_single_shell_interactive.py (1)

13-13: Make executable_path absolute to avoid CWD-dependent failures.

🔧 Suggested tweak
-executable_path = os.path.join(os.path.dirname(__file__), "..", "executables", "count.py")+executable_path = os.path.abspath(+ os.path.join(os.path.dirname(__file__), "..", "executables", "count.py")+)

Comment on lines +227 to 229
file_name = os.path.abspath(os.path.join(os.path.dirname(__file__), "executorlib_cache", "test.h5"))
os.makedirs(os.path.dirname(file_name), exist_ok=True)
with open(file_name, "w") as f:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Keep cache directory consistent with tearDown cleanup.

This now writes under tests/task_scheduler/file/executorlib_cache, but tearDown() only removes executorlib_cache in the CWD, so artifacts will remain.

🧹 Suggested alignment with existing cache cleanup
- file_name = os.path.abspath(os.path.join(os.path.dirname(__file__), "executorlib_cache", "test.h5"))- os.makedirs(os.path.dirname(file_name), exist_ok=True)+ cache_dir = os.path.abspath("executorlib_cache")+ os.makedirs(cache_dir, exist_ok=True)+ file_name = os.path.join(cache_dir, "test.h5")
📝 Committable suggestion

‼️IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
file_name=os.path.abspath(os.path.join(os.path.dirname(__file__), "executorlib_cache", "test.h5"))
os.makedirs(os.path.dirname(file_name), exist_ok=True)
withopen(file_name, "w") asf:
cache_dir=os.path.abspath("executorlib_cache")
os.makedirs(cache_dir, exist_ok=True)
file_name=os.path.join(cache_dir, "test.h5")
withopen(file_name, "w") asf:
🤖 Prompt for AI Agents
In `@tests/task_scheduler/file/test_serial.py` around lines 227 - 229, Tests
create the cache file using an absolute path under the test file directory
(variable file_name) but tearDown only cleans up the executorlib_cache in the
current working directory, leaving artifacts; change the file creation to use
the same cache directory tearDown removes (e.g. build file_name from os.getcwd()
or use a relative "executorlib_cache/test.h5") and ensure os.makedirs and the
with open(file_name, "w") as f block use that same path so tearDown removes the
created file and directory.

@coderabbitaicoderabbitaiBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
.github/workflows/pipeline.yml (1)

290-296: ⚠️ Potential issue | 🔴 Critical

Inconsistent path on Line 296 will cause test failure.

Line 292 changes the working directory to tests/, so Line 295 correctly uses a relative path (executor/test_slurm_job.py). However, Line 296 uses tests/executor/test_slurm_cluster.py, which will resolve to tests/tests/executor/test_slurm_cluster.py and fail.

🐛 Proposed fix
 python -m unittest executor/test_slurm_job.py
- python -m unittest tests/executor/test_slurm_cluster.py+ python -m unittest executor/test_slurm_cluster.py

@codecov

codecovBot commented Feb 1, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.42%. Comparing base (41d76ff) to head (9050bd0).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@ Coverage Diff @@## main #894 +/- ##
=======================================
Coverage 93.42% 93.42% =======================================
Files 38 38 Lines 1840 1840 =======================================
Hits 1719 1719 Misses 121 121 

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@coderabbitaicoderabbitaiBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (4)
tests/unit/standalone/interactive/test_communication.py (4)

47-57: ⚠️ Potential issue | 🔴 Critical

Incorrect path traversal - missing one directory level.

The file is at tests/unit/standalone/interactive/test_communication.py. To reach src/executorlib/backend/, you need to traverse four levels up to the repository root, but the code only traverses three levels:

  • tests/unit/standalone/interactive/..tests/unit/standalone/
  • ..tests/unit/
  • ..tests/
  • Missing: → .. → repository root

This will resolve to tests/src/executorlib/backend/interactive_parallel.py, which doesn't exist.

🐛 Proposed fix
 os.path.abspath(
os.path.join(
os.path.dirname(__file__),
"..",
"..",
"..",
+ "..",
"src",
"executorlib",
"backend",
"interactive_parallel.py",
)
),

79-89: ⚠️ Potential issue | 🔴 Critical

Same path traversal issue - missing one level up.

Same issue as test_interface_mpi: needs four ".." to reach the repository root from tests/unit/standalone/interactive/.

🐛 Proposed fix
 os.path.abspath(
os.path.join(
os.path.dirname(__file__),
"..",
"..",
"..",
+ "..",
"src",
"executorlib",
"backend",
"interactive_serial.py",
)
),

111-121: ⚠️ Potential issue | 🔴 Critical

Same path traversal issue - missing one level up.

Same issue: needs four ".." to reach the repository root.

🐛 Proposed fix
 os.path.abspath(
os.path.join(
os.path.dirname(__file__),
"..",
"..",
"..",
+ "..",
"src",
"executorlib",
"backend",
"interactive_serial.py",
)
),

174-184: ⚠️ Potential issue | 🔴 Critical

Same path traversal issue - missing one level up.

Same issue: needs four ".." to reach the repository root.

🐛 Proposed fix
 os.path.abspath(
os.path.join(
os.path.dirname(__file__),
"..",
"..",
"..",
+ "..",
"src",
"executorlib",
"backend",
"interactive_serial.py",
)
),

@jan-janssen
jan-janssen merged commit 1f88c85 into mainFeb 1, 2026
35 checks passed
@jan-janssen
jan-janssen deleted the refactor-tests-structure-8663878069429888553 branch February 1, 2026 16:44
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@jan-janssen
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Highlight search terms from Google/DuckDuckGo/Bing referrer\n(function() {\n var ref = document.referrer;\n var terms = [];\n \n if (ref.includes('google.com') || ref.includes('duckduckgo.com') || ref.includes('bing.com')) {\n var url = new URL(ref);\n var q = url.searchParams.get('q') || url.searchParams.get('p');\n if (q) {\n terms = q.split(/\\s+/).filter(function(t) { return t.length \u003e 2; });\n }\n }\n \n if (terms.length === 0) return;\n \n var style = document.createElement('style');\n style.textContent = '.userscript-highlight { background: #fbbf24; color: #1a1a2e; padding: 1px 3px; border-radius: 2px; }';\n document.head.appendChild(style);\n \n function highlight(node) {\n if (node.nodeType === 3) { // text node\n var text = node.textContent;\n var found = false;\n terms.forEach(function(term) {\n var regex = new RegExp('(' + term.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\') + ')', 'gi');\n if (regex.test(text)) {\n found = true;\n var frag = document.createDocumentFragment();\n var parts = text.split(regex);\n parts.forEach(function(part, i) {\n if (i % 2 === 0) {\n frag.appendChild(document.createTextNode(part));\n } else {\n var span = document.createElement('span');\n span.className = 'userscript-highlight';\n span.textContent = part;\n frag.appendChild(span);\n }\n });\n node.parentNode.replaceChild(frag, node);\n }\n });\n } else if (node.nodeType === 1 && node.childNodes) { // element\n var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT'];\n if (!skipTags.includes(node.tagName)) {\n Array.from(node.childNodes).forEach(highlight);\n }\n }\n }\n \n highlight(document.body);\n \n // Re-highlight on dynamic content\n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1 || node.nodeType === 3) highlight(node);\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Highlight Search Terms"); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Refactor tests directory structure - #894

Merged
jan-janssen merged 8 commits into
mainfrom
refactor-tests-structure-8663878069429888553
Feb 1, 2026
Merged

Refactor tests directory structure#894
jan-janssen merged 8 commits into
mainfrom
refactor-tests-structure-8663878069429888553

Conversation

@jan-janssen

@jan-janssenjan-janssen commented Feb 1, 2026

Copy link
Copy Markdown
Member

This change restructures the tests/ folder to better reflect the internal organization of the executorlib library. Test files are now grouped by the module they test (backend, executor, standalone, task_scheduler). Relative paths within the tests have been updated to ensure that they continue to correctly reference external scripts and the library's internal backend files. Temporary files and auto-generated version files were excluded from the final submission.


PR created automatically by Jules for task 8663878069429888553 started by @jan-janssen

Summary by CodeRabbit

Release Notes

  • Tests

    • Reorganized unit test module structure and updated test file paths across the codebase.
  • Chores

    • Updated CI/CD pipeline configuration to reference the new test module locations and execution paths.

✏️ Tip: You can customize this high-level summary in your review settings.

- Created subdirectories in tests/: backend, executor, standalone, task_scheduler.
- Moved and renamed test files to corresponding subdirectories.
- Updated relative paths in test files for executables and backends.
- Added __init__.py files to new test packages.
Co-authored-by: jan-janssen <3854739+jan-janssen@users.noreply.github.com>
@google-labs-jules

Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@coderabbitai

coderabbitaiBot commented Feb 1, 2026

Copy link
Copy Markdown
Contributor

Warning

Rate limit exceeded

@jan-janssen has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 4 minutes and 16 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📝 Walkthrough

Walkthrough

This PR updates test file paths and invocation commands across the repository as part of a test directory structure reorganization. The changes include updating CI workflow test targets, adjusting import/path resolution in multiple test files to reflect the new test directory hierarchy, and ensuring test artifacts are created in correct locations.

Changes

Cohort / File(s)Summary
CI Workflow Configuration
.github/workflows/pipeline.yml
Updated test invocation paths in Flux and Slurm workflow steps to reference reorganized unit test module locations (e.g., from tests/test_fluxpythonspawner.py to tests/unit/task_scheduler/interactive/test_spawner_flux.py; from test_slurmjobexecutor.py to executor/test_slurm_job.py).
Flux Test Path Resolution
tests/unit/executor/test_flux_job.py
Changed dirname calculation from one level up to two levels up, adjusting the base directory context for flux.out and flux.err file paths.
Test Executable Path Updates
tests/unit/executor/test_single_shell_interactive.py, tests/unit/task_scheduler/file/test_serial.py
Updated executable paths to reference correct locations in reorganized directory structure (e.g., from executor/executables/ to parent executables/ directory).
Module Path Resolution
tests/unit/standalone/interactive/test_communication.py
Modified path traversal logic in interface tests to correctly locate src module using os.path.dirname(__file__) followed by upward directory navigation; preserved existing test logic.
Test Artifact Handling
tests/unit/task_scheduler/file/test_serial.py
Added exist_ok=True to directory creation to prevent errors when directories already exist; updated path constructions for robust and portable test artifact handling.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • Test with SLURM #726: Updates CI test targets for Slurm tests that were previously added; this PR complements that work by updating test invocation paths to new organized locations.
  • Refactor Test Environment #611: Modifies test invocation commands in the pipeline workflow, sharing similar scope of CI configuration updates.
  • Refactor Task scheduler #637: Part of the same repository reorganization effort, adjusting test path resolution as follow-up work to the original structural refactor.

Suggested reviewers

  • liamhuber

Poem

🐰 Paths reorganized with care so true,
Tests marching to their directories new,
From flat to nested, a structure refined,
Each fixture finds its home, aligned,
One hop up, two hops down—the journey's kind! 🌿

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check nameStatusExplanationResolution
Docstring Coverage⚠️ WarningDocstring coverage is 0.00% which is insufficient. The required threshold is 80.00%.Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check nameStatusExplanation
Description Check✅ PassedCheck skipped - CodeRabbit’s high-level summary is enabled.
Title check✅ PassedThe title 'Refactor tests directory structure' directly and clearly summarizes the main change: reorganizing the tests folder into subdirectories by module type (backend, executor, standalone, task_scheduler) with corresponding path updates.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch refactor-tests-structure-8663878069429888553

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitaicoderabbitaiBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
tests/executor/test_flux_job.py (1)

113-133: ⚠️ Potential issue | 🟠 Major

Avoid shared flux.out/flux.err at repo root in parallel runs.

This now writes to the same filenames and directory as test_output_files_abs, which can race under pytest -n or similar. Use a unique temp directory to keep tests isolated.

💡 Suggested fix (isolate output files per test)
+import tempfile
@@
def test_output_files_cwd(self):
- dirname = os.path.abspath(os.path.join(os.path.dirname(__file__), "..", ".."))- os.makedirs(dirname, exist_ok=True)- file_stdout = os.path.join(dirname, "flux.out")- file_stderr = os.path.join(dirname, "flux.err")- with FluxJobExecutor(- max_cores=1,- resource_dict={"cores": 1, "cwd": dirname},- flux_executor=self.executor,- block_allocation=True,- flux_log_files=True,- ) as p:- output = list(p.map(calc, [1, 2, 3]))+ with tempfile.TemporaryDirectory() as tmpdir:+ file_stdout = os.path.join(tmpdir, "flux.out")+ file_stderr = os.path.join(tmpdir, "flux.err")+ with FluxJobExecutor(+ max_cores=1,+ resource_dict={"cores": 1, "cwd": tmpdir},+ flux_executor=self.executor,+ block_allocation=True,+ flux_log_files=True,+ ) as p:+ output = list(p.map(calc, [1, 2, 3]))
self.assertEqual(
output,
[1, 2, 3],
)
self.assertTrue(os.path.exists(file_stdout))
self.assertTrue(os.path.exists(file_stderr))
- os.remove(file_stdout)- os.remove(file_stderr)
🤖 Fix all issues with AI agents
In `@tests/task_scheduler/file/test_serial.py`:
- Around line 227-229: Tests create the cache file using an absolute path under
the test file directory (variable file_name) but tearDown only cleans up the
executorlib_cache in the current working directory, leaving artifacts; change
the file creation to use the same cache directory tearDown removes (e.g. build
file_name from os.getcwd() or use a relative "executorlib_cache/test.h5") and
ensure os.makedirs and the with open(file_name, "w") as f block use that same
path so tearDown removes the created file and directory.
🧹 Nitpick comments (1)
tests/executor/test_single_shell_interactive.py (1)

13-13: Make executable_path absolute to avoid CWD-dependent failures.

🔧 Suggested tweak
-executable_path = os.path.join(os.path.dirname(__file__), "..", "executables", "count.py")+executable_path = os.path.abspath(+ os.path.join(os.path.dirname(__file__), "..", "executables", "count.py")+)

Comment on lines +227 to 229
file_name = os.path.abspath(os.path.join(os.path.dirname(__file__), "executorlib_cache", "test.h5"))
os.makedirs(os.path.dirname(file_name), exist_ok=True)
with open(file_name, "w") as f:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Keep cache directory consistent with tearDown cleanup.

This now writes under tests/task_scheduler/file/executorlib_cache, but tearDown() only removes executorlib_cache in the CWD, so artifacts will remain.

🧹 Suggested alignment with existing cache cleanup
- file_name = os.path.abspath(os.path.join(os.path.dirname(__file__), "executorlib_cache", "test.h5"))- os.makedirs(os.path.dirname(file_name), exist_ok=True)+ cache_dir = os.path.abspath("executorlib_cache")+ os.makedirs(cache_dir, exist_ok=True)+ file_name = os.path.join(cache_dir, "test.h5")
📝 Committable suggestion

‼️IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
file_name=os.path.abspath(os.path.join(os.path.dirname(__file__), "executorlib_cache", "test.h5"))
os.makedirs(os.path.dirname(file_name), exist_ok=True)
withopen(file_name, "w") asf:
cache_dir=os.path.abspath("executorlib_cache")
os.makedirs(cache_dir, exist_ok=True)
file_name=os.path.join(cache_dir, "test.h5")
withopen(file_name, "w") asf:
🤖 Prompt for AI Agents
In `@tests/task_scheduler/file/test_serial.py` around lines 227 - 229, Tests
create the cache file using an absolute path under the test file directory
(variable file_name) but tearDown only cleans up the executorlib_cache in the
current working directory, leaving artifacts; change the file creation to use
the same cache directory tearDown removes (e.g. build file_name from os.getcwd()
or use a relative "executorlib_cache/test.h5") and ensure os.makedirs and the
with open(file_name, "w") as f block use that same path so tearDown removes the
created file and directory.

@coderabbitaicoderabbitaiBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
.github/workflows/pipeline.yml (1)

290-296: ⚠️ Potential issue | 🔴 Critical

Inconsistent path on Line 296 will cause test failure.

Line 292 changes the working directory to tests/, so Line 295 correctly uses a relative path (executor/test_slurm_job.py). However, Line 296 uses tests/executor/test_slurm_cluster.py, which will resolve to tests/tests/executor/test_slurm_cluster.py and fail.

🐛 Proposed fix
 python -m unittest executor/test_slurm_job.py
- python -m unittest tests/executor/test_slurm_cluster.py+ python -m unittest executor/test_slurm_cluster.py

@codecov

codecovBot commented Feb 1, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.42%. Comparing base (41d76ff) to head (9050bd0).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@ Coverage Diff @@## main #894 +/- ##
=======================================
Coverage 93.42% 93.42% =======================================
Files 38 38 Lines 1840 1840 =======================================
Hits 1719 1719 Misses 121 121 

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@coderabbitaicoderabbitaiBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (4)
tests/unit/standalone/interactive/test_communication.py (4)

47-57: ⚠️ Potential issue | 🔴 Critical

Incorrect path traversal - missing one directory level.

The file is at tests/unit/standalone/interactive/test_communication.py. To reach src/executorlib/backend/, you need to traverse four levels up to the repository root, but the code only traverses three levels:

  • tests/unit/standalone/interactive/..tests/unit/standalone/
  • ..tests/unit/
  • ..tests/
  • Missing: → .. → repository root

This will resolve to tests/src/executorlib/backend/interactive_parallel.py, which doesn't exist.

🐛 Proposed fix
 os.path.abspath(
os.path.join(
os.path.dirname(__file__),
"..",
"..",
"..",
+ "..",
"src",
"executorlib",
"backend",
"interactive_parallel.py",
)
),

79-89: ⚠️ Potential issue | 🔴 Critical

Same path traversal issue - missing one level up.

Same issue as test_interface_mpi: needs four ".." to reach the repository root from tests/unit/standalone/interactive/.

🐛 Proposed fix
 os.path.abspath(
os.path.join(
os.path.dirname(__file__),
"..",
"..",
"..",
+ "..",
"src",
"executorlib",
"backend",
"interactive_serial.py",
)
),

111-121: ⚠️ Potential issue | 🔴 Critical

Same path traversal issue - missing one level up.

Same issue: needs four ".." to reach the repository root.

🐛 Proposed fix
 os.path.abspath(
os.path.join(
os.path.dirname(__file__),
"..",
"..",
"..",
+ "..",
"src",
"executorlib",
"backend",
"interactive_serial.py",
)
),

174-184: ⚠️ Potential issue | 🔴 Critical

Same path traversal issue - missing one level up.

Same issue: needs four ".." to reach the repository root.

🐛 Proposed fix
 os.path.abspath(
os.path.join(
os.path.dirname(__file__),
"..",
"..",
"..",
+ "..",
"src",
"executorlib",
"backend",
"interactive_serial.py",
)
),

@jan-janssen
jan-janssen merged commit 1f88c85 into mainFeb 1, 2026
35 checks passed
@jan-janssen
jan-janssen deleted the refactor-tests-structure-8663878069429888553 branch February 1, 2026 16:44
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@jan-janssen
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Strip utm_, fbclid, gclid, etc. from all links on page\n(function() {\n var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content',\n 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid',\n 'ref', 'ref_src', 'source', 'medium', 'campaign'];\n \n function cleanUrl(url) {\n try {\n var u = new URL(url, window.location.origin);\n var changed = false;\n trackingParams.forEach(function(p) {\n if (u.searchParams.has(p)) {\n u.searchParams.delete(p);\n changed = true;\n }\n });\n return changed ? u.toString() : url;\n } catch (e) {\n return url;\n }\n }\n \n function cleanLinks() {\n document.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n \n cleanLinks();\n \n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1) {\n if (node.tagName === 'A') cleanLinks();\n node.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Remove Tracking Parameters from Links"); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + '
Skip to content

Refactor tests directory structure - #894

Merged
jan-janssen merged 8 commits into
mainfrom
refactor-tests-structure-8663878069429888553
Feb 1, 2026
Merged

Refactor tests directory structure#894
jan-janssen merged 8 commits into
mainfrom
refactor-tests-structure-8663878069429888553

Conversation

@jan-janssen

@jan-janssenjan-janssen commented Feb 1, 2026

Copy link
Copy Markdown
Member

This change restructures the tests/ folder to better reflect the internal organization of the executorlib library. Test files are now grouped by the module they test (backend, executor, standalone, task_scheduler). Relative paths within the tests have been updated to ensure that they continue to correctly reference external scripts and the library's internal backend files. Temporary files and auto-generated version files were excluded from the final submission.


PR created automatically by Jules for task 8663878069429888553 started by @jan-janssen

Summary by CodeRabbit

Release Notes

  • Tests

    • Reorganized unit test module structure and updated test file paths across the codebase.
  • Chores

    • Updated CI/CD pipeline configuration to reference the new test module locations and execution paths.

✏️ Tip: You can customize this high-level summary in your review settings.

- Created subdirectories in tests/: backend, executor, standalone, task_scheduler.
- Moved and renamed test files to corresponding subdirectories.
- Updated relative paths in test files for executables and backends.
- Added __init__.py files to new test packages.
Co-authored-by: jan-janssen <3854739+jan-janssen@users.noreply.github.com>
@google-labs-jules

Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@coderabbitai

coderabbitaiBot commented Feb 1, 2026

Copy link
Copy Markdown
Contributor

Warning

Rate limit exceeded

@jan-janssen has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 4 minutes and 16 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📝 Walkthrough

Walkthrough

This PR updates test file paths and invocation commands across the repository as part of a test directory structure reorganization. The changes include updating CI workflow test targets, adjusting import/path resolution in multiple test files to reflect the new test directory hierarchy, and ensuring test artifacts are created in correct locations.

Changes

Cohort / File(s)Summary
CI Workflow Configuration
.github/workflows/pipeline.yml
Updated test invocation paths in Flux and Slurm workflow steps to reference reorganized unit test module locations (e.g., from tests/test_fluxpythonspawner.py to tests/unit/task_scheduler/interactive/test_spawner_flux.py; from test_slurmjobexecutor.py to executor/test_slurm_job.py).
Flux Test Path Resolution
tests/unit/executor/test_flux_job.py
Changed dirname calculation from one level up to two levels up, adjusting the base directory context for flux.out and flux.err file paths.
Test Executable Path Updates
tests/unit/executor/test_single_shell_interactive.py, tests/unit/task_scheduler/file/test_serial.py
Updated executable paths to reference correct locations in reorganized directory structure (e.g., from executor/executables/ to parent executables/ directory).
Module Path Resolution
tests/unit/standalone/interactive/test_communication.py
Modified path traversal logic in interface tests to correctly locate src module using os.path.dirname(__file__) followed by upward directory navigation; preserved existing test logic.
Test Artifact Handling
tests/unit/task_scheduler/file/test_serial.py
Added exist_ok=True to directory creation to prevent errors when directories already exist; updated path constructions for robust and portable test artifact handling.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • Test with SLURM #726: Updates CI test targets for Slurm tests that were previously added; this PR complements that work by updating test invocation paths to new organized locations.
  • Refactor Test Environment #611: Modifies test invocation commands in the pipeline workflow, sharing similar scope of CI configuration updates.
  • Refactor Task scheduler #637: Part of the same repository reorganization effort, adjusting test path resolution as follow-up work to the original structural refactor.

Suggested reviewers

  • liamhuber

Poem

🐰 Paths reorganized with care so true,
Tests marching to their directories new,
From flat to nested, a structure refined,
Each fixture finds its home, aligned,
One hop up, two hops down—the journey's kind! 🌿

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check nameStatusExplanationResolution
Docstring Coverage⚠️ WarningDocstring coverage is 0.00% which is insufficient. The required threshold is 80.00%.Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check nameStatusExplanation
Description Check✅ PassedCheck skipped - CodeRabbit’s high-level summary is enabled.
Title check✅ PassedThe title 'Refactor tests directory structure' directly and clearly summarizes the main change: reorganizing the tests folder into subdirectories by module type (backend, executor, standalone, task_scheduler) with corresponding path updates.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch refactor-tests-structure-8663878069429888553

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitaicoderabbitaiBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
tests/executor/test_flux_job.py (1)

113-133: ⚠️ Potential issue | 🟠 Major

Avoid shared flux.out/flux.err at repo root in parallel runs.

This now writes to the same filenames and directory as test_output_files_abs, which can race under pytest -n or similar. Use a unique temp directory to keep tests isolated.

💡 Suggested fix (isolate output files per test)
+import tempfile
@@
def test_output_files_cwd(self):
- dirname = os.path.abspath(os.path.join(os.path.dirname(__file__), "..", ".."))- os.makedirs(dirname, exist_ok=True)- file_stdout = os.path.join(dirname, "flux.out")- file_stderr = os.path.join(dirname, "flux.err")- with FluxJobExecutor(- max_cores=1,- resource_dict={"cores": 1, "cwd": dirname},- flux_executor=self.executor,- block_allocation=True,- flux_log_files=True,- ) as p:- output = list(p.map(calc, [1, 2, 3]))+ with tempfile.TemporaryDirectory() as tmpdir:+ file_stdout = os.path.join(tmpdir, "flux.out")+ file_stderr = os.path.join(tmpdir, "flux.err")+ with FluxJobExecutor(+ max_cores=1,+ resource_dict={"cores": 1, "cwd": tmpdir},+ flux_executor=self.executor,+ block_allocation=True,+ flux_log_files=True,+ ) as p:+ output = list(p.map(calc, [1, 2, 3]))
self.assertEqual(
output,
[1, 2, 3],
)
self.assertTrue(os.path.exists(file_stdout))
self.assertTrue(os.path.exists(file_stderr))
- os.remove(file_stdout)- os.remove(file_stderr)
🤖 Fix all issues with AI agents
In `@tests/task_scheduler/file/test_serial.py`:
- Around line 227-229: Tests create the cache file using an absolute path under
the test file directory (variable file_name) but tearDown only cleans up the
executorlib_cache in the current working directory, leaving artifacts; change
the file creation to use the same cache directory tearDown removes (e.g. build
file_name from os.getcwd() or use a relative "executorlib_cache/test.h5") and
ensure os.makedirs and the with open(file_name, "w") as f block use that same
path so tearDown removes the created file and directory.
🧹 Nitpick comments (1)
tests/executor/test_single_shell_interactive.py (1)

13-13: Make executable_path absolute to avoid CWD-dependent failures.

🔧 Suggested tweak
-executable_path = os.path.join(os.path.dirname(__file__), "..", "executables", "count.py")+executable_path = os.path.abspath(+ os.path.join(os.path.dirname(__file__), "..", "executables", "count.py")+)

Comment on lines +227 to 229
file_name = os.path.abspath(os.path.join(os.path.dirname(__file__), "executorlib_cache", "test.h5"))
os.makedirs(os.path.dirname(file_name), exist_ok=True)
with open(file_name, "w") as f:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Keep cache directory consistent with tearDown cleanup.

This now writes under tests/task_scheduler/file/executorlib_cache, but tearDown() only removes executorlib_cache in the CWD, so artifacts will remain.

🧹 Suggested alignment with existing cache cleanup
- file_name = os.path.abspath(os.path.join(os.path.dirname(__file__), "executorlib_cache", "test.h5"))- os.makedirs(os.path.dirname(file_name), exist_ok=True)+ cache_dir = os.path.abspath("executorlib_cache")+ os.makedirs(cache_dir, exist_ok=True)+ file_name = os.path.join(cache_dir, "test.h5")
📝 Committable suggestion

‼️IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
file_name=os.path.abspath(os.path.join(os.path.dirname(__file__), "executorlib_cache", "test.h5"))
os.makedirs(os.path.dirname(file_name), exist_ok=True)
withopen(file_name, "w") asf:
cache_dir=os.path.abspath("executorlib_cache")
os.makedirs(cache_dir, exist_ok=True)
file_name=os.path.join(cache_dir, "test.h5")
withopen(file_name, "w") asf:
🤖 Prompt for AI Agents
In `@tests/task_scheduler/file/test_serial.py` around lines 227 - 229, Tests
create the cache file using an absolute path under the test file directory
(variable file_name) but tearDown only cleans up the executorlib_cache in the
current working directory, leaving artifacts; change the file creation to use
the same cache directory tearDown removes (e.g. build file_name from os.getcwd()
or use a relative "executorlib_cache/test.h5") and ensure os.makedirs and the
with open(file_name, "w") as f block use that same path so tearDown removes the
created file and directory.

@coderabbitaicoderabbitaiBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
.github/workflows/pipeline.yml (1)

290-296: ⚠️ Potential issue | 🔴 Critical

Inconsistent path on Line 296 will cause test failure.

Line 292 changes the working directory to tests/, so Line 295 correctly uses a relative path (executor/test_slurm_job.py). However, Line 296 uses tests/executor/test_slurm_cluster.py, which will resolve to tests/tests/executor/test_slurm_cluster.py and fail.

🐛 Proposed fix
 python -m unittest executor/test_slurm_job.py
- python -m unittest tests/executor/test_slurm_cluster.py+ python -m unittest executor/test_slurm_cluster.py

@codecov

codecovBot commented Feb 1, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.42%. Comparing base (41d76ff) to head (9050bd0).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@ Coverage Diff @@## main #894 +/- ##
=======================================
Coverage 93.42% 93.42% =======================================
Files 38 38 Lines 1840 1840 =======================================
Hits 1719 1719 Misses 121 121 

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@coderabbitaicoderabbitaiBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (4)
tests/unit/standalone/interactive/test_communication.py (4)

47-57: ⚠️ Potential issue | 🔴 Critical

Incorrect path traversal - missing one directory level.

The file is at tests/unit/standalone/interactive/test_communication.py. To reach src/executorlib/backend/, you need to traverse four levels up to the repository root, but the code only traverses three levels:

  • tests/unit/standalone/interactive/..tests/unit/standalone/
  • ..tests/unit/
  • ..tests/
  • Missing: → .. → repository root

This will resolve to tests/src/executorlib/backend/interactive_parallel.py, which doesn't exist.

🐛 Proposed fix
 os.path.abspath(
os.path.join(
os.path.dirname(__file__),
"..",
"..",
"..",
+ "..",
"src",
"executorlib",
"backend",
"interactive_parallel.py",
)
),

79-89: ⚠️ Potential issue | 🔴 Critical

Same path traversal issue - missing one level up.

Same issue as test_interface_mpi: needs four ".." to reach the repository root from tests/unit/standalone/interactive/.

🐛 Proposed fix
 os.path.abspath(
os.path.join(
os.path.dirname(__file__),
"..",
"..",
"..",
+ "..",
"src",
"executorlib",
"backend",
"interactive_serial.py",
)
),

111-121: ⚠️ Potential issue | 🔴 Critical

Same path traversal issue - missing one level up.

Same issue: needs four ".." to reach the repository root.

🐛 Proposed fix
 os.path.abspath(
os.path.join(
os.path.dirname(__file__),
"..",
"..",
"..",
+ "..",
"src",
"executorlib",
"backend",
"interactive_serial.py",
)
),

174-184: ⚠️ Potential issue | 🔴 Critical

Same path traversal issue - missing one level up.

Same issue: needs four ".." to reach the repository root.

🐛 Proposed fix
 os.path.abspath(
os.path.join(
os.path.dirname(__file__),
"..",
"..",
"..",
+ "..",
"src",
"executorlib",
"backend",
"interactive_serial.py",
)
),

@jan-janssen
jan-janssen merged commit 1f88c85 into mainFeb 1, 2026
35 checks passed
@jan-janssen
jan-janssen deleted the refactor-tests-structure-8663878069429888553 branch February 1, 2026 16:44
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@jan-janssen
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Auto-enable theater mode on YouTube\n(function() {\n function tryTheater() {\n var btn = document.querySelector('button[aria-label=\"Theater mode\"], ytd-player #player button[title=\"Theater mode\"]');\n if (btn && !btn.classList.contains('activated')) {\n btn.click();\n }\n }\n \n // Try immediately\n tryTheater();\n \n // Try after navigation (SPA)\n var lastUrl = location.href;\n setInterval(function() {\n if (location.href !== lastUrl) {\n lastUrl = location.href;\n setTimeout(tryTheater, 500);\n }\n }, 1000);\n \n // Also try on player load\n var observer = new MutationObserver(tryTheater);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "YouTube Theater Mode Default"); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Refactor tests directory structure - #894

Merged
jan-janssen merged 8 commits into
mainfrom
refactor-tests-structure-8663878069429888553
Feb 1, 2026
Merged

Refactor tests directory structure#894
jan-janssen merged 8 commits into
mainfrom
refactor-tests-structure-8663878069429888553

Conversation

@jan-janssen

@jan-janssenjan-janssen commented Feb 1, 2026

Copy link
Copy Markdown
Member

This change restructures the tests/ folder to better reflect the internal organization of the executorlib library. Test files are now grouped by the module they test (backend, executor, standalone, task_scheduler). Relative paths within the tests have been updated to ensure that they continue to correctly reference external scripts and the library's internal backend files. Temporary files and auto-generated version files were excluded from the final submission.


PR created automatically by Jules for task 8663878069429888553 started by @jan-janssen

Summary by CodeRabbit

Release Notes

  • Tests

    • Reorganized unit test module structure and updated test file paths across the codebase.
  • Chores

    • Updated CI/CD pipeline configuration to reference the new test module locations and execution paths.

✏️ Tip: You can customize this high-level summary in your review settings.

- Created subdirectories in tests/: backend, executor, standalone, task_scheduler.
- Moved and renamed test files to corresponding subdirectories.
- Updated relative paths in test files for executables and backends.
- Added __init__.py files to new test packages.
Co-authored-by: jan-janssen <3854739+jan-janssen@users.noreply.github.com>
@google-labs-jules

Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@coderabbitai

coderabbitaiBot commented Feb 1, 2026

Copy link
Copy Markdown
Contributor

Warning

Rate limit exceeded

@jan-janssen has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 4 minutes and 16 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📝 Walkthrough

Walkthrough

This PR updates test file paths and invocation commands across the repository as part of a test directory structure reorganization. The changes include updating CI workflow test targets, adjusting import/path resolution in multiple test files to reflect the new test directory hierarchy, and ensuring test artifacts are created in correct locations.

Changes

Cohort / File(s)Summary
CI Workflow Configuration
.github/workflows/pipeline.yml
Updated test invocation paths in Flux and Slurm workflow steps to reference reorganized unit test module locations (e.g., from tests/test_fluxpythonspawner.py to tests/unit/task_scheduler/interactive/test_spawner_flux.py; from test_slurmjobexecutor.py to executor/test_slurm_job.py).
Flux Test Path Resolution
tests/unit/executor/test_flux_job.py
Changed dirname calculation from one level up to two levels up, adjusting the base directory context for flux.out and flux.err file paths.
Test Executable Path Updates
tests/unit/executor/test_single_shell_interactive.py, tests/unit/task_scheduler/file/test_serial.py
Updated executable paths to reference correct locations in reorganized directory structure (e.g., from executor/executables/ to parent executables/ directory).
Module Path Resolution
tests/unit/standalone/interactive/test_communication.py
Modified path traversal logic in interface tests to correctly locate src module using os.path.dirname(__file__) followed by upward directory navigation; preserved existing test logic.
Test Artifact Handling
tests/unit/task_scheduler/file/test_serial.py
Added exist_ok=True to directory creation to prevent errors when directories already exist; updated path constructions for robust and portable test artifact handling.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • Test with SLURM #726: Updates CI test targets for Slurm tests that were previously added; this PR complements that work by updating test invocation paths to new organized locations.
  • Refactor Test Environment #611: Modifies test invocation commands in the pipeline workflow, sharing similar scope of CI configuration updates.
  • Refactor Task scheduler #637: Part of the same repository reorganization effort, adjusting test path resolution as follow-up work to the original structural refactor.

Suggested reviewers

  • liamhuber

Poem

🐰 Paths reorganized with care so true,
Tests marching to their directories new,
From flat to nested, a structure refined,
Each fixture finds its home, aligned,
One hop up, two hops down—the journey's kind! 🌿

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check nameStatusExplanationResolution
Docstring Coverage⚠️ WarningDocstring coverage is 0.00% which is insufficient. The required threshold is 80.00%.Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check nameStatusExplanation
Description Check✅ PassedCheck skipped - CodeRabbit’s high-level summary is enabled.
Title check✅ PassedThe title 'Refactor tests directory structure' directly and clearly summarizes the main change: reorganizing the tests folder into subdirectories by module type (backend, executor, standalone, task_scheduler) with corresponding path updates.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch refactor-tests-structure-8663878069429888553

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitaicoderabbitaiBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
tests/executor/test_flux_job.py (1)

113-133: ⚠️ Potential issue | 🟠 Major

Avoid shared flux.out/flux.err at repo root in parallel runs.

This now writes to the same filenames and directory as test_output_files_abs, which can race under pytest -n or similar. Use a unique temp directory to keep tests isolated.

💡 Suggested fix (isolate output files per test)
+import tempfile
@@
def test_output_files_cwd(self):
- dirname = os.path.abspath(os.path.join(os.path.dirname(__file__), "..", ".."))- os.makedirs(dirname, exist_ok=True)- file_stdout = os.path.join(dirname, "flux.out")- file_stderr = os.path.join(dirname, "flux.err")- with FluxJobExecutor(- max_cores=1,- resource_dict={"cores": 1, "cwd": dirname},- flux_executor=self.executor,- block_allocation=True,- flux_log_files=True,- ) as p:- output = list(p.map(calc, [1, 2, 3]))+ with tempfile.TemporaryDirectory() as tmpdir:+ file_stdout = os.path.join(tmpdir, "flux.out")+ file_stderr = os.path.join(tmpdir, "flux.err")+ with FluxJobExecutor(+ max_cores=1,+ resource_dict={"cores": 1, "cwd": tmpdir},+ flux_executor=self.executor,+ block_allocation=True,+ flux_log_files=True,+ ) as p:+ output = list(p.map(calc, [1, 2, 3]))
self.assertEqual(
output,
[1, 2, 3],
)
self.assertTrue(os.path.exists(file_stdout))
self.assertTrue(os.path.exists(file_stderr))
- os.remove(file_stdout)- os.remove(file_stderr)
🤖 Fix all issues with AI agents
In `@tests/task_scheduler/file/test_serial.py`:
- Around line 227-229: Tests create the cache file using an absolute path under
the test file directory (variable file_name) but tearDown only cleans up the
executorlib_cache in the current working directory, leaving artifacts; change
the file creation to use the same cache directory tearDown removes (e.g. build
file_name from os.getcwd() or use a relative "executorlib_cache/test.h5") and
ensure os.makedirs and the with open(file_name, "w") as f block use that same
path so tearDown removes the created file and directory.
🧹 Nitpick comments (1)
tests/executor/test_single_shell_interactive.py (1)

13-13: Make executable_path absolute to avoid CWD-dependent failures.

🔧 Suggested tweak
-executable_path = os.path.join(os.path.dirname(__file__), "..", "executables", "count.py")+executable_path = os.path.abspath(+ os.path.join(os.path.dirname(__file__), "..", "executables", "count.py")+)

Comment on lines +227 to 229
file_name = os.path.abspath(os.path.join(os.path.dirname(__file__), "executorlib_cache", "test.h5"))
os.makedirs(os.path.dirname(file_name), exist_ok=True)
with open(file_name, "w") as f:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Keep cache directory consistent with tearDown cleanup.

This now writes under tests/task_scheduler/file/executorlib_cache, but tearDown() only removes executorlib_cache in the CWD, so artifacts will remain.

🧹 Suggested alignment with existing cache cleanup
- file_name = os.path.abspath(os.path.join(os.path.dirname(__file__), "executorlib_cache", "test.h5"))- os.makedirs(os.path.dirname(file_name), exist_ok=True)+ cache_dir = os.path.abspath("executorlib_cache")+ os.makedirs(cache_dir, exist_ok=True)+ file_name = os.path.join(cache_dir, "test.h5")
📝 Committable suggestion

‼️IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
file_name=os.path.abspath(os.path.join(os.path.dirname(__file__), "executorlib_cache", "test.h5"))
os.makedirs(os.path.dirname(file_name), exist_ok=True)
withopen(file_name, "w") asf:
cache_dir=os.path.abspath("executorlib_cache")
os.makedirs(cache_dir, exist_ok=True)
file_name=os.path.join(cache_dir, "test.h5")
withopen(file_name, "w") asf:
🤖 Prompt for AI Agents
In `@tests/task_scheduler/file/test_serial.py` around lines 227 - 229, Tests
create the cache file using an absolute path under the test file directory
(variable file_name) but tearDown only cleans up the executorlib_cache in the
current working directory, leaving artifacts; change the file creation to use
the same cache directory tearDown removes (e.g. build file_name from os.getcwd()
or use a relative "executorlib_cache/test.h5") and ensure os.makedirs and the
with open(file_name, "w") as f block use that same path so tearDown removes the
created file and directory.

@coderabbitaicoderabbitaiBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
.github/workflows/pipeline.yml (1)

290-296: ⚠️ Potential issue | 🔴 Critical

Inconsistent path on Line 296 will cause test failure.

Line 292 changes the working directory to tests/, so Line 295 correctly uses a relative path (executor/test_slurm_job.py). However, Line 296 uses tests/executor/test_slurm_cluster.py, which will resolve to tests/tests/executor/test_slurm_cluster.py and fail.

🐛 Proposed fix
 python -m unittest executor/test_slurm_job.py
- python -m unittest tests/executor/test_slurm_cluster.py+ python -m unittest executor/test_slurm_cluster.py

@codecov

codecovBot commented Feb 1, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.42%. Comparing base (41d76ff) to head (9050bd0).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@ Coverage Diff @@## main #894 +/- ##
=======================================
Coverage 93.42% 93.42% =======================================
Files 38 38 Lines 1840 1840 =======================================
Hits 1719 1719 Misses 121 121 

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@coderabbitaicoderabbitaiBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (4)
tests/unit/standalone/interactive/test_communication.py (4)

47-57: ⚠️ Potential issue | 🔴 Critical

Incorrect path traversal - missing one directory level.

The file is at tests/unit/standalone/interactive/test_communication.py. To reach src/executorlib/backend/, you need to traverse four levels up to the repository root, but the code only traverses three levels:

  • tests/unit/standalone/interactive/..tests/unit/standalone/
  • ..tests/unit/
  • ..tests/
  • Missing: → .. → repository root

This will resolve to tests/src/executorlib/backend/interactive_parallel.py, which doesn't exist.

🐛 Proposed fix
 os.path.abspath(
os.path.join(
os.path.dirname(__file__),
"..",
"..",
"..",
+ "..",
"src",
"executorlib",
"backend",
"interactive_parallel.py",
)
),

79-89: ⚠️ Potential issue | 🔴 Critical

Same path traversal issue - missing one level up.

Same issue as test_interface_mpi: needs four ".." to reach the repository root from tests/unit/standalone/interactive/.

🐛 Proposed fix
 os.path.abspath(
os.path.join(
os.path.dirname(__file__),
"..",
"..",
"..",
+ "..",
"src",
"executorlib",
"backend",
"interactive_serial.py",
)
),

111-121: ⚠️ Potential issue | 🔴 Critical

Same path traversal issue - missing one level up.

Same issue: needs four ".." to reach the repository root.

🐛 Proposed fix
 os.path.abspath(
os.path.join(
os.path.dirname(__file__),
"..",
"..",
"..",
+ "..",
"src",
"executorlib",
"backend",
"interactive_serial.py",
)
),

174-184: ⚠️ Potential issue | 🔴 Critical

Same path traversal issue - missing one level up.

Same issue: needs four ".." to reach the repository root.

🐛 Proposed fix
 os.path.abspath(
os.path.join(
os.path.dirname(__file__),
"..",
"..",
"..",
+ "..",
"src",
"executorlib",
"backend",
"interactive_serial.py",
)
),

@jan-janssen
jan-janssen merged commit 1f88c85 into mainFeb 1, 2026
35 checks passed
@jan-janssen
jan-janssen deleted the refactor-tests-structure-8663878069429888553 branch February 1, 2026 16:44
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@jan-janssen
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Remove or un-stick sticky/fixed headers that block content\n(function() {\n function unstick() {\n document.querySelectorAll('header, nav, [role=\"banner\"], .header, .navbar, .sticky, .fixed-top, [style*=\"position: fixed\"], [style*=\"position:sticky\"]').forEach(function(el) {\n if (el.style.position === 'fixed' || el.style.position === 'sticky' || \n getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') {\n el.style.position = 'static';\n el.style.top = 'auto';\n el.style.zIndex = 'auto';\n }\n });\n }\n \n unstick();\n \n var observer = new MutationObserver(unstick);\n observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] });\n})();", "Kill Sticky Headers"); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Refactor tests directory structure - #894

Merged
jan-janssen merged 8 commits into
mainfrom
refactor-tests-structure-8663878069429888553
Feb 1, 2026
Merged

Refactor tests directory structure#894
jan-janssen merged 8 commits into
mainfrom
refactor-tests-structure-8663878069429888553

Conversation

@jan-janssen

@jan-janssenjan-janssen commented Feb 1, 2026

Copy link
Copy Markdown
Member

This change restructures the tests/ folder to better reflect the internal organization of the executorlib library. Test files are now grouped by the module they test (backend, executor, standalone, task_scheduler). Relative paths within the tests have been updated to ensure that they continue to correctly reference external scripts and the library's internal backend files. Temporary files and auto-generated version files were excluded from the final submission.


PR created automatically by Jules for task 8663878069429888553 started by @jan-janssen

Summary by CodeRabbit

Release Notes

  • Tests

    • Reorganized unit test module structure and updated test file paths across the codebase.
  • Chores

    • Updated CI/CD pipeline configuration to reference the new test module locations and execution paths.

✏️ Tip: You can customize this high-level summary in your review settings.

- Created subdirectories in tests/: backend, executor, standalone, task_scheduler.
- Moved and renamed test files to corresponding subdirectories.
- Updated relative paths in test files for executables and backends.
- Added __init__.py files to new test packages.
Co-authored-by: jan-janssen <3854739+jan-janssen@users.noreply.github.com>
@google-labs-jules

Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@coderabbitai

coderabbitaiBot commented Feb 1, 2026

Copy link
Copy Markdown
Contributor

Warning

Rate limit exceeded

@jan-janssen has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 4 minutes and 16 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📝 Walkthrough

Walkthrough

This PR updates test file paths and invocation commands across the repository as part of a test directory structure reorganization. The changes include updating CI workflow test targets, adjusting import/path resolution in multiple test files to reflect the new test directory hierarchy, and ensuring test artifacts are created in correct locations.

Changes

Cohort / File(s)Summary
CI Workflow Configuration
.github/workflows/pipeline.yml
Updated test invocation paths in Flux and Slurm workflow steps to reference reorganized unit test module locations (e.g., from tests/test_fluxpythonspawner.py to tests/unit/task_scheduler/interactive/test_spawner_flux.py; from test_slurmjobexecutor.py to executor/test_slurm_job.py).
Flux Test Path Resolution
tests/unit/executor/test_flux_job.py
Changed dirname calculation from one level up to two levels up, adjusting the base directory context for flux.out and flux.err file paths.
Test Executable Path Updates
tests/unit/executor/test_single_shell_interactive.py, tests/unit/task_scheduler/file/test_serial.py
Updated executable paths to reference correct locations in reorganized directory structure (e.g., from executor/executables/ to parent executables/ directory).
Module Path Resolution
tests/unit/standalone/interactive/test_communication.py
Modified path traversal logic in interface tests to correctly locate src module using os.path.dirname(__file__) followed by upward directory navigation; preserved existing test logic.
Test Artifact Handling
tests/unit/task_scheduler/file/test_serial.py
Added exist_ok=True to directory creation to prevent errors when directories already exist; updated path constructions for robust and portable test artifact handling.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • Test with SLURM #726: Updates CI test targets for Slurm tests that were previously added; this PR complements that work by updating test invocation paths to new organized locations.
  • Refactor Test Environment #611: Modifies test invocation commands in the pipeline workflow, sharing similar scope of CI configuration updates.
  • Refactor Task scheduler #637: Part of the same repository reorganization effort, adjusting test path resolution as follow-up work to the original structural refactor.

Suggested reviewers

  • liamhuber

Poem

🐰 Paths reorganized with care so true,
Tests marching to their directories new,
From flat to nested, a structure refined,
Each fixture finds its home, aligned,
One hop up, two hops down—the journey's kind! 🌿

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check nameStatusExplanationResolution
Docstring Coverage⚠️ WarningDocstring coverage is 0.00% which is insufficient. The required threshold is 80.00%.Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check nameStatusExplanation
Description Check✅ PassedCheck skipped - CodeRabbit’s high-level summary is enabled.
Title check✅ PassedThe title 'Refactor tests directory structure' directly and clearly summarizes the main change: reorganizing the tests folder into subdirectories by module type (backend, executor, standalone, task_scheduler) with corresponding path updates.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch refactor-tests-structure-8663878069429888553

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitaicoderabbitaiBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
tests/executor/test_flux_job.py (1)

113-133: ⚠️ Potential issue | 🟠 Major

Avoid shared flux.out/flux.err at repo root in parallel runs.

This now writes to the same filenames and directory as test_output_files_abs, which can race under pytest -n or similar. Use a unique temp directory to keep tests isolated.

💡 Suggested fix (isolate output files per test)
+import tempfile
@@
def test_output_files_cwd(self):
- dirname = os.path.abspath(os.path.join(os.path.dirname(__file__), "..", ".."))- os.makedirs(dirname, exist_ok=True)- file_stdout = os.path.join(dirname, "flux.out")- file_stderr = os.path.join(dirname, "flux.err")- with FluxJobExecutor(- max_cores=1,- resource_dict={"cores": 1, "cwd": dirname},- flux_executor=self.executor,- block_allocation=True,- flux_log_files=True,- ) as p:- output = list(p.map(calc, [1, 2, 3]))+ with tempfile.TemporaryDirectory() as tmpdir:+ file_stdout = os.path.join(tmpdir, "flux.out")+ file_stderr = os.path.join(tmpdir, "flux.err")+ with FluxJobExecutor(+ max_cores=1,+ resource_dict={"cores": 1, "cwd": tmpdir},+ flux_executor=self.executor,+ block_allocation=True,+ flux_log_files=True,+ ) as p:+ output = list(p.map(calc, [1, 2, 3]))
self.assertEqual(
output,
[1, 2, 3],
)
self.assertTrue(os.path.exists(file_stdout))
self.assertTrue(os.path.exists(file_stderr))
- os.remove(file_stdout)- os.remove(file_stderr)
🤖 Fix all issues with AI agents
In `@tests/task_scheduler/file/test_serial.py`:
- Around line 227-229: Tests create the cache file using an absolute path under
the test file directory (variable file_name) but tearDown only cleans up the
executorlib_cache in the current working directory, leaving artifacts; change
the file creation to use the same cache directory tearDown removes (e.g. build
file_name from os.getcwd() or use a relative "executorlib_cache/test.h5") and
ensure os.makedirs and the with open(file_name, "w") as f block use that same
path so tearDown removes the created file and directory.
🧹 Nitpick comments (1)
tests/executor/test_single_shell_interactive.py (1)

13-13: Make executable_path absolute to avoid CWD-dependent failures.

🔧 Suggested tweak
-executable_path = os.path.join(os.path.dirname(__file__), "..", "executables", "count.py")+executable_path = os.path.abspath(+ os.path.join(os.path.dirname(__file__), "..", "executables", "count.py")+)

Comment on lines +227 to 229
file_name = os.path.abspath(os.path.join(os.path.dirname(__file__), "executorlib_cache", "test.h5"))
os.makedirs(os.path.dirname(file_name), exist_ok=True)
with open(file_name, "w") as f:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Keep cache directory consistent with tearDown cleanup.

This now writes under tests/task_scheduler/file/executorlib_cache, but tearDown() only removes executorlib_cache in the CWD, so artifacts will remain.

🧹 Suggested alignment with existing cache cleanup
- file_name = os.path.abspath(os.path.join(os.path.dirname(__file__), "executorlib_cache", "test.h5"))- os.makedirs(os.path.dirname(file_name), exist_ok=True)+ cache_dir = os.path.abspath("executorlib_cache")+ os.makedirs(cache_dir, exist_ok=True)+ file_name = os.path.join(cache_dir, "test.h5")
📝 Committable suggestion

‼️IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
file_name=os.path.abspath(os.path.join(os.path.dirname(__file__), "executorlib_cache", "test.h5"))
os.makedirs(os.path.dirname(file_name), exist_ok=True)
withopen(file_name, "w") asf:
cache_dir=os.path.abspath("executorlib_cache")
os.makedirs(cache_dir, exist_ok=True)
file_name=os.path.join(cache_dir, "test.h5")
withopen(file_name, "w") asf:
🤖 Prompt for AI Agents
In `@tests/task_scheduler/file/test_serial.py` around lines 227 - 229, Tests
create the cache file using an absolute path under the test file directory
(variable file_name) but tearDown only cleans up the executorlib_cache in the
current working directory, leaving artifacts; change the file creation to use
the same cache directory tearDown removes (e.g. build file_name from os.getcwd()
or use a relative "executorlib_cache/test.h5") and ensure os.makedirs and the
with open(file_name, "w") as f block use that same path so tearDown removes the
created file and directory.

@coderabbitaicoderabbitaiBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
.github/workflows/pipeline.yml (1)

290-296: ⚠️ Potential issue | 🔴 Critical

Inconsistent path on Line 296 will cause test failure.

Line 292 changes the working directory to tests/, so Line 295 correctly uses a relative path (executor/test_slurm_job.py). However, Line 296 uses tests/executor/test_slurm_cluster.py, which will resolve to tests/tests/executor/test_slurm_cluster.py and fail.

🐛 Proposed fix
 python -m unittest executor/test_slurm_job.py
- python -m unittest tests/executor/test_slurm_cluster.py+ python -m unittest executor/test_slurm_cluster.py

@codecov

codecovBot commented Feb 1, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.42%. Comparing base (41d76ff) to head (9050bd0).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@ Coverage Diff @@## main #894 +/- ##
=======================================
Coverage 93.42% 93.42% =======================================
Files 38 38 Lines 1840 1840 =======================================
Hits 1719 1719 Misses 121 121 

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@coderabbitaicoderabbitaiBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (4)
tests/unit/standalone/interactive/test_communication.py (4)

47-57: ⚠️ Potential issue | 🔴 Critical

Incorrect path traversal - missing one directory level.

The file is at tests/unit/standalone/interactive/test_communication.py. To reach src/executorlib/backend/, you need to traverse four levels up to the repository root, but the code only traverses three levels:

  • tests/unit/standalone/interactive/..tests/unit/standalone/
  • ..tests/unit/
  • ..tests/
  • Missing: → .. → repository root

This will resolve to tests/src/executorlib/backend/interactive_parallel.py, which doesn't exist.

🐛 Proposed fix
 os.path.abspath(
os.path.join(
os.path.dirname(__file__),
"..",
"..",
"..",
+ "..",
"src",
"executorlib",
"backend",
"interactive_parallel.py",
)
),

79-89: ⚠️ Potential issue | 🔴 Critical

Same path traversal issue - missing one level up.

Same issue as test_interface_mpi: needs four ".." to reach the repository root from tests/unit/standalone/interactive/.

🐛 Proposed fix
 os.path.abspath(
os.path.join(
os.path.dirname(__file__),
"..",
"..",
"..",
+ "..",
"src",
"executorlib",
"backend",
"interactive_serial.py",
)
),

111-121: ⚠️ Potential issue | 🔴 Critical

Same path traversal issue - missing one level up.

Same issue: needs four ".." to reach the repository root.

🐛 Proposed fix
 os.path.abspath(
os.path.join(
os.path.dirname(__file__),
"..",
"..",
"..",
+ "..",
"src",
"executorlib",
"backend",
"interactive_serial.py",
)
),

174-184: ⚠️ Potential issue | 🔴 Critical

Same path traversal issue - missing one level up.

Same issue: needs four ".." to reach the repository root.

🐛 Proposed fix
 os.path.abspath(
os.path.join(
os.path.dirname(__file__),
"..",
"..",
"..",
+ "..",
"src",
"executorlib",
"backend",
"interactive_serial.py",
)
),

@jan-janssen
jan-janssen merged commit 1f88c85 into mainFeb 1, 2026
35 checks passed
@jan-janssen
jan-janssen deleted the refactor-tests-structure-8663878069429888553 branch February 1, 2026 16:44
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@jan-janssen
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Universal Dark Mode - works on any site\n(function() {\n var enabled = true;\n \n function applyDarkMode() {\n if (!enabled) return;\n \n // Create style element if it doesn't exist\n var style = document.getElementById('universal-dark-mode-style');\n if (!style) {\n style = document.createElement('style');\n style.id = 'universal-dark-mode-style';\n document.head.appendChild(style);\n }\n \n // Dark mode CSS - inverts colors but preserves images/video\n style.textContent = '\n /* Invert everything except media */\n html {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #1a1a2e !important;\n }\n \n /* Restore images, videos, iframes, canvas */\n img, video, iframe, canvas, svg, picture, [style*=\"background-image\"] {\n filter: invert(1) hue-rotate(180deg) !important;\n }\n \n /* Preserve specific elements that should not be inverted */\n .no-dark-mode, .no-dark-mode *,\n [data-theme=\"light\"], [data-theme=\"light\"],\n .ace_editor, .ace_editor *,\n .CodeMirror, .CodeMirror *,\n .monaco-editor, .monaco-editor *,\n .markdown-body pre, .markdown-body pre *,\n .highlight, .highlight *,\n pre code, pre code * {\n filter: none !important;\n }\n \n /* Fix common UI elements */\n .modal, .popup, .dropdown-menu, .tooltip, .popover {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #2d2d44 !important;\n border-color: #444 !important;\n }\n \n /* Scrollbars */\n ::-webkit-scrollbar { background: #1a1a2e !important; }\n ::-webkit-scrollbar-thumb { background: #444 !important; }\n ::-webkit-scrollbar-thumb:hover { background: #555 !important; }\n \n /* Selection */\n ::selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ::-moz-selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ';\n }\n \n function removeDarkMode() {\n var style = document.getElementById('universal-dark-mode-style');\n if (style) style.remove();\n }\n \n // Toggle with Alt+Shift+D\n document.addEventListener('keydown', function(e) {\n if (e.altKey && e.shiftKey && e.key === 'D') {\n e.preventDefault();\n enabled = !enabled;\n if (enabled) {\n applyDarkMode();\n console.log('[Universal Dark Mode] Enabled');\n } else {\n removeDarkMode();\n console.log('[Universal Dark Mode] Disabled');\n }\n }\n });\n \n // Apply on load\n applyDarkMode();\n \n // Re-apply on dynamic content\n var observer = new MutationObserver(function(mutations) {\n if (enabled && !document.getElementById('universal-dark-mode-style')) {\n applyDarkMode();\n }\n });\n observer.observe(document.head, { childList: true });\n \n console.log('[Universal Dark Mode] Loaded - Press Alt+Shift+D to toggle');\n})();", "Universal Dark Mode"); } } catch(__e) { console.warn('[Userscript:Universal Dark Mode]', __e); } })(); })();
Skip to content

Refactor tests directory structure - #894

Merged
jan-janssen merged 8 commits into
mainfrom
refactor-tests-structure-8663878069429888553
Feb 1, 2026
Merged

Refactor tests directory structure#894
jan-janssen merged 8 commits into
mainfrom
refactor-tests-structure-8663878069429888553

Conversation

@jan-janssen

@jan-janssenjan-janssen commented Feb 1, 2026

Copy link
Copy Markdown
Member

This change restructures the tests/ folder to better reflect the internal organization of the executorlib library. Test files are now grouped by the module they test (backend, executor, standalone, task_scheduler). Relative paths within the tests have been updated to ensure that they continue to correctly reference external scripts and the library's internal backend files. Temporary files and auto-generated version files were excluded from the final submission.


PR created automatically by Jules for task 8663878069429888553 started by @jan-janssen

Summary by CodeRabbit

Release Notes

  • Tests

    • Reorganized unit test module structure and updated test file paths across the codebase.
  • Chores

    • Updated CI/CD pipeline configuration to reference the new test module locations and execution paths.

✏️ Tip: You can customize this high-level summary in your review settings.

- Created subdirectories in tests/: backend, executor, standalone, task_scheduler.
- Moved and renamed test files to corresponding subdirectories.
- Updated relative paths in test files for executables and backends.
- Added __init__.py files to new test packages.
Co-authored-by: jan-janssen <3854739+jan-janssen@users.noreply.github.com>
@google-labs-jules

Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@coderabbitai

coderabbitaiBot commented Feb 1, 2026

Copy link
Copy Markdown
Contributor

Warning

Rate limit exceeded

@jan-janssen has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 4 minutes and 16 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📝 Walkthrough

Walkthrough

This PR updates test file paths and invocation commands across the repository as part of a test directory structure reorganization. The changes include updating CI workflow test targets, adjusting import/path resolution in multiple test files to reflect the new test directory hierarchy, and ensuring test artifacts are created in correct locations.

Changes

Cohort / File(s)Summary
CI Workflow Configuration
.github/workflows/pipeline.yml
Updated test invocation paths in Flux and Slurm workflow steps to reference reorganized unit test module locations (e.g., from tests/test_fluxpythonspawner.py to tests/unit/task_scheduler/interactive/test_spawner_flux.py; from test_slurmjobexecutor.py to executor/test_slurm_job.py).
Flux Test Path Resolution
tests/unit/executor/test_flux_job.py
Changed dirname calculation from one level up to two levels up, adjusting the base directory context for flux.out and flux.err file paths.
Test Executable Path Updates
tests/unit/executor/test_single_shell_interactive.py, tests/unit/task_scheduler/file/test_serial.py
Updated executable paths to reference correct locations in reorganized directory structure (e.g., from executor/executables/ to parent executables/ directory).
Module Path Resolution
tests/unit/standalone/interactive/test_communication.py
Modified path traversal logic in interface tests to correctly locate src module using os.path.dirname(__file__) followed by upward directory navigation; preserved existing test logic.
Test Artifact Handling
tests/unit/task_scheduler/file/test_serial.py
Added exist_ok=True to directory creation to prevent errors when directories already exist; updated path constructions for robust and portable test artifact handling.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • Test with SLURM #726: Updates CI test targets for Slurm tests that were previously added; this PR complements that work by updating test invocation paths to new organized locations.
  • Refactor Test Environment #611: Modifies test invocation commands in the pipeline workflow, sharing similar scope of CI configuration updates.
  • Refactor Task scheduler #637: Part of the same repository reorganization effort, adjusting test path resolution as follow-up work to the original structural refactor.

Suggested reviewers

  • liamhuber

Poem

🐰 Paths reorganized with care so true,
Tests marching to their directories new,
From flat to nested, a structure refined,
Each fixture finds its home, aligned,
One hop up, two hops down—the journey's kind! 🌿

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check nameStatusExplanationResolution
Docstring Coverage⚠️ WarningDocstring coverage is 0.00% which is insufficient. The required threshold is 80.00%.Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check nameStatusExplanation
Description Check✅ PassedCheck skipped - CodeRabbit’s high-level summary is enabled.
Title check✅ PassedThe title 'Refactor tests directory structure' directly and clearly summarizes the main change: reorganizing the tests folder into subdirectories by module type (backend, executor, standalone, task_scheduler) with corresponding path updates.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch refactor-tests-structure-8663878069429888553

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitaicoderabbitaiBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
tests/executor/test_flux_job.py (1)

113-133: ⚠️ Potential issue | 🟠 Major

Avoid shared flux.out/flux.err at repo root in parallel runs.

This now writes to the same filenames and directory as test_output_files_abs, which can race under pytest -n or similar. Use a unique temp directory to keep tests isolated.

💡 Suggested fix (isolate output files per test)
+import tempfile
@@
def test_output_files_cwd(self):
- dirname = os.path.abspath(os.path.join(os.path.dirname(__file__), "..", ".."))- os.makedirs(dirname, exist_ok=True)- file_stdout = os.path.join(dirname, "flux.out")- file_stderr = os.path.join(dirname, "flux.err")- with FluxJobExecutor(- max_cores=1,- resource_dict={"cores": 1, "cwd": dirname},- flux_executor=self.executor,- block_allocation=True,- flux_log_files=True,- ) as p:- output = list(p.map(calc, [1, 2, 3]))+ with tempfile.TemporaryDirectory() as tmpdir:+ file_stdout = os.path.join(tmpdir, "flux.out")+ file_stderr = os.path.join(tmpdir, "flux.err")+ with FluxJobExecutor(+ max_cores=1,+ resource_dict={"cores": 1, "cwd": tmpdir},+ flux_executor=self.executor,+ block_allocation=True,+ flux_log_files=True,+ ) as p:+ output = list(p.map(calc, [1, 2, 3]))
self.assertEqual(
output,
[1, 2, 3],
)
self.assertTrue(os.path.exists(file_stdout))
self.assertTrue(os.path.exists(file_stderr))
- os.remove(file_stdout)- os.remove(file_stderr)
🤖 Fix all issues with AI agents
In `@tests/task_scheduler/file/test_serial.py`:
- Around line 227-229: Tests create the cache file using an absolute path under
the test file directory (variable file_name) but tearDown only cleans up the
executorlib_cache in the current working directory, leaving artifacts; change
the file creation to use the same cache directory tearDown removes (e.g. build
file_name from os.getcwd() or use a relative "executorlib_cache/test.h5") and
ensure os.makedirs and the with open(file_name, "w") as f block use that same
path so tearDown removes the created file and directory.
🧹 Nitpick comments (1)
tests/executor/test_single_shell_interactive.py (1)

13-13: Make executable_path absolute to avoid CWD-dependent failures.

🔧 Suggested tweak
-executable_path = os.path.join(os.path.dirname(__file__), "..", "executables", "count.py")+executable_path = os.path.abspath(+ os.path.join(os.path.dirname(__file__), "..", "executables", "count.py")+)

Comment on lines +227 to 229
file_name = os.path.abspath(os.path.join(os.path.dirname(__file__), "executorlib_cache", "test.h5"))
os.makedirs(os.path.dirname(file_name), exist_ok=True)
with open(file_name, "w") as f:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Keep cache directory consistent with tearDown cleanup.

This now writes under tests/task_scheduler/file/executorlib_cache, but tearDown() only removes executorlib_cache in the CWD, so artifacts will remain.

🧹 Suggested alignment with existing cache cleanup
- file_name = os.path.abspath(os.path.join(os.path.dirname(__file__), "executorlib_cache", "test.h5"))- os.makedirs(os.path.dirname(file_name), exist_ok=True)+ cache_dir = os.path.abspath("executorlib_cache")+ os.makedirs(cache_dir, exist_ok=True)+ file_name = os.path.join(cache_dir, "test.h5")
📝 Committable suggestion

‼️IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
file_name=os.path.abspath(os.path.join(os.path.dirname(__file__), "executorlib_cache", "test.h5"))
os.makedirs(os.path.dirname(file_name), exist_ok=True)
withopen(file_name, "w") asf:
cache_dir=os.path.abspath("executorlib_cache")
os.makedirs(cache_dir, exist_ok=True)
file_name=os.path.join(cache_dir, "test.h5")
withopen(file_name, "w") asf:
🤖 Prompt for AI Agents
In `@tests/task_scheduler/file/test_serial.py` around lines 227 - 229, Tests
create the cache file using an absolute path under the test file directory
(variable file_name) but tearDown only cleans up the executorlib_cache in the
current working directory, leaving artifacts; change the file creation to use
the same cache directory tearDown removes (e.g. build file_name from os.getcwd()
or use a relative "executorlib_cache/test.h5") and ensure os.makedirs and the
with open(file_name, "w") as f block use that same path so tearDown removes the
created file and directory.

@coderabbitaicoderabbitaiBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
.github/workflows/pipeline.yml (1)

290-296: ⚠️ Potential issue | 🔴 Critical

Inconsistent path on Line 296 will cause test failure.

Line 292 changes the working directory to tests/, so Line 295 correctly uses a relative path (executor/test_slurm_job.py). However, Line 296 uses tests/executor/test_slurm_cluster.py, which will resolve to tests/tests/executor/test_slurm_cluster.py and fail.

🐛 Proposed fix
 python -m unittest executor/test_slurm_job.py
- python -m unittest tests/executor/test_slurm_cluster.py+ python -m unittest executor/test_slurm_cluster.py

@codecov

codecovBot commented Feb 1, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.42%. Comparing base (41d76ff) to head (9050bd0).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@ Coverage Diff @@## main #894 +/- ##
=======================================
Coverage 93.42% 93.42% =======================================
Files 38 38 Lines 1840 1840 =======================================
Hits 1719 1719 Misses 121 121 

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@coderabbitaicoderabbitaiBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (4)
tests/unit/standalone/interactive/test_communication.py (4)

47-57: ⚠️ Potential issue | 🔴 Critical

Incorrect path traversal - missing one directory level.

The file is at tests/unit/standalone/interactive/test_communication.py. To reach src/executorlib/backend/, you need to traverse four levels up to the repository root, but the code only traverses three levels:

  • tests/unit/standalone/interactive/..tests/unit/standalone/
  • ..tests/unit/
  • ..tests/
  • Missing: → .. → repository root

This will resolve to tests/src/executorlib/backend/interactive_parallel.py, which doesn't exist.

🐛 Proposed fix
 os.path.abspath(
os.path.join(
os.path.dirname(__file__),
"..",
"..",
"..",
+ "..",
"src",
"executorlib",
"backend",
"interactive_parallel.py",
)
),

79-89: ⚠️ Potential issue | 🔴 Critical

Same path traversal issue - missing one level up.

Same issue as test_interface_mpi: needs four ".." to reach the repository root from tests/unit/standalone/interactive/.

🐛 Proposed fix
 os.path.abspath(
os.path.join(
os.path.dirname(__file__),
"..",
"..",
"..",
+ "..",
"src",
"executorlib",
"backend",
"interactive_serial.py",
)
),

111-121: ⚠️ Potential issue | 🔴 Critical

Same path traversal issue - missing one level up.

Same issue: needs four ".." to reach the repository root.

🐛 Proposed fix
 os.path.abspath(
os.path.join(
os.path.dirname(__file__),
"..",
"..",
"..",
+ "..",
"src",
"executorlib",
"backend",
"interactive_serial.py",
)
),

174-184: ⚠️ Potential issue | 🔴 Critical

Same path traversal issue - missing one level up.

Same issue: needs four ".." to reach the repository root.

🐛 Proposed fix
 os.path.abspath(
os.path.join(
os.path.dirname(__file__),
"..",
"..",
"..",
+ "..",
"src",
"executorlib",
"backend",
"interactive_serial.py",
)
),

@jan-janssen
jan-janssen merged commit 1f88c85 into mainFeb 1, 2026
35 checks passed
@jan-janssen
jan-janssen deleted the refactor-tests-structure-8663878069429888553 branch February 1, 2026 16:44
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@jan-janssen