Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I run a single test with Nose in Pylons

People also ask

Which command is used to run nose tests?

Basic Usage nose can be integrated with DocTest by using with-doctest option in athe bove command line. The result will be true if the test run is successful, or false if it fails or raises an uncaught exception. nose supports fixtures (setup and teardown methods) at the package, module, class, and test level.

What is nose python?

Nose is a popular test automation framework in Python that extends unittest to make testing easier. The other advantages of using the Nose framework are the enablement of auto discovery of test cases and documentation collection.

What is Django nose?

django-nose provides all the goodness of nose in your Django tests, like: Testing just your apps by default, not all the standard ones that happen to be in INSTALLED_APPS. Running the tests in one or more specific modules (or apps, or classes, or folders, or just running a specific test)


nosetests appname.tests.functional.test_controller should work, where the file is named test_controller.py.

To run a specific test class and method use a path of the form module.path:ClassNameInFile.method_name, that is, with a colon separating the module/file path and the objects within the file. module.path is the relative path to the file (e.g. tests/my_tests.py:ClassNameInFile.method_name).


For me using Nosetests 1.3.0 these variants are working (but make sure you have __init__.py in your tests folder):

nosetests [options] tests.ui_tests
nosetests [options] tests/ui_tests.py
nosetests [options] tests.ui_tests:TestUI.test_admin_page

Note that single colon between module name and class name.


I have to add the ".py" file extension, that is,

r'/path_to/my_file.py:' +  r'test_func_xy'

Maybe this is because I don't have any classes in the file. Without the .py, nose was complaining:

Can't find callable test_func_xy in file /path_to/my_file: file is not a python module

And this although I have an __init__.py in the folder /path_to/.