Almad / django-sane-testing

Django integration with nose, Selenium and more
https://github.com/Almad/django-sane-testing
Other
59 stars 8 forks source link

Sane testing breaks nose with django #8

Closed honzakral closed 12 years ago

honzakral commented 13 years ago

I have a project that uses nose to test a django app (without sane-testing). If I have sane testing installed, I get:

ERROR: test suite for <module 'test_project' from '/home/king/work/WHISKEY/rubix/test_project/init.py'>

Traceback (most recent call last): File "/home/king/work/VENVS/whiskey/lib/python2.7/site-packages/nose/suite.py", line 208, in run self.setUp() File "/home/king/work/VENVS/whiskey/lib/python2.7/site-packages/nose/suite.py", line 291, in setUp self.setupContext(ancestor) File "/home/king/work/VENVS/whiskey/lib/python2.7/site-packages/nose/suite.py", line 314, in setupContext try_run(context, names) File "/home/king/work/VENVS/whiskey/lib/python2.7/site-packages/nose/util.py", line 491, in try_run return func() File "/home/king/work/WHISKEY/rubix/test_project/init.py", line 21, in setup from django.test.simple import DjangoTestSuiteRunner File "/home/king/work/DJANGO/django/django/test/init.py", line 5, in from django.test.client import Client File "/home/king/work/DJANGO/django/django/test/client.py", line 19, in from django.test import signals ImportError: cannot import name signals


Ran 0 tests in 0.010s

FAILED (errors=1)

once I pip uninstall djangosanetesting, everything works again

akaihola commented 12 years ago

I get almost the same behavior. I'm testing a Django app with nose by running nosetests directly since I'm mocking out Django internals. The test suite runs correctly, but I get run-time warnings from nose plugins:

(myapp)$ bin/nosetests
myapplib/python2.7/site-packages/nose/plugins/manager.py:383: RuntimeWarning: Unable to load plugin cherrypyliveserver = djangosanetesting.noseplugins:CherryPyLiveServerPlugin: Could not import settings 'settings' (Is it on sys.path?): No module named settings
  RuntimeWarning)
myapplib/python2.7/site-packages/nose/plugins/manager.py:383: RuntimeWarning: Unable to load plugin sanetestselection = djangosanetesting.noseplugins:SaneTestSelectionPlugin: cannot import name signals
  RuntimeWarning)
myapplib/python2.7/site-packages/nose/plugins/manager.py:383: RuntimeWarning: Unable to load plugin djangoliveserver = djangosanetesting.noseplugins:DjangoLiveServerPlugin: cannot import name signals
  RuntimeWarning)
myapplib/python2.7/site-packages/nose/plugins/manager.py:383: RuntimeWarning: Unable to load plugin djangotranslations = djangosanetesting.noseplugins:DjangoTranslationPlugin: cannot import name signals
  RuntimeWarning)
myapplib/python2.7/site-packages/nose/plugins/manager.py:383: RuntimeWarning: Unable to load plugin selenium = djangosanetesting.noseplugins:SeleniumPlugin: cannot import name signals
  RuntimeWarning)
myapplib/python2.7/site-packages/nose/plugins/manager.py:383: RuntimeWarning: Unable to load plugin djangoresultplugin = djangosanetesting.noseplugins:ResultPlugin: cannot import name signals
  RuntimeWarning)
myapplib/python2.7/site-packages/nose/plugins/manager.py:383: RuntimeWarning: Unable to load plugin django = djangosanetesting.noseplugins:DjangoPlugin: cannot import name signals
  RuntimeWarning)
...........
----------------------------------------------------------------------
Ran 11 tests in 0.178s

OK

pip uninstall djangonosetesting gets rid of these warnings.

akaihola commented 12 years ago

I also verified that I get the same behavior on djangosanetesting-0.5.11 and the version as of November 19, 2011 commit 77ca5fb3f95825da306f2759f4b9c790f6f2e181.

Almad commented 12 years ago

Thanks for the patch!

Merged.