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
1
vote
1 answer

nose2 coverage plugin timing

I'm running nose2 tests with the coverage plugin. I noticed that decorators, class declarations, and function definitions aren't being marked as covered, even though the "actual code" underneath them is. I found this answer, which suggests starting…
swizzard
  • 1,037
  • 1
  • 12
  • 28
0
votes
0 answers

ModuleNotFoundError inside a tests folder

Inside my tests directory, I have subtest_helpers.py and other test .py files. subtest_helpers.py has functions that I use within my test files. At the beginning of said test files, I have import subtest_helpers as sh but this gives…
0
votes
1 answer

Nose and nose2 alternatives

I have been working my way through Learn Python 3 The Hard way by Zed Shaw and I have recently encountered a huge issue. So the book itself is outdated and examples included in the book make use of the nose module which apparently isn't supported…
user20495043
0
votes
0 answers

Mocked variable for unittest not working in decorated function in flask

I have a decorator that needs a test similar to this: # code.py from flask import request, current_app def some_decorator(f): @wraps(f) def decorated_function(*args, **kwargs): if current_app.config['ENVIRONMENT'] == 'test': pass …
sam-s3pi0l
  • 73
  • 1
  • 5
0
votes
0 answers

Creating a test for a flask app using nose2

I have a flask app that works (tested with postman). I am now writing unittest for it as I am trying with Travis and CI on my repository, I use nose2. The test class I wrote is this: import unittest import requests from myapp import app class…
bruvio
  • 853
  • 1
  • 9
  • 30
0
votes
0 answers

how to reduce test execution time of nose2

In order to test our jenkins shared library code we wrote >300 tests. Each tests run via jenkinsfile runner command, test validate the exit status and console output. Each tests run ~ 40-60 sec, so the total CI time is ~ 60 min. (we are using…
Shurik
  • 562
  • 1
  • 7
  • 19
0
votes
1 answer

python nose2: problem when multiple modules have the same name

I have a directory hierarchy containing tests, where I want to give the same name to test modules in different directories. For example, /tests/xxx/test.py /tests/yyy/test.py nose2 discovery doesn't seem to handle this. I get an error as…
Ziffusion
  • 8,779
  • 4
  • 29
  • 57
0
votes
0 answers

How to assert JSON data using nose2?

I'm trying to test my API (written with Flask) using nose2. The response could look something like that: { "finished": [ { "id": 1, "position": 1, "time": "03:45.333" }, { "id": 2, "position": 2, …
atmhrt
  • 1
  • 1
  • 1
0
votes
1 answer

How do you activate built in modules in nose2 test framework that don't come pre-loaded?

I am trying to load the "layers" plugin in nose2, but I can't figure out the format for the configuration file. The documentation is here: http://nose2.readthedocs.io/en/latest/plugins/layers.html , but it doesn't include the module name to list in…
0
votes
1 answer

Fixing python/nose2/bin/nose2: not found

I am taking a test in OOP, where I am expected to create a ShoppingCart. I have written my code which passes all the test from unittest, but when I try to submit, I get this error/bug /bin/sh: 1: python/nose2/bin/nose2: not found Below I have…
Uche
  • 1
0
votes
1 answer

__init__ variable not found in test class?

I recently changed from using nose to nose2, however a lot of my testing code seems to have broken in the process. One thing in particular is the init variable i put in my test class "self.mir_axis" is giving this error: mirror_index =…
Neo Conker
  • 169
  • 1
  • 13
0
votes
1 answer

How to run a single test case in nose2

I'd like to run a single test contained in a subclass of unittest.TestCase using nose2 following How to run specific test in Nose2, but it doesn't seem to work for me. I'm using the following example script, which I've named…
Kurt Peek
  • 52,165
  • 91
  • 301
  • 526
0
votes
1 answer

nose2 with such DSL does not find tests

This might be really stupid, but I can't get it to work... I'm want to use the such DLS in nose2 with python 2.7 in Linux. I'm trying out the beginning of the example from the documentation http://nose2.readthedocs.org/en/latest/such_dsl.html (see…
Isi
  • 11
  • 2
0
votes
1 answer

How to check test run results in nose2?

With unittest I can check if there were failed tests during test run like this: import unittest all_tests = unittest.defaultTestLoader.discover('path-to-tests') results = unittest.TextTestRunner().run(all_tests) if results.wasSuccessful(): …
Vader
  • 3,675
  • 23
  • 40
0
votes
1 answer

Tox Invocation Error while trying to run command 'sudo tox'

While working in an virtualenv [3.4] I was trying to run tox for running the tests when I got the error: py34 develop-inst-nodeps: /home/horcrux/dir-sub/dir py34 runtests: commands[0] | python -m nose2…
horcrux
  • 11
  • 1
  • 2