Commit 277a31c
revert(load_module): restore loose cache-hit; rewrite stub-based test as subprocess
CI on `platform_checks (ubuntu-latest, 3.12)` surfaced the
"Found many classes with name 'EchoBehaviour' / 'DefaultDialogues'"
regression in ``tests/test_act_storage.py``,
``tests/test_docs/test_build_aea_programmatically/test_programmatic_aea.py``,
and ``tests/test_connections/test_scaffold.py`` — the failure mode
that ``a0d759e7c`` (drop ``__file__`` equality from cache-hit check)
was written to fix. Commit ``96b1785c7`` had re-introduced it by
restoring the strict check.
Reverts ``96b1785c7``: ``aea.helpers.base.load_module`` reuses any
module already registered at the requested canonical dotted path,
regardless of which physical file the second call points at. This
is the cache-keep-first behaviour the rest of this PR depends on —
it lets open-autonomy's ``_MetaPayload.registry`` collapse the
short+long duplicate keys into a single class object.
``tests/test_cli/test_run.py::TestRunFailsWhenConnectionClassNotPresent::test_run``
was the one test that depended on the strict-cache behaviour: it
stubs ``http_client/connection.py`` with a class-less body and
expects the next ``aea run`` to read the stub from disk. Under
cache-keep-first the cached real ``http_client`` connection
(loaded by an earlier test in the same pytest session) is reused
and the stub on disk is ignored, so the documented "class not
found" error never fires and the agent boots.
Rewrites the test to invoke ``aea run`` via ``PexpectWrapper`` —
the pattern already used by the happy-path ``test_run[None]``
above. A subprocess starts with an empty ``sys.modules``, which is
exactly how production ``aea run`` runs, so the cache-vs-disk
question doesn't arise and the test exercises the same code path
an end user hits. Asserts the documented "Connection class
'HTTPClientConnection' not found" message and a non-zero exit
code.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>1 parent 15ecbba commit 277a31c
3 files changed
Lines changed: 68 additions & 48 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
127 | 127 | | |
128 | 128 | | |
129 | 129 | | |
130 | | - | |
131 | | - | |
132 | | - | |
133 | | - | |
134 | | - | |
135 | | - | |
136 | | - | |
137 | | - | |
138 | | - | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
139 | 140 | | |
140 | 141 | | |
141 | 142 | | |
142 | 143 | | |
143 | 144 | | |
144 | 145 | | |
145 | | - | |
146 | | - | |
147 | | - | |
148 | | - | |
149 | | - | |
150 | | - | |
151 | | - | |
152 | | - | |
| 146 | + | |
153 | 147 | | |
154 | 148 | | |
155 | 149 | | |
156 | | - | |
157 | | - | |
158 | | - | |
159 | | - | |
160 | | - | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
161 | 155 | | |
162 | 156 | | |
163 | 157 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1336 | 1336 | | |
1337 | 1337 | | |
1338 | 1338 | | |
1339 | | - | |
| 1339 | + | |
| 1340 | + | |
| 1341 | + | |
| 1342 | + | |
| 1343 | + | |
| 1344 | + | |
| 1345 | + | |
| 1346 | + | |
| 1347 | + | |
1340 | 1348 | | |
1341 | | - | |
1342 | | - | |
| 1349 | + | |
| 1350 | + | |
| 1351 | + | |
1343 | 1352 | | |
1344 | | - | |
1345 | | - | |
| 1353 | + | |
| 1354 | + | |
| 1355 | + | |
| 1356 | + | |
| 1357 | + | |
1346 | 1358 | | |
1347 | 1359 | | |
1348 | 1360 | | |
1349 | 1361 | | |
1350 | | - | |
1351 | | - | |
| 1362 | + | |
| 1363 | + | |
| 1364 | + | |
| 1365 | + | |
| 1366 | + | |
| 1367 | + | |
| 1368 | + | |
| 1369 | + | |
| 1370 | + | |
| 1371 | + | |
| 1372 | + | |
| 1373 | + | |
| 1374 | + | |
| 1375 | + | |
1352 | 1376 | | |
1353 | 1377 | | |
1354 | 1378 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
511 | 511 | | |
512 | 512 | | |
513 | 513 | | |
514 | | - | |
515 | | - | |
516 | | - | |
517 | | - | |
518 | | - | |
519 | | - | |
520 | | - | |
521 | | - | |
522 | | - | |
523 | | - | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
524 | 525 | | |
525 | 526 | | |
526 | 527 | | |
| |||
537 | 538 | | |
538 | 539 | | |
539 | 540 | | |
540 | | - | |
| 541 | + | |
541 | 542 | | |
542 | 543 | | |
543 | 544 | | |
544 | 545 | | |
545 | | - | |
546 | | - | |
547 | | - | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
548 | 550 | | |
549 | | - | |
550 | | - | |
551 | | - | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
552 | 554 | | |
553 | | - | |
554 | | - | |
| 555 | + | |
| 556 | + | |
555 | 557 | | |
556 | 558 | | |
557 | 559 | | |
| |||
0 commit comments