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 frontends/cholla/tests/test_outputs.py when running test on installed package #4190

Closed
olebole opened this issue Oct 26, 2022 · 6 comments · Fixed by #4191
Closed

ERROR frontends/cholla/tests/test_outputs.py when running test on installed package #4190

olebole opened this issue Oct 26, 2022 · 6 comments · Fixed by #4191
Labels
release critical Highest priority (in a milestone)
Milestone

Comments

@olebole
Copy link
Contributor

olebole commented Oct 26, 2022

Bug report

Bug summary

On Debian, we regularly run the CI tests with the installed package. The idea behind this is to ensure the package still works when the environment changes. This worked fine for yt 4.0.5, but started to fail with 4.1.0.

Code for reproduction

  • install yt 4.1.1 (or 4.1.0), nose, h5py, pooch, pytest, tk
  • run python3 -m pytest --pyargs yt

Actual outcome

============================= test session starts ==============================
platform linux -- Python 3.10.8, pytest-7.1.2, pluggy-1.0.0+repack
rootdir: /tmp/autopkgtest-lxc.2fu1z15y/downtmp/autopkgtest_tmp
collected 938 items / 1 error

==================================== ERRORS ====================================
___________ ERROR collecting frontends/cholla/tests/test_outputs.py ____________
import file mismatch:
imported module 'test_outputs' has this __file__ attribute:
  /usr/lib/python3/dist-packages/yt/frontends/chimera/tests/test_outputs.py
which is not the same as the test file we want to collect:
  /usr/lib/python3/dist-packages/yt/frontends/cholla/tests/test_outputs.py
HINT: remove __pycache__ / .pyc files and/or use a unique basename for your test file modules
=============================== warnings summary ===============================

Expected outcome

I'd expect that all tests pass

Version Information

  • Operating System: Debian (unstable or testing)
  • Python Version: 3.10.8
  • yt version: 4.1.1, 4.1.0
  • pytest: 7.1.2
  • nose: 1.3.7
  • pooch: 1.6.0

This originally happens with yt installed as a Debian package, but it can be reproduced with a installation via pip.
The full log (incl. all package versions) is attached: yt-test-log-4.1.1.txt

@neutrinoceros
Copy link
Member

neutrinoceros commented Oct 26, 2022

Off the top of my head I don't know where this error may be coming from. A possibility is that our wheels erroneously include some byte code (__pycache__), but that's only a hunch. Anyway, thank you for reporting, I will dig into this for the next bugfix release

@neutrinoceros neutrinoceros added this to the 4.1.2 milestone Oct 26, 2022
@neutrinoceros neutrinoceros added the release critical Highest priority (in a milestone) label Oct 26, 2022
@neutrinoceros
Copy link
Member

I also note that up to now, we never seemed to have a reason to run tests specifically as part of the build/release workflow. This seems like a good one.

@olebole
Copy link
Contributor Author

olebole commented Oct 26, 2022

@neutrinoceros left-over bytecode is most probably not the case, as the failure is observed in both PyPI package and self-created package. For the latter, I am quite sure that we didn't artificially include bytecode (there are specific checks for that in our workflow).

@neutrinoceros
Copy link
Member

I confirm that there are no left over byte code in the source dist on PyPI

@neutrinoceros
Copy link
Member

I seems that the problem is that yt/frontends/cholla/tests/__init__.py and yt/frontends/chimera/tests/__init__.py are both -erroneously- omitted from the source distribution. Adding any of them fixes the problem.

I note that, after this is resolved, there are other problems with running tests the way you showed. AFAICT they are caused by how pytest discovers its configuration file (we rely on it discovering pyproject.toml at the top of the repo). I checked that our pyproject.toml is correctly included in the source dist (we'd have bigger problems if it wasn't, so that's good), but pytest still doesn't use it when invoked with --pyargs. Is there anything else we can do about it or can you take it from here ?

@olebole
Copy link
Contributor Author

olebole commented Oct 28, 2022

I can confirm that adding empty __init__.py files solves this problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release critical Highest priority (in a milestone)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants