nosetests

Get name of current test in setup using nose

回眸只為那壹抹淺笑 提交于 2021-02-07 06:56:43
问题 I am currently writing some functional tests using nose. The library I am testing manipulates a directory structure. To get reproducible results, I store a template of a test directory structure and create a copy of that before executing a test (I do that inside the tests setup function). This makes sure that I always have a well defined state at the beginning of the test. Now I have two further requirements: If a test fails, I would like the directory structure it operated on to not be

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

主宰稳场 提交于 2020-07-06 09:13:06
问题 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 = response.headers['Set-Cookie'] # Contains: user_hash=3f305370487731289a7f9bd8d379a1c2; Domain=.flowdev.com; Path=/ # Second request that requires the cookie response = self.app_client.get('/users/', headers={'Set-Cookie': cookie}) # Here i print out request

Preventing nose from discovering a package named “setup”?

别等时光非礼了梦想. 提交于 2020-01-14 12:17:29
问题 I've got a directory tree that looks like: $ find . -name '*.py' -ls 1315965 4 -rw-rw-r-- 1 roy roy 16 May 25 23:09 ./foo/__init__.py 1445517 4 -rw-rw-r-- 1 roy roy 16 May 25 23:09 ./foo/setup/__init__.py When I run nose, it imports foo.setup, believes it's a fixture, and attempts to run it, resulting in: TypeError: Attribute setup of <module 'foo' from '/home/roy/play/nose/foo/__init__.pyc'> is not a python function. Only functions or callables may be used as fixtures. Is there some way to

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

假装没事ソ 提交于 2020-01-12 14:10:31
问题 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

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

守給你的承諾、 提交于 2020-01-12 14:10:12
问题 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

Trying to run nosetests outputing with xunit and using suite

隐身守侯 提交于 2020-01-05 09:35:14
问题 I'm trying to run nosetests in web2py using suite and outputing with xunit, it creates the xml files but even if the console shows that there were errors, but, they are not been written in the xml file The .py script: suite = TestLoader().loadTestsFromTestClass(globals()[strArchivo+strDirectorio]) noseargs = ['fake','--processes=0','v=0','--process-timeout=60', '--with-xunit', '--xunit-file=applications/output.xml','--verbosity=0'] nose.run(argv = noseargs,suite = suite) The console output:

Changing verbose report format for nosetests

≡放荡痞女 提交于 2020-01-03 17:45:12
问题 I am running my tests using nosetests in verbose mode: .... test_cache_region (tests.test_sysutil.TestCachedMethodDecorator) ... ok test_expire (tests.test_sysutil.TestCachedMethodDecorator) ... ok test_lru (tests.test_sysutil.TestCachedMethodDecorator) ... ok test_max_capacity (tests.test_sysutil.TestCachedMethodDecorator) ... ok test_DecimalJSONEncoder (tests.test_util.UtilTestCase) ... ok test_cdecimal_support (tests.test_util.UtilTestCase) ... ok test_ceil_with_ndigits (tests.test_util

Nose: How to skip tests by default?

烂漫一生 提交于 2020-01-03 10:48:10
问题 I am using Python's nose and I have marked some of my tests as "slow", as explained in the attrib plugin documentation. I would like to skip all "slow" Tests by default when running nosetests , i.e. without having to write nosetests -a '!slow' . But I want to be able to run these tests when explicitly running them or writing nosetests -a 'slow' . How can I achieve this? 回答1: "Options are the same as on the command line, with the -- prefix removed" (https://nose.readthedocs.org/en/latest/usage

Selenium Send Keys Slow in IE9/10/11 Windows 7 64Bit (32bit IEServer)

随声附和 提交于 2020-01-03 02:48:12
问题 Running Selenium Tests via Python 2.7.9 or C# app I'm getting really slow character input into text fields. Elsewhere I have seen the fix of using the 32bit IEDriver.exe but this hasn't fixed the issue for me. I've also tried with 'protected mode' all set to on and off. As you can see in the image below, all related processes are all in 32bit mode on this box. Has anyone fixed this please? Versions: Python 2.7.9, nose 1.3.4, selenium 2.45.0, IEDriver 2.35.3.0, Internet Explorer 9.0.8112.16421

Change names of tests created by nose test generators

走远了吗. 提交于 2019-12-30 02:18:09
问题 Nose has a bug - test names created by generators are not cached, so the error looks like it happened in the last test, not the actual test where it failed. I got around it following the solution in the bug report discussion, but it only works for names shown on stdout, not in the XML report (--with-xunit) from functools import partial, update_wrapper def testGenerator(): for i in range(10): func = partial(test) # make decorator with_setup() work again update_wrapper(func, test) func