Simple pytest plugin to look for regex in Exceptions
Project description
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-2014 Kiss György
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Close
Hashes for pytest_raisesregexp-2.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e30604b0ab449e8d1a5e03f46c69489d3c15741840d82cfa02e5ad30d5971a26 |
|
MD5 | 0d36266612ced412b828679b72f47fee |
|
BLAKE2b-256 | daefbd1a9b04fb1e2bb3b8fdb58d0144b4b94ba46f4a8c4f4422f7766ea57f19 |
Close
Hashes for pytest_raisesregexp-2.0-py2-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9edef6130d2cf3c0ca2e82d87b3661bdffe74705dba00ed81da53987f9304c86 |
|
MD5 | 8479cbd3688f7c23e8b9ce02790bbe24 |
|
BLAKE2b-256 | d907159f8203027a880a181bdfe4e189309a07920a568f97f766757963b778c5 |