Skip to content Skip to sidebar Skip to footer

"empty Test Suite" By Running Django Tests With Pycharm (tests Are Found If Launched From The Shell)

I'm having an hard time trying to run my Django tests using PyCharm. I did it easily in the past using a 'python running configuration' in which I used manage.py to run them, I was

Solution 1:

The problem is that PyCharm doesn't apply the given search pattern for test files (-p "*_tests.py"). It's a bug that has already been reported: https://youtrack.jetbrains.com/issue/PY-15869

The solution has been to simply rename my files :P

Solution 2:

Using pycharm, you can directly run your tests by creating a test configuration. Create a configuration using Run>Edit Configuration. Add a config from Django tests , set the virtual env path , working directory(path to manage.py), Target module (like complete_project or a complete_project.app_name). Run the configuration , it will run the tests from the tests.py from corresponding module.

Solution 3:

For my case it was because the names of my test methods didn't start with test. Renamed them, and PyCharm started to run them correctly.

Post a Comment for ""empty Test Suite" By Running Django Tests With Pycharm (tests Are Found If Launched From The Shell)"