Questions tagged [nosetests]

nosetests is the the script name for running Python [nose] testing, a package for automated unit tests based on simple asserts and running all test*() functions in test*.py.

nosetests is the main script for running tests with automatic discover.

See documentation.

390 questions
11
votes
2 answers

Disabling nose coverage report to STDOUT when HTML report is enabled?

I'm using nose (via django-nose) with the coverage plugin to check test coverage of my Django project. I've configured nose to generate an HTML coverage report on every test run: NOSE_ARGS = [ …
supervacuo
  • 9,072
  • 2
  • 44
  • 61
10
votes
3 answers

How to parameterize python unittest setUp method?

I'm trying to run same test cases with different setUp methods. I've tried using nosetests and parameterized but it seems like it doesn't support parameterizing setUp methods. Here is an example of what I'm trying to do: ... from nose_parameterized…
finspin
  • 4,021
  • 6
  • 38
  • 66
10
votes
4 answers

Handling Exceptions in Python Behave Testing framework

I've been thinking about switching from nose to behave for testing (mocha/chai etc have spoiled me). So far so good, but I can't seem to figure out any way of testing for exceptions besides: @then("It throws a KeyError exception") def…
Robert Moskal
  • 21,737
  • 8
  • 62
  • 86
10
votes
2 answers

How do I send cookies with request when testing Flask applications through nosetests?

I'm having some trouble sending a cookie with my test request. I've tried something like this: # First request to log in, retrieve cookie from response response = self.app_client.post('/users/login', query_string={ data.. ) cookie =…
moodh
  • 2,661
  • 28
  • 42
9
votes
5 answers

beginner installing nosetests package

I'm trying to install the following as per the learnpythonthehardway tutorial: pip from http://pypi.python.org/pypi/pip distribute from http://pypi.python.org/pypi/distribute nose from http://pypi.python.org/pypi/nose/ virtualenv from…
ZCJ
  • 499
  • 2
  • 9
  • 17
9
votes
1 answer

Setup and teardown functions executed once for all nosetests tests

How to execute setup and teardown functions once for all nosetests tests? def common_setup(): #time consuming code pass def common_teardown(): #tidy up pass def test_1(): pass def test_2(): pass #desired…
gizzmole
  • 1,437
  • 18
  • 26
9
votes
2 answers

Python process will not exit

I'm use nosetests to run some tests. However, after the tests have finished running, the nosetests process just sits there, and will not exit. Is there anyway to diagnose this? Does Python have a facility similar to sending Java a kill -QUIT…
oneself
  • 38,641
  • 34
  • 96
  • 120
9
votes
1 answer

What does the character `S` stand for in nosetest output

I am running python nosetests on a foreign module. The dots mean that a test passed. What does S stand…
Alojz Janez
  • 530
  • 1
  • 3
  • 13
8
votes
3 answers

How do I suppress App Engine logging while running unit tests?

I'm using gaetestbed in my GAE app, and it's working very well. However, the useful statements that nose prints when your test is incorrect is being washed away by App Engine's logging: root: Level 9: Evaling filter expression…
Matt Norris
  • 8,596
  • 14
  • 59
  • 90
8
votes
3 answers

Why do tests in derived classes rerun the parent class tests?

When there is significant overlap in test setup, it can keep things DRY to use inheritance. But this causes issues with unnecessary duplication of test execution: from unittest import TestCase class TestPotato(TestCase): def…
wim
  • 338,267
  • 99
  • 616
  • 750
8
votes
0 answers

How to test setup.py?

I have been collecting unit test coverage from my library but, since I have no test case for setup.py, this file always gives 0. Does anyone ever test setup.py using nosetests? Here is my file…
chfw
  • 4,502
  • 2
  • 29
  • 32
8
votes
2 answers

Python unittest ignore numpy

I am writing python tests with unittest and running the tests from the command line with nosetests --with-coverage -x When I include numpy in one of my tests it tries to test the numpy packages as well. Example output: ... Name …
trauzti
  • 219
  • 1
  • 9
8
votes
3 answers

Use nose.run() or nose.main() to run tests in a specific module

It's mentioned in the documentation (http://nose.readthedocs.org/en/latest/api/core.html) but there don't seem to be any examples, and trying it seems to run all tests in the cwd.
neel
  • 81
  • 1
  • 3
8
votes
3 answers

Are there any visual tools for Python unit tests?

I'm writing quite a few unit tests and using nosetests to run them. Nose certainly makes it nice and easy to run tests, but the output can be pretty cluttered at the best of times, and a downright mess at others, depending on warnings and errors. I…
Soviut
  • 88,194
  • 49
  • 192
  • 260
8
votes
2 answers

Python benchmark tool like nosetests?

What I want I would like to create a set of benchmarks for my Python project. I would like to see the performance of these benchmarks change as I introduce new code. I would like to do this in the same way that I test Python, by running the…
MRocklin
  • 55,641
  • 23
  • 163
  • 235
1 2
3
25 26