Unable to run pytest on single test.py

Answered

For reference. I have 2 python test files, test_app.py and test_mobile.py.

I don't understand why it is that when I run pytest test_mobile.py, it runs tests from within test_app.py?

I get the following in the Pycharm terminal. test_mobile.py::test_app_test1

Does anyone know why this is? Is this an issue with my Pycharm config?

 

Thanks!

Rob

0
4 comments

PyCharm uses the same run configuration by default.
Try right-clicking the file and choosing Run from the context menu. Does it work?

0

Same thing. test_mobile.py > right click > run . It proceeds to run the tests from test_app.py. Once the test in test_app.py have completed, it does then run the tests in test_mobile.py however. Very strange.

0

Try removing the existing run configurations and try again. Does the issue remain?

0

Well, that didn't do it but I did figure it out. I'm embarrassed to say, it was due to my imports on the mobile test. I had forgotten that I did a * import from the app test to access some global variables. This was also including the tests, of course. I removed the import and everything is working now. Sorry to waste your time but thank you for all your help!

Rob

0

Please sign in to leave a comment.