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
2
votes
2 answers

Is there a way to map python nose2 to coverage plugin which is installed in custom location?

I have installed nose2 with the following command: pip3 install nose2 And I have installed the coverage in the custom path with the following command: pip3 install --target=/tmp/coverage_pkg coverage I want to execute the test cases and generate…
Saif Baig
  • 56
  • 6
2
votes
1 answer

Why does nosy (nose2) get an error but python runs tests ok

I'm trying to get tests running continually when I save a file. I'm try to use nosy. I can run my tests with python test_1.py $ python test_1.py .. ---------------------------------------------------------------------- Ran 2 tests in 0.000s OK but…
Michael Durrant
  • 93,410
  • 97
  • 333
  • 497
2
votes
1 answer

Python's nose2 --with-coverage is showing coverage for the test itself

I'm trying to follow Chapter 3 of David Sale's Testing Python, but using nose2 instead of nosetests. So far I've written a calculate.py: class Calculate(object): def add(self, x, y): if type(x) == int and type(y) == int: …
Kurt Peek
  • 52,165
  • 91
  • 301
  • 526
2
votes
2 answers

nose2: run tests from an imported module

I generated and imported a module that contains a test that I want to run with nose2. Here is the code that creates and import the module: import sys import imp import nose2 def import_code(code, name): module = imp.new_module(name) exec…
little-dude
  • 1,544
  • 2
  • 17
  • 33
2
votes
0 answers

nose2 config file behavior

Hoping someone can clarify nose2 config behavior. I am wondering if this config file behavior is expected or not. I have a project like this: dir tests scenarios default.py another_cfg.cfg unittest.cfg A couple questions: I am in the tests…
Aaron
  • 3,249
  • 4
  • 35
  • 51
1
vote
1 answer

Apache Airflow | Testing

I am new to Apache airflow and have been assigned a task to determine frameworks which can be used to unit and integration testing of Airflow DAGs. Until now I have seen examples of pytest and Python unittest frameworks. Can we use other Python test…
AD90
  • 179
  • 2
  • 2
  • 9
1
vote
1 answer

how to run nose2 tests in Jenkins build python

I am running a Jenkins pipeline where I have a flask app to run and then test (using nose) the current Jenkinsfile I am using is pipeline { agent { docker { image 'python:3.8.0' } } stages { stage('build') { steps { …
bruvio
  • 853
  • 1
  • 9
  • 30
1
vote
0 answers

nose2 can't locate base test script

I have a test suite for my python app that I run with nose2. I used to have all of the tests in a single file; however, that file was getting over 1500 lines long so I've broken it up into multiple separate files. The suite used to look like…
Johnny Metz
  • 5,977
  • 18
  • 82
  • 146
1
vote
1 answer

Nose2 XML won't find modules, when unconfigured Nose2 will

This is likely a beginners mistake, or something of the like. UPDATE I installed nose instead of nose2, and ran nosetests --with-xunit and it did exactly what I wanted, proving that the issue is not with my code but with how I am handling nose2. I…
Nathan Smith
  • 683
  • 1
  • 10
  • 24
1
vote
1 answer

Unable to get missing lines & branches in nose2

I'm trying to get my tests to report missing lines and branches. I've configured nose2 and coverage to produce line and branch coverage, and as far as I can tell I have set the coverage config correctly to give me the missing lines and branches.…
Andrew Gelnar
  • 633
  • 4
  • 14
1
vote
1 answer

How to test Python 2 code using nose2

I've asked this question before (Force nose2 to use Python 2.7 instead of Python 3.5) but didn't get an answer, and thought I might give it another try. I'm trying to run tests using the command nose2 but I'm getting an error that ends…
Kurt Peek
  • 52,165
  • 91
  • 301
  • 526
1
vote
0 answers

Force nose2 to use Python 2.7 instead of Python 3.5

Similar to Force Nosetests to Use Python 2.7 instead of 3.4, I've written some unit tests in Python 2 which I'd like to run in Python 2. However, by default my installation of nose2 seems to try to run Python 3. For example, if I try to run…
Kurt Peek
  • 52,165
  • 91
  • 301
  • 526
1
vote
1 answer

Python nose test with relative pandas file path

I am trying to write a unit test for a piece of code that includes using pandas to read a CSV file from a relative path. The directory structure is: ./ ./thing1/main.py ./thing1/test_main.py ./thing1/dat/file.csv ./otherthings/... In main.py, I…
Qi Chen
  • 1,648
  • 1
  • 10
  • 19
1
vote
1 answer

nose2.main() verbose output

I'm writing a separate nose2 tests.py for my program and because I want it to run on both Windows and Linux fairly seamlessly I've decided to forgo using the normal commandline nose2 and instead import it in the file and run it from there. if…
Keef Baker
  • 641
  • 4
  • 22
1
vote
1 answer

Phabricator Arcanist unit test for nose2

I have trouble setting up the auto unit test config for my python project. Normally I just run nose2 and my tests throughout the project will be discovered and executed. However, I am having a hard time finding relative documents to set up arc unit.…
Andy
  • 1,231
  • 1
  • 15
  • 27