nose

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

折月煮酒 提交于 2019-12-04 02:33:36
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 = [ '--with-coverage', '--cover-package=foot', '--cover-html', '--cover-html-dir=cover', ] Now, I want to disable the plain-text coverage report that gets shown after every test run; the HTML is much more functional, and the long badly-formatted table makes it hard to see actual test output. Neither nosetests nor coverage seems to have such an option, or perhaps I just can't find one? scjody (Taken from

How to access plugin options within a test? (Python Nose)

♀尐吖头ヾ 提交于 2019-12-03 22:16:35
问题 We are trying to implement an automated testing framework using nose. The intent is to add a few command line options to pass into the tests, for example a hostname. We run these tests against a web app as integration tests. So, we've created a simple plugin that adds a option to the parser: import os from nose.plugins import Plugin class test_args(Plugin): """ Attempting to add command line parameters. """ name = 'test_args' enabled = True def options(self, parser, env=os.environ): super

Is it possible to use Nose to run one test multiple times, concurrently?

时光怂恿深爱的人放手 提交于 2019-12-03 12:01:50
Is it possible to use nose to run a single test concurrently (across multiple processes) and aggregate the result in to a single pass/fail result? We have the need to run the same test multiple times concurrently to ensure resource locking isn't being affected. If nose can't do this, is there a specific testing/design pattern to follow to achieve this? It is possible to run tests concurrently with nose : Using the nose.plugin.multiprocess plugin, you can parallelize a test run across a configurable number of worker processes. While this can speed up CPU-bound test runs, it is mainly useful for

Can I restrict nose coverage output to directory (rather than package)?

走远了吗. 提交于 2019-12-03 11:15:17
问题 My SUT looks like: foo.py bar.py tests/__init__.py [empty] tests/foo_tests.py tests/bar_tests.py tests/integration/__init__.py [empty] tests/integration/foo_tests.py tests/integration/bar_tests.py When I run nosetests --with-coverage , I get details for all sorts of modules that I'd rather ignore. But I can't use the --cover-package=PACKAGE option because foo.py & bar.py are not in a package. (See the thread after http://lists.idyll.org/pipermail/testing-in-python/2008-November/001091.html

Make nose test runner show logging even if tests pass

 ̄綄美尐妖づ 提交于 2019-12-03 09:35:32
I am using nosetests test.py to run unit tests: import unittest import logging class Test(unittest.TestCase): def test_pass(self): logging.getLogger('do_not_want').info('HIDE THIS') logging.getLogger('test').info('TEST PASS') self.assertEqual(True, True) def test_fail(self): logging.getLogger('do_not_want').info('HIDE THIS') logging.getLogger('test').info('TEST FAIL') self.assertEqual(True, False) When test fails, it prints out all logging info. I can use --logging-filter to filer out only some loggers: nosetests test.py --verbosity=2 --logging-filter=test test_fail (test.Test) ... FAIL test

Nose test script with command line arguments

折月煮酒 提交于 2019-12-03 08:58:28
问题 I would like to be able to run a nose test script which accepts command line arguments. For example, something along the lines: test.py import nose, sys def test(): # do something with the command line arguments print sys.argv if __name__ == '__main__': nose.runmodule() However, whenever I run this with a command line argument, I get an error: $ python test.py arg E ====================================================================== ERROR: Failure: ImportError (No module named arg) -------

Running unit tests with Nose inside a Python environment such as Autodesk Maya?

 ̄綄美尐妖づ 提交于 2019-12-03 08:46:02
问题 I'd like to start creating unit tests for my Maya scripts. These scripts must be run inside the Maya environment and rely on the maya.cmds module namespace. How can I run Nose tests from inside a running environment such as Maya? 回答1: Use the mayapy executable included in your maya install instead of the standard python executable. In order for this work you'll need to run nose programmatically. Create a python file called runtests.py and put it next to your test files. In it, include the

'nosetests' not recognized on Windows after being installed and added to PATH

馋奶兔 提交于 2019-12-03 07:12:31
I'm on exercise 46 of Learn Python the Hard Way , and I'm meant to install nose and run nosetests. I've installed nose already using pip, but when I run nosetests in the directory above the 'tests' folder, I get the error: 'nosetests' is not recognized as an internal or external command, operable program or batch file. If it's relevant, I've already modified the PATH variable to include full path of Python27/Scripts and Python/Lib/site-package . If you are still having trouble after following Warren Weckesser's instructions try uninstalling and reinstalling. Using pip: pip uninstall nose I

How do I tell django-nose where my tests are?

南笙酒味 提交于 2019-12-02 21:58:34
I have my tests for a Django application in a tests directory: my_project/apps/my_app/ ├── __init__.py ├── tests │ ├── __init__.py │ ├── field_tests.py │ └── storage_tests.py ├── urls.py ├── utils.py └── views.py The Django test runner requires that I put a suite() function in the __init__.py file of my application's tests directory. That function returns the test cases that will run when I do $ python manage.py test I installed django-nose. When I try to run the tests with django-nose, 0 tests are run: $ python manage.py test <app_name> If I point directly at the test module, the tests are

Running unit tests with Nose inside a Python environment such as Autodesk Maya?

心已入冬 提交于 2019-12-02 21:17:43
I'd like to start creating unit tests for my Maya scripts. These scripts must be run inside the Maya environment and rely on the maya.cmds module namespace. How can I run Nose tests from inside a running environment such as Maya? Moe Use the mayapy executable included in your maya install instead of the standard python executable. In order for this work you'll need to run nose programmatically. Create a python file called runtests.py and put it next to your test files. In it, include the following code: import os os.environ['PYTHONPATH'] = '/path/to/site-packages' import nose nose.run() Since