Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running just test for unit and CLI tests failed due to ModuleNotFound: PatrickAlphaC.test_repo #181

Closed
s3bc40 opened this issue Jan 17, 2025 · 1 comment

Comments

@s3bc40
Copy link
Contributor

s3bc40 commented Jan 17, 2025

Hey 👋

So I have forked the repo and installed it locally to contribute to this framework with great potential for Vypers!

I wanted to contribute to this first issue #120 so that I can get a good introduction to the project, and to learn a lot from open source projects.

But I have run into an issue while running the CLI and unit tests to see if everything was alright. The following error code is one of the last ones that I have gotten while fixing, just to illustrate:

tests/cli/deployments/test_cli_deployments_write.py ...                                                                                                                                                   
tests/cli/deployments/test_unit_deployments_cli.py ...                                                                                                                                                    
tests/cli/deployments/test_unit_deployments_read.py ....                                                                                                                                             
tests/cli/test_cli_compile.py ....                                                                                                                                                                         
tests/cli/test_cli_deploy.py ..                                                                                                                                                                          
tests/cli/test_cli_init.py ..                                                                                                                                                                              
tests/cli/test_cli_inspect.py F

[...]

E       vyper.exceptions.ModuleNotFound: PatrickAlphaC.test_repo.my_contract
E       
E         contract "/tmp/tmpk10ufe3e/src/MyToken.vy:5", line 5:0 
E              4 from snekmate.tokens import erc20
E         ---> 5 from PatrickAlphaC.test_repo import my_contract
E         -------^
E              6

.venv/lib/python3.12/site-packages/vyper/semantics/analysis/module.py:869: ModuleNotFound
============================================================================================ short test summary info =============================================================================================
FAILED tests/cli/test_cli_inspect.py::test_inspect_layout_imports - vyper.exceptions.ModuleNotFound: PatrickAlphaC.test_repo.my_contract

From what I have understood of the errors, it seems that MyToken.vy had issues to find the corresponding module PatrickAlphaC.test_repo.my_contract. I have found a solution by fixing the case:

from snekmate.auth import ownable as ow 
from snekmate.tokens import erc20
- from PatrickAlphaC.test_repo import my_contract
+ from patrickalphac.test_repo import my_contract
❯ just test
uv run pytest  -x --ignore=tests/integration/ --ignore=tests/zksync/
============================================================================================== test session starts ===============================================================================================
platform linux -- Python 3.12.3, pytest-8.3.3, pluggy-1.5.0
rootdir: /home/s3bc40/mox-cu/moccasin
configfile: pyproject.toml
plugins: titanoboa-0.2.5, cov-5.0.0, xdist-3.6.1, hypothesis-6.115.2
collected 69 items                                                                                                                                                                                               

tests/cli/deployments/test_cli_deployments_write.py ...                                                                                                                                                    [  4%]
tests/cli/deployments/test_unit_deployments_cli.py ...                                                                                                                                                     [  8%]
tests/cli/deployments/test_unit_deployments_read.py ....                                                                                                                                                   [ 14%]
tests/cli/test_cli_compile.py ....                                                                                                                                                                         [ 20%]
tests/cli/test_cli_deploy.py ..                                                                                                                                                                            [ 23%]
tests/cli/test_cli_init.py ..                                                                                                                                                                              [ 26%]
tests/cli/test_cli_inspect.py .                                                                                                                                                                            [ 27%]
tests/cli/test_cli_install.py .                                                                                                                                                                            [ 28%]
tests/cli/test_cli_run.py ..........                                                                                                                                                                       [ 43%]
tests/cli/test_cli_test.py ..........                                                                                                                                                                      [ 57%]
tests/cli/test_cli_wallet.py .                                                                                                                                                                             [ 59%]
tests/live/test_live_verify.py s                                                                                                                                                                           [ 60%]
tests/unit/test_unit_config.py ...........                                                                                                                                                                 [ 76%]
tests/unit/test_unit_inspect.py .                                                                                                                                                                          [ 78%]
tests/unit/test_unit_install.py .......                                                                                                                                                                    [ 88%]
tests/unit/test_unit_run.py ....                                                                                                                                                                           [ 94%]
tests/unit/test_unit_vars.py ..                                                                                                                                                                            [ 97%]
tests/unit/test_unit_wallet.py ..   

========================================================================================= 68 passed, 1 skipped in 43.29s =========================================================================================

I'll make a PR related to this issue to fix some errors while running just test. I did not check the integration, but I might do it later after my original intent with #120.

@PatrickAlphaC
Copy link
Member

fixed: #182

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

No branches or pull requests

2 participants