Skip to main content

Extra testing goodies for nose.tools

Project description

About

Extra testing goodies for nose.tools.

Adds an issues_warnings decorator, where tests must issue one of the expected warnings to pass (similar to nose.tools.raises for exceptions).

If installed on Python < 2.7 backports the new unittest.TestCase.assert* methods, and converts them to nose style assertions (spelled in PEP 8 fashion, so assert_equal rather than assertEqual):

  • assert_greater / assert_less / assert_greater_equal / assert_less_equal
  • assert_regexp_matches / assert_not_regexp_matches
  • assert_in / assert_not_in
  • assert_is / assert_is_not
  • assert_is_none / assert_is_not_none
  • assert_dict_contains_subset
  • and more….

Installation

To install nose_extra_tools run:

$ pip install nose_extra_tools

Usage examples

from nose_extra_tools import assert_in, issues_warnings

@issues_warnings(UserWarning, DeprecationWarning)
def test_issues_deprecation_warning():
    import warnings
    warnings.warn('This test passes')

@issues_warnings(Warning)
def test_forgot_to_issue_warning():
    pass

def test_backported_assert_in():
    assert_in(10, range(5))

Contribute

If you find any bugs, or wish to propose new features please let me know.

If you’d like to contribute, simply fork the repository, commit your changes and send a pull request. Make sure you add yourself to AUTHORS.

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_extra_tools, version 1.0.2
Filename, size File type Python version Upload date Hashes
Filename, size nose_extra_tools-1.0.2-py2-none-any.whl (4.4 kB) File type Wheel Python version 2.7 Upload date Hashes View
Filename, size nose_extra_tools-1.0.2.tar.gz (4.9 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page