3👍
This seems like a Virtual Environment loading error. Have you applied the correct Virtual Environment to your testing env? Check this article and try running it again. http://exponential.io/blog/2015/02/10/configure-pycharm-to-use-virtualenv/
Also on another note, if you’re testig for correct template loading or GET requests feel free look at my tutorial.
1👍
Do you have the correct “Working directory” values and “Target” for your tests?
I faced similar issues with Behave tests…
1👍
This worked for me:
-
Run the test (it fails with the error)
-
Click the dropdown next to the test name and select ‘Edit configurations’
-
Click on the test name in the left hand panel of the ‘Run/Debug configurations’
dialog. -
Click the minus sign to delete the test. Click OK
-
Now re-run the test and it passes for me.
My hunch is that dodgy test config gets cached under .idea/
and explicitly deleting the test removes or updates it.
Another workaround is to manually create a Django test:
-
Edit Configurations
-
Add new configuration (click the ‘+’ button)
-
Select ‘Django Tests’
-
Under ‘Target’, enter the path to the test module (e.g. ‘your_app.your_module.tests’)
-
Click OK, and you should be able to run this configuration.