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
This is happening due to a version incompatibility between numpy and scipy. numpy in its latest versions have deprecated numpy.testing.nosetester. Replicating the issue pip install numpy==1.18 # > 1.18 pip install scipy<=0.19.0 # <= 0.19 and from sklearn.tree import DecisionTreeClassifier as DTC Triggers the error. Fixing the error Upgrade your scipy to a higher version. … Read more
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.
Use entr: $ brew install entr $ find . -name ‘*.py’ | entr python ./manage.py test Or, for extra credit, combine it with ack: $ ack –python | entr python ./manage.py test If you want it to even find new files as you add them: $ until ack -f –python | entr -d python ./manage.py … Read more
The other thing which always gets me with nose is that it won’t run tests in executable files. I’m not exactly sure why that would make a difference across Mac/Ubuntu, but it’s worth a shot. Make sure that the scripts didn’t somehow get chmod +x‘d on the Mac… And if they did, fix them with … Read more
The behaviour is intentional, but the documentation could make this clearer. If you look at the first paragraph in the test discovery section, it says: For a project’s tests to be compatible with test discovery they must all be importable from the top level directory of the project (in other words, they must all be … Read more
Have you tried pip install coverage? The coverage plugin depends on separate coverage module, which is not a nose’s dependency, so needs to be installed manually.
I had the same problem and found an answer in a related question work for me. Just remove the __init__.py in the project root.
Access bar using spike.bar. Imported bar is not affected by mock.patch. from unittest import TestCase import unittest from mock import patch, MagicMock from spike import T1 import spike # <—- class TestShit(TestCase): @patch(‘spike.T1.foo’, MagicMock(return_value=”patched”)) def test_foo(self): foo = T1().get_foo() self.assertEqual(‘patched’, foo) @patch(‘spike.bar’) def test_bar(self, mock_obj): mock_obj.return_value=”patched” bar = spike.bar() # <—– self.assertEqual(‘patched’, bar) if __name__ … Read more
As of March 2022 this answer is updated to support Python versions between 3.4 and 3.11 (including the newest development Python version). Classification of errors / failures is the same that is used in the output unittest. It works without any modification of code before tearDown(). It correctly recognizes decorators skipIf() and expectedFailure. It is … Read more