Repository navigation
ci: autobot-infrastructure/shared/tests cannot be collected on its own — a namespace-package config shadows the backend's #15161
Description
Activity
- changed the title
[-]ci: autobot-infrastructure/shared/tests collects nothing — conftest imports a module and a directory that do not exist[/-][+]ci: autobot-infrastructure/shared/tests cannot be collected on its own — a namespace-package `config` shadows the backend's[/+]on Aug 28, 2026 Correcting this issue — I filed it wrong
The headline claim was false, and I am retitling rather than quietly editing.
I wrote that "every collection under that tree dies with
ImportError" and that
marker-tests.yml:294was therefore "returning a conftest ImportError rather than
running tests". That is not true. Measured with the CI-shaped invocation, which
names both roots the workflow names:$ pytest autobot-infrastructure/shared/tests libs \ -m "integration or slow or distributed or performance" --collect-only 24/41 tests collected (17 deselected)No ImportError. The workflow's own comment agrees and I should have believed it over
my local run: that invocation is recorded as 12 collected / 10 passed / 0 failed.What I actually hit is narrower and still real: the failure only occurs when that
directory is named alone.$ pytest autobot-infrastructure/shared/tests --collect-only ImportError: cannot import name 'unified_config_manager' from 'config' (unknown location)(unknown location)is the tell — it is a namespace package, not the real module.
autobot-infrastructure/shared/config/is a directory of YAML with no__init__.py,
so when that tree is the sole root it can be imported as a namespace package named
configand shadowautobot-backend/config, which is what actually exports
unified_config_manager(seeautobot-backend/conversation_file_manager.py:38).
Adding a second root changes resolution and the correct module wins.So the conftest is not broken,
autobot-user-backendbeing absent is inert (the
sys.path.insertof a non-existent directory is harmless), and no CI root is dead.What remains genuinely wrong
- A developer running that tree directly gets a misleading ImportError naming a
symbol rather than the shadowing that caused it. It is order-dependent and
environment-dependent, which is the worst shape for a newcomer. - The dead
sys.path.insertforautobot-user-backend, a directory in no
commit, should go regardless — it exempts nothing and implies a tree that
does not exist. performancewas missing from that tree'spytest.inimarkers (it registered
integration,slow,distributed). Under--strict-markersany invocation
rooted there turned aperformance-marked module into a collection error. Fixed
in test(suite): convert the thirteen uncollected validation drivers and settle all three ceilings (#14979) #15166, which needed it for
shared/tests/performance/test_performance_optimization.py.
Corrected acceptance criteria
-
pytest autobot-infrastructure/shared/testsalone collects without an ImportError
— most likely by givingautobot-infrastructure/shared/config/an__init__.py,
renaming it, or excluding it from import, whichever is right for that directory - The
autobot-user-backendsys.path.insertis removed from
shared/tests/conftest.py -
performanceregistered in that tree'spytest.ini(landed in test(suite): convert the thirteen uncollected validation drivers and settle all three ceilings (#14979) #15166) - A guard asserts each pytest root named in
marker-tests.ymlcollects a non-zero
number of items — still worth having, and it is the part of my original filing
that survives
Correction to #15166
The two converted files under this tree —
test_performance_optimization.py(5) and
test_distributed_system_integration.py(6) — are not blocked by this issue. Both
collect and are marker-selected under the real root list, verified above. I had
described them as unreachable; that was wrong and the PR body is being corrected.Apologies for the noise — the original filing generalised one bad local invocation
into a claim about CI without checking CI.- A developer running that tree directly gets a misleading ImportError naming a
- added a commit that references this issue
on Aug 28, 2026 Verified in merged
Dev_new_gui— closingMerged as
df2ce22a20(PR #15175). Verified against the corrected criteria from the 2026-08-28 comment, which supersede the body.Criterion Verdict Evidence The tree collects on its own without an ImportErrorMET autobot-infrastructure/shared/tests/conftest.pynow appendsautobot-backend— a real package — instead of the nonexistentautobot-user-backend, sofrom config import unified_config_managerresolves whatever the rootdir. Measured: exit 4 / 0 items → exit 0 / 28 items, with the "before" reproduced from the committed base fileThe dead autobot-user-backendpath insert is removedMET Only an explanatory comment remains at :16; no path insert survives anywhere in that treeThe performancemarker is registeredMET shared/tests/pytest.ini:28A guard fails if any root named in marker-tests.ymlcollects zeroMET pipeline-scripts/pytest_root_collection_floor.py, wired at.github/workflows/marker-tests.yml:384, with 22 tests. Roots are derived from the workflow, not hand-listed, so a root added there cannot silently escape the floorThat last detail is what makes the guard durable. A hand-maintained list of roots would drift the moment someone added a twelfth; deriving them from the workflow means the guard's population follows the thing it guards. It ran green across all 12 roots (27,910 items) and its contrast mutation flipped it red.
Minor, not blocking:
pytest.ininow registersperformancetwice (:28and:30). Harmless duplicate, worth a one-line tidy whenever that file is next touched.Cross-link for #15178's AC5, recorded so the relationship survives this issue already being closed.
#15178 (the uncollected-test-file umbrella) landed in PR #15487, merged as
cf2d29d54e. Two things there bear directly on this issue:autobot-infrastructure/shared/testswas mis-classified as uncollected. It is named bypytest.ini:147,.github/workflows/ci.yml:296and.github/workflows/marker-tests.yml:341, so it is genuinely collected. It has been moved fromINTENTIONALLY_UNCOLLECTEDintoNARROWLY_COLLECTEDinrepo_tests/collection_coverage_test.py, which is why theautobot-infrastructureceiling is 51 rather than 56.- The recorded reason for excusing the wider
autobot-infrastructuretree was stale. It said the conftest importsunified_config_manager, "which no longer resolves" — that was fixed here; the import resolves viaautobot-backend/config/__init__.py:242. The exemption now records the real remaining blocker instead of repeating a spent one.
The uncollected population is now held by a down-only ratchet (
_UNCOLLECTED_CEILINGSatcollection_coverage_test.py:201) with a population floor at:212(_MIN_TRACKED_TEST_FILES = 1900) evaluated first, so a sweep that collapses to zero matches fails by name rather than reading as a clean tree. Growth fails; shrink passes.No action needed here — this is a record, not a reopen.
Problem
autobot-infrastructure/shared/tests/conftest.pyfails to import, so everycollection under that tree errors before a single test is found:
Two independent causes, both in the same six lines (
conftest.py:17-21):autobot-user-backend/does not exist in the repository, so thesys.path.insertadds a non-existent directory.unified_config_manageris not exported by anyconfigmodule anywhere in thetree (
find . -name "unified_config_manager*"returns nothing).Why it matters
.github/workflows/marker-tests.yml:294namesautobot-infrastructure/shared/testsas a pytest root. That invocation istherefore returning a conftest ImportError rather than running tests, and has
been for as long as the conftest has been broken — a whole declared CI root is
silently contributing zero.
This is the #14917 family exactly: a tree that looks wired into CI, is named in a
workflow, and reaches nothing.
How it was found
While converting files for #14979. Two of that issue's fourteen files live under
this tree:
autobot-infrastructure/shared/tests/performance/test_performance_optimization.pyautobot-infrastructure/shared/tests/integration/test_distributed_system_integration.pyBoth were converted correctly and carry valid markers (
performance,distributed) thatmarker-tests.ymlselects for. Neither is actuallyreachable in CI while this conftest is broken, so their conversion is
knowingly cosmetic until it is fixed. They were verified locally with
--noconftest -c pytest.ini --rootdir=..Secondary finding
autobot-infrastructure/shared/tests/pytest.iniregistersintegration,slowand
distributedbut notperformance. CI roots at the repository root sothis does not bite there, but any invocation rooted in that directory fails under
--strict-markers.Acceptance criteria
pytest autobot-infrastructure/shared/tests --collect-onlycompletes without a conftest errorautobot-user-backendpath insert is removed or repointed at a directory that existsunified_config_manageris imported from wherever the canonical config manager actually lives, or the fixture that needed it is removedperformanceis registered in that tree'spytest.inimarker-tests.ymlcollects a non-zero number of items — a root that collects nothing must fail, not pass quietlyRelated