Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to deactivate django plugin for some tests?

I'm running some tests for Django, and some other tests for the website using Selenium.

My choice of Testing framework is amazing Pytest.

for testing Django I've currently installed pytest-django plugin and tests for Django run as expected, however now I'm back to my previous tests that don't need Django plugin.

I start tests and the Django plugin is picked up automatically.
I've checked the documentation and found the article where it is explained how to disable\deactivate plugins, however when I run this command:

py.test -p no:django 

I get an error that my "DJANGO_SETTINGS_MODULE" is not on sys.path.

Also

commands like:

py.test --traceconfig

or

py.test --version

throw me the same error. Looks like Django plugin is getting to deep? Why is it called when I'm just checking the version or the 'installed plugins'?

QUESTION: Is there any way to temporary deactivate this plugin without uninstalling it?

like image 763
Alex Okrushko Avatar asked Nov 23 '12 15:11

Alex Okrushko


1 Answers

This should work. When i install pytest-2.3.4 and run py.test -p no:django --version i don't get the DJANGO_SETTINGS issues. I get it when i leave away the -p no:django disabling. If it doesn't work, please link to a full trace on a pastebin.

like image 147
hpk42 Avatar answered Nov 06 '22 21:11

hpk42