Pycharm - no tests were found?

后端 未结 8 2104
鱼传尺愫
鱼传尺愫 2020-12-18 17:52

I\'ve been getting a

No tests were found

error in Pycharm and I can\'t figure out why I\'m getting it... this is what I have f

8条回答
  •  旧巷少年郎
    2020-12-18 18:27

    Adding another answer in the hopes that it helps someone down the road. I've been fighting this problem and just figured out the answer (I think). I originally deleted the standard Django file tests.py out of my application folder. I also created a subdirectory of my project called tests, which contains separate test scripts. In this situation, Pycharm failed to find the tests. I corrected this simply by creating an empty file called tests.py in my application folder.

    So:

    1. Make sure you have a file called tests.py in your application director (it can be an empty file)
    2. It seems that a folder called tests, in your project, can contain separate test scripts and Pycharm seems to find and run these.

    Here's a picture of the directory structure that's working for me:

提交回复
热议问题