skip to navigation
skip to content

pytest-raisesregexp 2.1

Simple pytest plugin to look for regex in Exceptions

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


class ExpectedException(Exception):

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

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


$ pip install pytest-raisesregexp

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

from pytest import raises_regexp


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

File Type Py Version Uploaded on Size
pytest-raisesregexp-2.1.tar.gz (md5) Source 2015-12-18 2KB
pytest_raisesregexp-2.1-py2-none-any.whl (md5) Python Wheel 2.7 2015-12-18 4KB