Skip to content

test: guard eth alias against submodule shadowing#1072

Merged
BobTheBuidler merged 2 commits intomasterfrom
test/eth-alias-regression-20260216
Feb 16, 2026
Merged

test: guard eth alias against submodule shadowing#1072
BobTheBuidler merged 2 commits intomasterfrom
test/eth-alias-regression-20260216

Conversation

@BobTheBuidler
Copy link
Owner

Summary

Add a regression test that keeps dank_mids.eth resolving to the dank_eth alias after submodule imports.

Rationale

Lazy import aliasing can be shadowed when dank_mids.eth is imported as a submodule, breaking access to get_code. This test locks in the correct alias behavior.

Details

  • Add a subprocess-based unit test in tests/unit/test_lazy_imports.py that stubs dank_mids.brownie_patch.dank_eth and forces a dank_mids.eth submodule import.
  • Assert dank_mids.eth still resolves to the stub (or at least that get_code remains bound).

Testing

  • Not run (test is expected to fail on current master).

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 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".

Comment on lines +207 to +208
assert payload["same_object"] or (
payload["get_code_callable"] and payload["get_code_is_bound"]

Choose a reason for hiding this comment

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

P1 Badge 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 👍 / 👎.

@BobTheBuidler BobTheBuidler merged commit 9fb8f2d into master Feb 16, 2026
1 of 97 checks passed
@BobTheBuidler BobTheBuidler deleted the test/eth-alias-regression-20260216 branch February 16, 2026 16:19
Sign up for free to 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