Questions tagged [nose2]

nose2 is the next generation of nicer testing for Python.

nose2 is the next generation of nicer testing for Python, based on the plugins branch of unittest2. nose2 aims to improve on nose by:

  • providing a better plugin api
  • being easier for users to configure
  • simplifying internal interfaces and processes
  • supporting Python 2 and 3 from the same codebase, without translation
  • encouraging greater community involvement in its development

https://github.com/nose-devs/nose2

46 questions
18
votes
3 answers

How to run specific test in Nose2

In previous version of Nose testing framework, there were several ways to specify only a subset of all tests: nosetests test.module nosetests another.test:TestCase.test_method nosetests a.test:TestCase nosetests…
Tomáš Ehrlich
  • 6,546
  • 3
  • 25
  • 31
12
votes
2 answers

How to ignore files or directories in nose2?

I have a nose.cfg file which i'm porting to nose2. I can't see any way in the nose2 docs to ignore a file or directory. In nose 1 this was done via these two flags: ignore-files=settings_test* exclude-dir=ignorethisdir How can this be done in…
craigds
  • 2,072
  • 14
  • 25
11
votes
3 answers

How to conditionally skip a test in python

I would like to skip some test functions when a condition is met, for example: @skip_unless(condition) def test_method(self): ... Here I expect the test method to be reported as skipped if condition evaluated to true. I was able to do this with…
argentpepper
  • 4,202
  • 3
  • 33
  • 45
11
votes
1 answer

Add color to nose2 output

This is such a simple question, but I can't find it anywhere... how do I add color to the output of running tests with nose2? For example, I would like failures to show up as red.
Alex Altair
  • 3,246
  • 3
  • 21
  • 37
7
votes
2 answers

How to configure pycharm to use nose2 instead of nose

According to the http://nose.readthedocs.io/en/latest all tests ... should consider using Nose2, py.test, or just plain unittest/unittest2. However, I can't seem to make Pycharm use it instead of nose. Is there some setting I can configure so…
Craig
  • 2,286
  • 3
  • 24
  • 37
6
votes
1 answer

Python Nose2 Tests Not Finishing When Class Method Called

When I run my tests that include calling a @classmethod using setuptools and nose2, the testing suite doesn't finish it just keeps on running. However I have checked that the test does indeed pass and reach the end of the function, the test suite…
James Russo
  • 578
  • 3
  • 18
6
votes
1 answer

How to get coverage report from a given package using nose2

I would like to use nose2 with coverage plugin to get the coverage of a Python package but I'm have a hard time configuring it to cover only the package I'm working on. The package is called vimhdl and the coverage section of my unittest.cfg looks…
suoto
  • 459
  • 3
  • 13
4
votes
2 answers

Run nose2 with coverage for installed package

I got some of our project packages installed in a venv by a jenkins job. After installing, the job pulls some unittests from a separate repository and runs them against the installed package. My problem is coverage only covers the test scripts but…
Igl3
  • 4,900
  • 5
  • 35
  • 69
4
votes
3 answers

How do I write a nose2 plugin that separates different types of tests?

I'm writing a plugin that will separate treat my unit tests, functional tests & integration tests differently. My tests folder will have the following structure exactly: /tests -- /unit -- /functional -- /integration Each unit test will…
the_drow
  • 18,571
  • 25
  • 126
  • 193
3
votes
1 answer

How do you get Nose2 tests to run on Visual Studio Code?

I'm trying to run tests in Visual Studio Code written for Nose 2. Neither the unittest nor nosetests options in the Python extension seem to be able to discover the tests correctly. The test cases live in a number of python files in a subdirectory a…
Topperfalkon
  • 145
  • 1
  • 6
3
votes
0 answers

pytest how to change result of the test

I am migrating a bunch of nose2 tests to pytest, those kind that yield and pytest does not cover them out of the box; so I had to craft something for these types, therefore I collect every custom assert of type "myassert val1 == val2, error…
ovi
  • 460
  • 4
  • 18
3
votes
1 answer

how to specify test specific setup and teardown in python unittest

I want to create unittest test with two different set up and tearDown methon in same class with two different test. each test will use its specific setUp and tearDown method in python unittest framework. could anyone help me. class…
3
votes
2 answers

Skip a unit test from a Nose2 Plugin

I'm having trouble actually skipping a unit test from a Nose2 plugin. I am able to mark the test skipped and see the reason in the final result, but the test still runs. This example code should basically skip any test, as long as the plugin is…
Matt Dodge
  • 10,833
  • 7
  • 38
  • 58
3
votes
1 answer

Use mock.patch decorators with nose2 Such DSL

Nose2 has this awesome Such DSL that works similar to RSpec. I used to use unittests directly and decorated the function with something like mock.patch. I am wondering how the should decorated functions differ from regular unittest functions, and…
322896
  • 956
  • 1
  • 9
  • 19
3
votes
0 answers

Python mock - reassigning return_value doesn't work

I have a test function (inside a unitttest.TestCase) that looks something like this: @patch('some.list') def test_thing(self, mocklist): # some setup code mocklist.__iter__.return_value = self.preCreatedList with patch('some.other.object',…
eaj
  • 2,576
  • 1
  • 20
  • 42
1
2 3 4