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

error when pytest openfast_toolbox #12

Open
HelenLeeeeee opened this issue May 11, 2024 · 9 comments
Open

error when pytest openfast_toolbox #12

HelenLeeeeee opened this issue May 11, 2024 · 9 comments
Labels
help wanted Extra attention is needed

Comments

@HelenLeeeeee
Copy link

Dear all,
After updating the conda version, there was a problem with the previous openfast_toolbox, so I re-installed it,during the re-installation,there are errors when pytest my package, the following is my installation process, I want to know what might be the problem?
1715398874979
ccb21ca7780a61bd671bbc27124ea81
075ea43b186d91b890b615eb3170d57
4d42f49351d488a237e8d349f5c9a1a
6dd957fa3524e9ea289298173b81408
930136050b4979407e20ee9d9f158fa
0ec4cffc932374b7e5a8b203a4154aa
a3e61f843253d3ede5f868e5f65d42e
92adfd6708821b9a45b50bad1dbdfdf
162c4976c966592e9636c59b9fdb4f7
50f9598d0d427428fd1eb8557fc0c04
6184b6bb2783a21cdf004c33a948b4a
3b58aec39f71746baf074f5cb7a07a0
8c8bd9d4a6109157c26eca396528643
9be5bc9a97132de26949db7dc8af7df
57cfd81d5dcbab3aa37a99bf675f3d8
0a35b2b45bf0ef93eb29be4d6593aa2
da2db8a6cdeb66374ce7e7f8409d490
4691d13d327ba938a689719b38f5590
d503b21663025af3f485e32a9c45d5e
b28e2b678aab9a3efcaf06b3427bd6d

Thanks,

@HelenLeeeeee
Copy link
Author

HelenLeeeeee commented May 11, 2024

Add some information about the installation directory:
c62d84261e04a40a2e0808c54cdb96a
97d05a68f103277dbf87b0df8ccd425
d493bf842fc8f2b623bfcab88aa99d2
9903065fcf56b29cf3e85e5d28e92cc
70ae4273a8cdcc8cb2a5fe7ad2fff40
1ec5a0e3c8dc2d094a437a5d9d26b39

@Tianmaru
Copy link

Can recreate the issue on Debian using the installation instructions given by the README.

______________________________________________ ERROR collecting openfast_toolbox/tools/tests/test_fatigue.py ______________________________________________
ImportError while importing test module '/home/bjarne/ida/projects/openfast_toolbox/openfast_toolbox/tools/tests/test_fatigue.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
../../../miniconda3/envs/openfast_toolbox/lib/python3.12/importlib/__init__.py:90: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
openfast_toolbox/__init__.py:3: in <module>
    from openfast_toolbox.common import *
E   ModuleNotFoundError: No module named 'openfast_toolbox.common'

This seems to be a pytest/filepaths related issue, since importing openfast_toolbox from a python shell works just fine.

@Wying301
Copy link

Wying301 commented Jun 30, 2024

Can recreate the issue on Mac using the installation instructions given by the README.
`
======================================================================================== test session starts ========================================================================================
platform darwin -- Python 3.11.5, pytest-8.1.1, pluggy-1.4.0
rootdir: /Users/lucy/OpenFAST/openfast_toolbox
plugins: anyio-4.3.0
collected 0 items / 36 errors

============================================================================================== ERRORS ===============================================================================================
______________________________________________________________ ERROR collecting openfast_toolbox/aeroacoustics/tests/test_aa_tools.py _______________________________________________________________
ImportError while importing test module '/Users/lucy/OpenFAST/openfast_toolbox/openfast_toolbox/aeroacoustics/tests/test_aa_tools.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
../../anaconda3/lib/python3.11/importlib/init.py:126: in import_module
return _bootstrap._gcd_import(name[level:], package, level)
openfast_toolbox/init.py:3: in
from openfast_toolbox.common import *
E ModuleNotFoundError: No module named 'openfast_toolbox.common'
`

How to solve it? Thanks!

@JORENLEEEEEE
Copy link

I encountered the same issue as you. May I ask if you have resolved this problem?

Dear all, After updating the conda version, there was a problem with the previous openfast_toolbox, so I re-installed it,during the re-installation,there are errors when pytest my package, the following is my installation process, I want to know what might be the problem? 1715398874979 ccb21ca7780a61bd671bbc27124ea81 075ea43b186d91b890b615eb3170d57 4d42f49351d488a237e8d349f5c9a1a 6dd957fa3524e9ea289298173b81408 930136050b4979407e20ee9d9f158fa 0ec4cffc932374b7e5a8b203a4154aa a3e61f843253d3ede5f868e5f65d42e 92adfd6708821b9a45b50bad1dbdfdf 162c4976c966592e9636c59b9fdb4f7 50f9598d0d427428fd1eb8557fc0c04 6184b6bb2783a21cdf004c33a948b4a 3b58aec39f71746baf074f5cb7a07a0 8c8bd9d4a6109157c26eca396528643 9be5bc9a97132de26949db7dc8af7df 57cfd81d5dcbab3aa37a99bf675f3d8 0a35b2b45bf0ef93eb29be4d6593aa2 da2db8a6cdeb66374ce7e7f8409d490 4691d13d327ba938a689719b38f5590 d503b21663025af3f485e32a9c45d5e b28e2b678aab9a3efcaf06b3427bd6d

Thanks,

I encountered the same issue as you. May I ask if you have resolved this problem?

@ebranlard
Copy link
Collaborator

ebranlard commented Oct 11, 2024

It seems like the set of commands need to be different for anaconda. I'm not sure how to handle that at the moment. Any help is welcome.

@ebranlard ebranlard added the help wanted Extra attention is needed label Oct 11, 2024
@ebranlard
Copy link
Collaborator

ebranlard commented Oct 11, 2024

I've updated the setup.py, which should make the pip install work (in #25).

pytest will still fail for some reason, but python -m unittest discover will work. I've updated the readme to reflect this.

If someone figures out how to make pytest work in anaconda, let me know...

@lucas-carmo
Copy link

lucas-carmo commented Nov 13, 2024

For some reason, it seems that pytest doesn't like the __init__.py file in the root folder (https://stackoverflow.com/a/50400391). I removed ./__init__.py (I kept all the other __init__.py) locally and the tests are now passing. The exceptions are two hawc2 tests that I don't have time to check now but will get back to this later.

Maybe pytest was trying to load ./__init__.py instead of ./openfast_toolbox/__init__py?

image

@Tianmaru
Copy link

For some reason, it seems that pytest doesn't like the __init__.py file in the root folder (https://stackoverflow.com/a/50400391). I removed ./__init__.py (I kept all the other __init__.py) locally and the tests are now passing. The exceptions are two hawc2 tests that I don't have time to check now but will get back to this later.

Maybe pytest was trying to load ./__init__.py instead of ./openfast_toolbox/__init__py?

image

Oh, why was there a __init__.py file in the project's root to begin with? The actual Python package is in the openfast_toolbox subdirectory, right?

@lucas-carmo
Copy link

For some reason, it seems that pytest doesn't like the __init__.py file in the root folder (https://stackoverflow.com/a/50400391). I removed ./__init__.py (I kept all the other __init__.py) locally and the tests are now passing. The exceptions are two hawc2 tests that I don't have time to check now but will get back to this later.
Maybe pytest was trying to load ./__init__.py instead of ./openfast_toolbox/__init__py?
image

Oh, why was there a __init__.py file in the project's root to begin with? The actual Python package is in the openfast_toolbox subdirectory, right?

I'm not sure but maybe one of the developers might know why.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

6 participants