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

Test files in different subdirectories can't have the same name #413

Open
brynpickering opened this issue Jul 9, 2024 · 1 comment
Open
Labels
bug Something isn't working

Comments

@brynpickering
Copy link
Member

What happened?

The change to the test directory introduced in #403 creates an issue when trying to match test filenames with model output filenames. E.g., tests/models/supply/test_heat.py and tests/models/demand/test_heat.py are not allowed simultaneously. One fix would be to flatten the structure and have tests/models/test_supply_heat.py and tests/models/test_demand_heat.py. The other is to repeat the parent directory name in the filename (tests/models/supply/test_heat_supply.py).

Version

1.2.0.dev

Relevant log output

import file mismatch:
imported module 'test_heat' has this __file__ attribute:
  /Users/brynpickering/Repos/euro-calliope/tests/model/timeseries/demand/test_heat.py
which is not the same as the test file we want to collect:
  /Users/brynpickering/Repos/euro-calliope/tests/model/timeseries/supply/test_heat.py
HINT: remove __pycache__ / .pyc files and/or use a unique basename for your test file modules
@brynpickering brynpickering added the bug Something isn't working label Jul 9, 2024
@timtroendle
Copy link
Member

I see. This is a restriction by pytest. To be fair, the case that you ran into in #408 is a bit of a special case. So maybe we don't necessarily need to change anything for most cases and handle the special cases the way you've handled them over there (the second of your two options above)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants