3

py.test gives me an "import file mismatch" error. I believe its because I have test modules with the same name under different packages (see below).

Someone posted an identical question here: py.test - test discovery failure when tests in different directories are called the same. Unfortunately, none of the responses work for me.

I've also read the manual. I've tried not including the __init__.py files in the test directories per the manual but that doesn't seem to make a difference.

The "app_class1" and "app_class2" directories each contain a test module named test_create.py.

Here is how my code is organized

/app
 -setup.py
 /app
  -app.py
  -__init__.py
 /test
  - __init__.py
  /app_class1
   - __init__.py
   - test_create.py
  /app_class2
   - __init__.py
   - test_create.py

Any help is greatly appreciated. Thank you.

P.S. I would have commented on the referenced conversation but my reputation isn't high enough to do so.

Community
  • 1
  • 1
guyja
  • 857
  • 1
  • 10
  • 19
  • I should mention that I do not understand the "pip install -e" solution to this problem mentioned both in the pytest manual and in the referenced post. Perhaps this is the solution but I just don't know what it does. I read the pip manual describing the "-e" flag but was still unclear as to what it does. – guyja Mar 31 '14 at 18:08
  • I tried this with the same name and there is no error. Can you post the whole traceback? Files, lines, etc.? – User Mar 31 '14 at 19:25
  • Strangely, I can no longer replicate the error. Since posting I installed nose to see if that would work. I also deleted all the __pycaching__ files but I had already done that several times before posting this question. Either way thanks for your response. I'll fiddle around some more to see if I can figure out what fixed the problem. – guyja Mar 31 '14 at 22:24

0 Answers0