nose

How to run multiple python file in a folder one after another [duplicate]

那年仲夏 提交于 2019-12-04 08:16:05
This question already has answers here : Run all Python files in a directory (2 answers) Closed 3 years ago . I have around 20 python files. Each time I run these files in the terminal this form one after another : python a.py python b.py python c.py python d.py python e.py python f.py python g.py . . . (I have provided general file names here) This process takes lot of time. Is it possible to run these file together one after another through any script..? If possible, then how..? Please provide the code if possible... I came to know through few sites that, using bash script we can do that.. I

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

孤街浪徒 提交于 2019-12-04 08:07:35
问题 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

Python test framework with support of non-fatal failures

穿精又带淫゛_ 提交于 2019-12-04 07:27:55
I'm evaluating "test frameworks" for automated system tests; so far I'm looking for a python framework. In py.test or nose I can't see something like the EXPECT macros I know from google testing framework. I'd like to make several assertions in one test while not aborting the test at the first failure. Am I missing something in these frameworks or does this not work? Does anybody have suggestions for python test framworks usable for automated system tests? I was wanting something similar for functional testing that I'm doing using nose. I eventually came up with this: def raw_print(str, *args)

How do I run a single test with Nose in Pylons

醉酒当歌 提交于 2019-12-04 07:27:31
问题 I have a Pylons 1.0 app with a bunch of tests in the test/functional directory. I'm getting weird test results and I want to just run a single test. The nose documentation says I should be able to pass in a test name at the command line but I get ImportErrors no matter what I do For example: nosetests -x -s sometestname Gives: Traceback (most recent call last): File "/home/ben/.virtualenvs/tsq/lib/python2.6/site-packages/nose-0.11.4-py2.6.egg/nose/loader.py", line 371, in loadTestsFromName

How to run nosetests without showing of my matplotlib's graph?

99封情书 提交于 2019-12-04 06:47:34
I try to run my test without any messages displaying from my main program. I only want verbose messages from nosetests to display. For example: nosetests -v --nologcapture All of my printout messages from my main program will be gone. However, the graph that I call in my main program ( plt.show() from matplotlib) still shows up. How do I run the tests without matplotlib's graph showing up? Jay Atkinson I assume that you're calling unittests on your code, so my recommendation would be for you to install the python Mock library. Any tests that will exercise the plt.show() function should mock it

What should a Python project structure look like for Travis CI to find and run tests?

徘徊边缘 提交于 2019-12-04 05:46:04
I currently have a project with the following .travis.yml file: language: python install: "pip install tox" script: "tox" Locally, tox properly executes and runs 35 tests, but on Travis CI, it runs 0 tests . More details: https://travis-ci.org/neverendingqs/pyiterable/builds/78954867 I also tried other ways, including: language: python python: - "2.6" - "2.7" - "3.2" - "3.3" - "3.4" - "3.5.0b3" - "3.5-dev" - "nightly" # also fails with just `nosetest` and no `install` step install: "pip install coverage unittest2" script: "nosetests --with-coverage --cover-package=pyiterable" They also could

nose framework command line regex pattern matching doesnt work(-e,-m ,-i)

佐手、 提交于 2019-12-04 05:18:37
The python nosetest framework has some command line options to include, exclude and match regex for tests which can be included/excluded and matched respectively. However they don't seem to be working correctly. [kiran@my_redhat test]$ nosetests -w cases/ -s -v -m='_size' ---------------------------------------------------------------------- Ran 0 tests in 0.001s OK [kiran@my_redhat test]$ grep '_size' cases/test_case_4.py def test_fn_size_sha(self): is there some thing wrong with regex matching semantics of nose framework? Nosetests' -m argument is used to match directories, filenames ,

Check that a function raises a warning with nose tests

非 Y 不嫁゛ 提交于 2019-12-04 04:40:20
I'm writing unit tests using nose , and I'd like to check whether a function raises a warning (the function uses warnings.warn ). Is this something that can easily be done? leoluk def your_code(): # ... warnings.warn("deprecated", DeprecationWarning) # ... def your_test(): with warnings.catch_warnings(record=True) as w: your_code() assert len(w) > 1 Instead of just checking the lenght, you can check it in-depth, of course: assert str(w.args[0]) == "deprecated" In python 2.7 or later, you can do this with the last check as: assert str(w[0].message[0]) == "deprecated" There are (at least) two

How can you suppress traces for failed test cases using Nose?

自作多情 提交于 2019-12-04 03:41:41
问题 I'm writing a test suit with nose, and would like failing cases to display an output like "FAILED: is_even(5): Not even" instead of the default output: ====================================================================== FAIL: seed_db.test_generator(5,) ---------------------------------------------------------------------- Traceback (most recent call last): File "/usr/local/lib/python2.7/dist-packages/nose/case.py", line 197, in runTest self.test(*self.arg) File "/home/apurcell/tests/prism

Excluding directory, module in python nosetest

∥☆過路亽.° 提交于 2019-12-04 02:46:55
问题 We use nose to discover tests and run them. All the tests are written in TestCase compatible way so any test runner can run the. Problem is we have some directories which doesn't have any test. But test runner continue to discover test from there. If one of those directory has lot of files its stuck. So how can I exclude that directory? Currently I am executing nosetests --processes=10 --verbosity 2 But there is a directory called scripts which takes ages to discover tests from it. So I want