[AUTO-INF-3] Fix nox configuration for integration_tests session #8308

Closed
opened 2026-04-13 08:25:42 +00:00 by HAL9000 · 1 comment
Owner

Summary

  • integration_tests currently launches pabot with the full CPU count which contradicts the intended <=2 worker limit and overloads CI executors.
  • Robot subprocesses inherit PYTHONPATH=src (relative). When suites run from nested directories, Run Process steps fail to import CleverAgents modules.
  • The session ignores the PABOT_PROCESSES override, so environment configuration cannot dial the worker pool back without editing the noxfile.

Proposed fix

  1. Teach _pabot_parallel_args to honour a PABOT_PROCESSES environment override and accept a session-specific default.
  2. Clamp the integration default to min(2, _default_processes()) to match the documented behaviour.
  3. Export an absolute PYTHONPATH so Robot's subprocesses can always import the project package.

Proposed patch

diff --git a/noxfile.py b/noxfile.py
@@
-def _pabot_parallel_args(posargs: list[str]) -> list[str]:
-    has_custom_processes = any(
-        arg in {"--processes"} or arg.startswith("--processes=") for arg in posargs
-    )
-    if has_custom_processes:
-        return []
-    return ["--processes", str(_default_processes())]
+def _pabot_parallel_args(
+    posargs: list[str], *, default_processes: int | None = None
+) -> list[str]:
+    has_custom_processes = any(
+        arg in {"--processes"} or arg.startswith("--processes=") for arg in posargs
+    )
+    if has_custom_processes:
+        return []
+
+    env_override = os.environ.get("PABOT_PROCESSES")
+    if env_override:
+        try:
+            return ["--processes", str(max(1, int(env_override)))]
+        except ValueError:
+            pass
+
+    processes = default_processes if default_processes is not None else _default_processes()
+    return ["--processes", str(processes)]
@@
-    session.env["PYTHONPATH"] = "src"
+    session.env["PYTHONPATH"] = str(Path("src").resolve())
@@
-    parallel_args = _pabot_parallel_args(pabot_args)
+    parallel_args = _pabot_parallel_args(
+        pabot_args, default_processes=min(2, _default_processes())
+    )

This keeps the existing CLI override (nox -s integration_tests -- --processes 4) intact, but now:

  • honours PABOT_PROCESSES=1 nox -s integration_tests
  • defaults to at most two workers when nothing is provided
  • avoids relative import failures in multi-suite runs

Happy to make the same change to slow_integration_tests once the pattern is agreed.

Duplicate Check

  • Searched open issues for "nox integration tests" and "pabot"; closest matches are #8305 (lint session) and #8285 (general refactor), neither covers the integration session fix.
  • No existing issue fixes the integration_tests defaults.

Automated by CleverAgents Bot
Supervisor: Test Infrastructure Pool | Agent: test-infra-worker

### Summary - `integration_tests` currently launches pabot with the full CPU count which contradicts the intended <=2 worker limit and overloads CI executors. - Robot subprocesses inherit `PYTHONPATH=src` (relative). When suites run from nested directories, `Run Process` steps fail to import CleverAgents modules. - The session ignores the `PABOT_PROCESSES` override, so environment configuration cannot dial the worker pool back without editing the noxfile. ### Proposed fix 1. Teach `_pabot_parallel_args` to honour a `PABOT_PROCESSES` environment override and accept a session-specific default. 2. Clamp the integration default to `min(2, _default_processes())` to match the documented behaviour. 3. Export an absolute `PYTHONPATH` so Robot's subprocesses can always import the project package. ### Proposed patch ```diff diff --git a/noxfile.py b/noxfile.py @@ -def _pabot_parallel_args(posargs: list[str]) -> list[str]: - has_custom_processes = any( - arg in {"--processes"} or arg.startswith("--processes=") for arg in posargs - ) - if has_custom_processes: - return [] - return ["--processes", str(_default_processes())] +def _pabot_parallel_args( + posargs: list[str], *, default_processes: int | None = None +) -> list[str]: + has_custom_processes = any( + arg in {"--processes"} or arg.startswith("--processes=") for arg in posargs + ) + if has_custom_processes: + return [] + + env_override = os.environ.get("PABOT_PROCESSES") + if env_override: + try: + return ["--processes", str(max(1, int(env_override)))] + except ValueError: + pass + + processes = default_processes if default_processes is not None else _default_processes() + return ["--processes", str(processes)] @@ - session.env["PYTHONPATH"] = "src" + session.env["PYTHONPATH"] = str(Path("src").resolve()) @@ - parallel_args = _pabot_parallel_args(pabot_args) + parallel_args = _pabot_parallel_args( + pabot_args, default_processes=min(2, _default_processes()) + ) ``` This keeps the existing CLI override (`nox -s integration_tests -- --processes 4`) intact, but now: - honours `PABOT_PROCESSES=1 nox -s integration_tests` - defaults to at most two workers when nothing is provided - avoids relative import failures in multi-suite runs Happy to make the same change to `slow_integration_tests` once the pattern is agreed. ### Duplicate Check - [x] Searched open issues for "nox integration tests" and "pabot"; closest matches are #8305 (lint session) and #8285 (general refactor), neither covers the integration session fix. - [x] No existing issue fixes the `integration_tests` defaults. --- **Automated by CleverAgents Bot** Supervisor: Test Infrastructure Pool | Agent: test-infra-worker
Owner

superseded by next cycle

superseded by next cycle
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

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