-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
"import file mismatch" despite different names (only Windows 7?) #702
Comments
@punch_card this is not a bug, as far as i can tell the python module name is the same for both test modules py.test complains about different files ending up with the same module name, thus breaking details can you verify? |
@nicoddemus some bb<>gh name mappings are incorrect, how can we elevate that |
@RonnyPfannschmidt I wonder if it's really something which needs fixing - it might be difficult to do so. |
@The-Compiler we should have some better error reporting, its not something we can fix tho |
Sorry - I was talking about the wrong name issue, not this issue 😉 |
Hi RonnyPfannschmidt and others, Well, actually it is a bug, but a small mishap has occurred in the communications. The two paths reported in the error message are different. The second mention of X:\prgm_A\test\test_A.py should have one extra backslash after the X:, but this was swallowed by the BitBucket markup language interpreter. The full and correct description of the problem is still available at StackOverflow. (The reason I am suddenly "punch-card" instead of "punch_card" is simply that I did not have a GitHub-account previously. Now, when I wanted to put the record straight, and tried to open an account here, it turned out that underscores were not allowed here. So, please don't take me for an imposterer.) |
@punch-card i see what you mean, this seems a path normalization issue in local class of pylib, more investigation is needed |
I am getting this issue. ERROR collecting ./app/integrations/appB/tests/functional/test_handler.py HINT: remove pycache / .pyc files and/or use a unique basename for your test file modules |
@SudhagarS do your test directories have |
@nicoddemus as far as i can tell noting about that will change - there will be need for renaming there are 2 different folders with same test structure layout in the pythonpath, so it cant be fixed |
Not sure, because turning it into a package, pytest will import the module as |
@nicoddemus my understanding is, that both appa and appb are git checkouts that contain the testing folders pristine |
hmm, based on the stackoverflow question however, adding another init file with a explaining comment should do |
@nicoddemus Yes, that fixed it. Thanks. |
@SudhagarS can we close this then? |
So fast @RonnyPfannschmidt 🤠 |
thanks, also this one was just luck, i checked notifications while waiting for a build |
Originally reported by: BitBucket: punch_card, GitHub: punch_card
I have published a full description of the problem at StackOverflow, but here follows a terse summary.
I have tried to device a simple set of black box tests, following the directory structure and naming recommendations. When I try to run all tests from the top of the structure, I consistently get error messages of this kind:
ERROR collecting /prgm_A/test/test_A.py
import file mismatch:
imported module 'test_A' has this file attribute:
X:\prgm_A\test\test_A.py
which is not the same as the test file we want to collect:
X:\prgm_A\test\test_A.py
HINT: remove pycache / ...
My workaround, to step down into the individual test directories for each subprogram and run the subsets of tests from there, stopped working when our computers were migrated to 7.
I don't see this happen under linux.
Note that the page at StackOverflow includes a minimal code example which reproduces this problem.
The text was updated successfully, but these errors were encountered: