Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

simple raises_regexp plugin for pytest to exchange unittest.TestCase.assertRaisesRegexp

License

Notifications You must be signed in to change notification settings

kissgyorgy/pytest-raisesregexp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pytest-raisesregexp

travis Supported Python versions Latest Version MIT License Downloads Wheel package

I really missed assertRaisesRegexp in unittest module from pytest, so I wrote this simple plugin.

Usage

# some_module.py
class ExpectedException(Exception):
    pass

def function_to_test():
    raise ExpectedException('error message: 1560')
# test_some_module.py
from pytest import raises_regexp
from some_module import function_to_test, ExpectedException

def test_something_to_test():
    with raises_regexp(ExpectedException, r".* 1560"):
        function_to_test()

Installation

$ pip install pytest-raisesregexp

It installs as a pytest entry point, so you can:

from pytest import raises_regexp

LICENSE

MIT license Copyright (c) 2013-2015 Kiss György

About

simple raises_regexp plugin for pytest to exchange unittest.TestCase.assertRaisesRegexp

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published