nose

Suppressing Cherrypy's output when runing unit tests using Nose.

Hello, I'm using cherrypy to implement a web server and I use nose to run my unit tests. However, there is a lot of debug noise that nose catches and prints to stdout, even when I use the --nologcapture, particularly cherrypy's logging messages. That makes the testing output quite difficult to read. I've thought that: def setUp(self):...

Using Nose & NoseXUnit on a Python package

This is a previous post detailing a CI setup for Python. The asker and answerer detail the use of Nose and NoseXUnit with Hudson for their builds. However, NoseXUnit throws an error when run on any source folder where init.py is present: File "build/bdist.linux-x86_64/egg/nosexunit/tools.py", line 59, in packages nosexunit.except...

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 was wondering if there are any visual tools that wrap nose so that the feedback cleaner....

Why does Nose not see any of my environmental variables?

I'm just getting started using Nose and Nosetests and my tests are failing because Nose can't see the environmental variables. So far, the errors: AttributeError: 'Settings' object has no attribute 'DJANGO_SETTINGS_MODULE' I fixed this by exporting DJANGO_SETTINGS_MODULE from .bash_profile export DJANGO_SETTINGS_MODULE="settings" No...

How to run nosetests from netbeans?

I recently started using netbeans for python development and really like it. However, the test runner in netbeans does not run my doctests, nor does it run my test functions written using nose. I always have to switch to the shell and run 'setup.py test' or 'nosetests' manually. Is there a way to integrate this into netbenas 6.8? ...

How do I generate coverage xml report for a single package?

I'm using nose and coverage to generate coverage reports. I only have one package right now, ae, so I specify to only cover that: nosetests -w tests/unit --with-xunit --with-coverage --cover-package=ae And here are the results, which look good: Name Stmts Exec Cover Missing -----------------------------------------...

Why does nose finds tests in files with only 644 permission?

Today I ran a bunch of doctests using Python 2.6 on a Ubuntu 9.10 with nose : nosetests --with-doctest Ran 0 tests in 0.001s OK WTF? I had tests in that files, why didn't that work? I changed permission to 644: sudo chmod 644 * -R nosetests --with-doctest Ran 11 test in 0.004s FAILED (errors=1) Changing it back to 777: sudo chm...

Python unit-testing with nose: Making sequential tests

I am just learning how to do unit-testing. I'm on Python / nose / Wing IDE. (The project that I'm writing tests for is a simulations framework, and among other things it lets you run simulations both synchronously and asynchronously, and the results of the simulation should be the same in both.) The thing is, I want some of my tests to...

Why isn't django-nose running the doctests in my models?

I'm trying to use doctests with django-nose. All my doctests are running, except not any doctests within a model (unless it is abstract). class TestModel1(models.Model): """ >>> print 'pass' pass """ pass class TestModel2(models.Model): """ >>> print 'pass' pass """ class Meta: abstract ...

Unit testing authorization in a Pylons app fails; cookies aren't been correctly set or recorded

I'm having an issue running unit tests for authorization in a Pylons app. It appears as though certain cookies set in the test case may not be correctly written or parsed. Cookies work fine when hitting the app with a browser. Here is my test case inside a paste-generated TestController: def test_good_login(self): r = self.app.post...

How to use nose coverage with --timid flag

I'd like to run "nosetests --with-coverage" using Ned Batchelder's coverage module, but passing the coverage module the --timid flag. Is there a way (e.g. setting an environment variable) to make coverage run with --timid? ...

ImportError using nose, no ImportError using raw unittest ?

I get an ImportError when running my unittests using Nose and I don't when I just run it standalone. All files referred to here may be seen at http://gist.github.com/395541# . If I run the test script, importTest-Test.py, directly I get this output: C:\usr\x\data\src\Python\mmm>python importTest-Test.py In mmdb In BusinessLogic [] . -...

Python Nose Import Error

I can't seem to get the nose testing framework to recognize modules beneath my test script in the file structure. I've set up the simplest example that demonstrates the problem. I'll explain it below. Here's the the package file structure: ./__init__.py ./foo.py ./tests ./__init__.py ./test_foo.py foo.py contains: def dumb_tr...

Is it possible to make Nose only run tests which are sub-classes of TestCase or TestSuite (like unittest.main())

My test framework is currently based on a test-runner utility which itself is derived from the Eclipse pydev python test-runner. I'm switching to use Nose, which has many of the features of my custom test-runner but seems to be better quality code. My test suite includes a number of abstract test-classes which previously never ran. The ...

Getting tests to parallelize using nose in python

Hello, I have a directory with lots of .py files (say test_1.py, test_2.py and so on) Each one of them is written properly to be used with nose. So when I run nosetests script, it finds all the tests in all the .py files and executes them. I now want to parallelize them so that all the tests in all .py files are treated as being parall...

Is there a way to get python's nose module to work the same in __main__ and on the command line?

Hello, I'm not sure of how to get the nose module's __main__ handler to work. I have this at the end of my test module: if __name__ == "__main__": import nose nose.main() Which gives me: ---------------------------------------------------------------------- Ran 0 tests in 0.002s OK but it I run the same thing via the comm...

Using gaetestbed within virtualenv

I'd like to give GAE Testbed a try, but am running into the following error after completing the instructions on its homepage. $ nosetests --with-gae ... ImportError: No module named dev_appserver I've confirmed that this happens in both a virtualenv and outside of one. ...

Is it possible to run doctests using unit2

I recently switched from nose to the new unittest2 package for my python unit testing needs. It does everything I want, except from the fact that I can't get its "discover" command to recognize the doctests in my code - I still have to use nose to run them. Is this not implemented or is there something I'm missing here? ...

Nose: Capture script output as well as test output

If I put any print statements at the top of my module, not inside any class/function, nothing gets printed while running my test through nose. import os print 'hi' #---------------------------------------------------------------------- def make_shapes(canvas): """ Generates shapes. Needs a Canvas instance to add the shapes to ...

Is there a way to make freshen tests fail on undefined tests?

By default when I run a freshen scenario, which contains an undefined given/when/then clause, that test is simply marked as undefined. No further helpful message as to what actually isn't defined is given. Is there a way to change this behavior to get more information what exactly was undefined? ...