Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

Nose-PyVersion
==============

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

[NAME][PYVERSION_SEPARATOR]py[MAJOR][MINOR]?[MICRO]?.py

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

somefile_py2.py
somefile_py27.py
somefile_py273.py

Files excluded for python version 2.7.3::

somefile_py3.py
somefile_py26.py
somefile_py271.py

Usage
-----

With setup.py
-------------

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

Example::

setup(
...
tests_require=['nose_pyversion'],
entry_points="""
[nose.plugins]
pyversion=nose_pyversion:PyVersion
"""

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

Example::

[nosetests]
with-pyversion=1
pyversion-separator=-


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

Using nose for tests::

setup(
...
test_suite='nose.collector'
...
)


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.

Source
------

The source is hosted on `http://github.com/danielholmstrom/nose-pyversion <http://github.com/danielholmstrom/nose-pyversion>`_.

License
-------

Nose-PyVersion is released under the MIT license.

.. toctree::

Metadata

Release files for Nose-PyVersion 0.1b1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for Nose-PyVersion 0.1b1
File Size Uploaded Provenance Actions
Nose-PyVersion-0.1b1.tar.gz 3.6 kB Without provenance Details for Nose-PyVersion-0.1b1.tar.gz

Release files / Nose-PyVersion-0.1b1.tar.gz

Download URL Nose-PyVersion-0.1b1.tar.gz
Size 3.6 kB
Tags Source
SHA-256 checksum
How to use checksums
7c6622749d0a863d2a4b1694b0d73d2e9e2db1fed1e340ccd3f0421d81dfa7e6
BLAKE2b-256 checksum
How to use checksums
5950b5106290f5a8c7f1918b35859946c2c4853675516467d99a758790e01d20
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for Nose-PyVersion 0.1b1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page