nosetests

Is there a gui for nosetests

I've been using nosetests for the last few months to run my Python unit tests. It definitely does the job but it is not great for giving a visual view of what tests are working or breaking. I've used several other GUI based unit test frameworks that provide a visual snap shot of the state of your unit tests as well as providing drill...

List all Tests Found by Nosetest

I use nosetests to run my unittests and it works well. I want to get a list of all the tests nostests finds without actually running them. Is there a way to do that? ...

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

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=P...

Problems using nose in a virtualenv.

I am unable to use nose (nosetests) in a virtualenv project - it can't seem to find the packages installed in the virtualenv environment. The odd thing is that i can set test_suite = 'nose.collector' in setup.py and run the tests just fine as python setup.py test but when running nosetests straight, there are all sorts of import e...

Coverage not showing executed lines in virtualenv

I have a project and I am trying to run nosetests with coverage. I am running in a virtualenv. When I run $ python setup.py nosetests The tests run fine but coverage is not showing that any code is executed (coverage is all 0%). Name Stmts Exec Cover Missing --------------------------------------...

Combining nosetests with contracts for Python

I'm using contracts for Python to specify preconditons/postconditions/invariants. I'm also using doctests for doing unit testing. I'd like to have all of my doctest unit tests run with contracts enabled, and I'd like to run my tests using nose. Unfortunately, if I run the tests with nose, it does not execute the pre/post/invariant asse...

Disabling Python nosetests

When using nosetests for Python it is possible to disable a unit test by setting the test function's __test__ attribute to false. I have implemented this using the following decorator: def unit_test_disabled(): def wrapper(func): func.__test__ = False return func return wrapper @unit_test_disabled def test_m...

How to use SQLite :memory: database in webpy for unittesting

I want to use a SQLite in memory (":memory:") DB for the tests in my webapp. I'm using nosetests for the tests, and webpy as framework. I want to populate the DB in the setup() function, and then run all my tests. My problem is that webpy closes all the open DB connections after each request, and the SQLite :memory: DB only lasts until ...

nose tests of Pylons app with models in init_model?

I have a stock Pylons app created using paster create -t pylons with one controller and matched functional test, added using paster controller, and a SQLAlchemy table and mapped ORM class. The SQLAlchemy stuff is defined in the init_model() function rather than in module scope (and needs to be there). Running python setup.py test raises...

Nose unable to find tests in ubuntu

Is there any reason why Nose wouldn't be able to find tests in Ubuntu 9.04? I'm using nose 0.11.1 with python 2.5.4. I can run tests only if I explicitly specify the filename. If I don't specify the filename it just says 0 tests. The same project runs tests fine on my Mac, so i'm quite stumped. ...

How to tell when nosetest is running programmatically

nosetest is the default test framework in Turbogeras 2.0. The application has a websetup.py module that initialise the database. I use mysql for my development and production environment and websetup works fine, but nosetest uses sqlite on memory and when it tries to initialise the DB sends an error: TypeError: SQLite Date, Time, a...

Configure "execute shell" scripts in Hudon with Python

I am using Hudson for continuous integration in out project. We are using python, git and nose tests for unit testing. What I need is that Hudson should execute nose tests after every build. For that I have added following shell scripts in under execute shell section. $ nosetests /sub/test_sample1.py $ nosetests /sub/test_sample2.py $ n...

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....

Any way to show error and backtrace with nosetests --pdb

Is there a way to get nosetests --pdb to automatically show you the error you're trying to debug, as well as a backtrace, BEFORE dumping you into pdb? i.e. instead of: awagner@hesse:/home/awagner/optimization/illumination_search$ nosetests --pdb test_bool_rep (optimization.illumination_search.test_subset_search.SubsetSearchTest) ... ok ...

"No source for code" message in Coverage.py

I ran a build last night, successfully. I got up this morning and ran another without changing any configuration or modifying any source code. Now my build is failing with the message "No source for code" when running my nosetests with coverage. NoSource: No source for code: '/home/matthew/.hudson/jobs/myproject/workspace/tests/unit/ut...

Nose Tests - File Uploads

Hi Stackoverflow, How would one go about testing a Pylons controller (using Nose Tests) that takes a file upload as a POST parameter? ...

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...

SUDS fails when run under nosetests

I am using SUDS to access a SOAP server. When I run the script directly, I have no problems. If I use nosetest to run the script, the connection to the server fails: Traceback (most recent call last): File "c:\python25\lib\site-packages\nose-0.11.3-py2.5.egg\nose\suite.py", line 197, in run self.setUp() File "c:\python25\lib\si...

Python process will not exit

Hi, 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? ...