List all Tests Found by Nosetest
Version 0.11.1 is currently available. You can get a list of tests without running them as follows: nosetests -v –collect-only
Version 0.11.1 is currently available. You can get a list of tests without running them as follows: nosetests -v –collect-only
You need to have a copy of nose installed in the virtual environment. In order to force installation of nose into the virtualenv, even though it is already installed in the global site-packages, run pip install with the -I flag: (env1)$ pip install nose -I From then on you can just run nosetests as usual.
For me the best solution was what @Wesley mentioned in his comment to the accepted answer, specifically replacing ‘pass’ with a docstring for the abstract property, e.g.: class MyAbstractClass(object): __metaclass__ = ABCMeta @abstractproperty def myproperty(self): “”” this property is too abstract to understand. “””
Nose already has a builtin decorator for this: from nose.tools import nottest @nottest def test_my_sample_test() #code here … Also check out the other goodies that nose provides: https://nose.readthedocs.org/en/latest/testing_tools.html
Run nose with the -s / –nocapture option and you’ll be able to see the pdb prompt and interact with the debugger normally. If using the commandline that means:- python manage.py test -s [other-opts-and-args]
While the accepted answer is correct, I think there is a better use to assert_raises method. If you simply want to assert that an exception occurs, it’s probably simpler and cleaner to use @raises syntax. @raises(HTTPError) def test_exception_is_raised: call_your_method(p1, p2) However, assume you want to do bit more with the raised exception, for example: we … Read more
You must specify it like so: nosetests <file>:<Test_Case>.<test_method>, or nosetests test_web.py:TestWeb.test_checkout See the docs
Either: $ nosetests –nocapture mytest.py Or: $ NOSE_NOCAPTURE=1 nosetests mytests.py (it can also be specified in the nose.cfg file, see nosetests –help)
nosetests appname.tests.functional.test_controller should work, where the file is named test_controller.py. To run a specific test class and method use a path of the form module.path:ClassNameInFile.method_name, that is, with a colon separating the module/file path and the objects within the file. module.path is the relative path to the file (e.g. tests/my_tests.py:ClassNameInFile.method_name).