nosetests

How to output coverage XML with nosetests?

北战南征 提交于 2019-12-12 09:32:36
问题 I'm trying to output the coverage XML of my nosetests so they show up on Hudson. The line I'm executing is: nosetests --with-gae -v --all-modules --with-xunit --with-coverage I see the coverage output in the console, but there's no xml file containing the coverage data. How can I get it to output the coverage xml? 回答1: Once you've run the nosetests command, there will be a .coverage data file in the directory. If you then run coverage xml , it will create a Cobertura-compatible XML file from

Python process will not exit

笑着哭i 提交于 2019-12-12 08:36:40
问题 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 which will print a stack trace? 回答1: You can enter the debugger and type bt : import pdb; pdb.set_trace() Then you can step through the operation and see where it hangs. 回答2: nosetests -vv -x -s --pdb test_foo where -x is "Stop running tests after the

Why can't nosetests find one the elements in sys.path?

前提是你 提交于 2019-12-11 12:14:09
问题 I have a series of unit tests that I'm running with nose . For some of my tests, I'd like to remove a module's path from the sys.path so there is no conflict with what I am testing. sys.path.remove('/path/to/remove/from/sys/path') If I run the Python interpreter and call sys.path , the '/path/to/remove/from/sys/path' is there in the list. However, once nosetests is called, the above code cannot find it and gives me a "not found in list" error. Why is nose not able to find the path in sys.path

running nosetests on module locally installed with easy_install

怎甘沉沦 提交于 2019-12-11 03:08:36
问题 I can't get nosetests to test a newly installed Python pandas library. I don't have root access to this machine, so I installed pandas locally with easy_install: $ easy_install --prefix=$HOME/.local pandas ... (Success) ... $ python >>> import pandas >>> But several attempts to run nosetests on pandas have failed: $ nosetests pandas Ran 0 tests in 0.001s OK $ nosetests ~/.local/lib/python2.7/site-packages/pandas-0.11.0-py2.7-linux-x86_64.egg/pandas/tests/ Ran 0 tests in 0.000s OK $ nosetests

How can I store testing data for python nosetests?

可紊 提交于 2019-12-10 18:18:23
问题 I want to write some tests for a python MFCC feature extractor for running with nosetest. As well as some lower-level tests, I would also like to be able to store some standard input and expected-output files with the unit tests. At the moment we are hard-coding the paths to the files on our servers, but I would prefer the testing files (both input and expected-output) to be somewhere in the code repository so they can be kept under source control alongside the testing code. The problem I am

Manually adding test suite to nose

北城以北 提交于 2019-12-10 17:33:04
问题 I want to create a test suite manually instead of using test discovery (only in one module, the others should use discovery). I found how I can do this in unittests, but I'm not sure how to transfer that to nose and how it mixes with the discovery. The nose docs don't have examples and I don't understand how I'm supposed to use them. Could somebody please give me an example? Details: I have test classes where I want to run each method a few times with different parameters. Ideally also

Setup and teardown functions executed once for all nosetests tests

◇◆丶佛笑我妖孽 提交于 2019-12-10 15:49:11
问题 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 behavior common_setup() test_1() test_2() common_teardown() Note that there exists a similar question with an answer that is not working with python 2.7.9-1, python-unittest2 0.5.1-1 and python-nose 1.3.6-1 after replacing the dots with pass and adding the line import unittest . Unfortunately

Anyone know how nosetest's -m, -i and -e work?

假装没事ソ 提交于 2019-12-10 12:39:15
问题 I am trying to get nosetests to identify my tests but it is not running any of my tests properly. I have the following file structure Project +----Foo/ +----__init__.py +----bar.py +----test/ +----__init__.py +----unit/ +----__init__.py +----bar_test.py +----functional/ +----__init__.py +----foo_test.py Within bar_test.py class BarTest(unittest.TestCase): def bar_1_test(): ... Within foo_test.py class FooFTest.py def foo_1_test(): ... Using -m, -i, -e options of nosetests What is the regex I

python nosetests setting the test description

谁说我不能喝 提交于 2019-12-10 10:23:01
问题 I'm creating tests on the fly (I must) in python to run with nosetests as below: def my_verification_method(param): """ description """ assert param>0, "something bad..." def test_apps(): """ make tests on the fly """ param1 = 1 my_verification_method.__doc__ = "test with param=%i" % param1 yield my_verification_method, param1 param1 = 2 my_verification_method.__doc__ = "test with param=%i" % param1 yield my_verification_method, param1 The problem is that that nosetest prints: make tests on

Handling Exceptions in Python Behave Testing framework

你离开我真会死。 提交于 2019-12-10 03:34:02
问题 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 step_impl(context): try: konfigure.load_env_mapping("baz", context.configs) except KeyError, e: assert (e.message == "No baz configuration found") With nose I can annotate a test with @raises(KeyError) I can't find anything like this in behave (not in the source