Skip to main content

Nose plugin for excluding files based on python version.

Project description


Nose-PyVersion is a plugin that excludes files from nosetests based on python filename and python version. It's useful for writing tests to test code which uses syntax that is invalid in certain python versions.

This plugins purpose is mainly to test syntax differences between python 2.x and 3.x.

Excluding files

Files are excluded based on filename. Files can be excluded for major, minor or micro version.

Filename pattern::


The default separator is '_', it can be changed with the option `pyversion-separator`, an empty separator is allowed.

.. note:: Some separators cannot be used beacuse it messes up nose. For example a dot, `.`, cannot be used as separator.

Files not excluded for python version 2.7.3::

Files excluded for python version 2.7.3::



Step 1: Add Nose-PyVersion to test_requires and tell nose how to find the plugin.



Step 2: Enable pyversion in setup.cfg. `pyversion-separator` can also be set(optional).



Now the tests can be run with ` nosetests`. If you want ` test` to use nose set `test_suite` to `nose.collector`.

Using nose for tests::


With standalone nosetests

Add '--with-pyversion':

nosetests -with-pyversion

.. note:: Running with standalone nosetests will fail if setup.cfg contains s `pyversion-separator` options. This is a bug that should be fixed but I don't know how.

Plugin options

Nose-PyVersion supports one configuration options, 'pyversion-separator'. That is the separator that is used to find files that should be excluded from tests.

Python versions

Nose-PyVersion supports python 2.7.3 and python 3.3 through `2to3`. Other versions are not tested.


The source is hosted on ` <>`_.


Nose-PyVersion is released under the MIT license.

.. toctree::

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for Nose-PyVersion, version 0.1b1
Filename, size File type Python version Upload date Hashes
Filename, size Nose-PyVersion-0.1b1.tar.gz (3.6 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page