test: guard eth alias against submodule shadowing#1072
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 71ab6d56d2
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| assert payload["same_object"] or ( | ||
| payload["get_code_callable"] and payload["get_code_is_bound"] |
There was a problem hiding this comment.
Pair failing regression test with implementation fix
This commit adds a strict regression assertion for dank_mids.eth alias behavior but does not include the corresponding production change, so the suite goes red when this commit is applied on its own (e.g., PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 pytest tests/unit/test_lazy_imports.py fails in this test). That makes the change non-mergeable in isolation; either include the fix in the same change set or mark this test as expected-failing until the implementation lands.
Useful? React with 👍 / 👎.
Summary
Add a regression test that keeps
dank_mids.ethresolving to thedank_ethalias after submodule imports.Rationale
Lazy import aliasing can be shadowed when
dank_mids.ethis imported as a submodule, breaking access toget_code. This test locks in the correct alias behavior.Details
tests/unit/test_lazy_imports.pythat stubsdank_mids.brownie_patch.dank_ethand forces adank_mids.ethsubmodule import.dank_mids.ethstill resolves to the stub (or at least thatget_coderemains bound).Testing