unittest.TestCase.assertRaisesRegex throws DeprecationWarning

Uri Even-Chen uri at speedy.net
Tue Jul 31 15:35:12 EDT 2018


Hi,

We are using unittest.TestCase.assertRaisesRegex in our Django project
(Speedy Net / Speedy Match - https://github.com/urievenchen/speedy-net),
and I always prefer calling Python function parameters by name. So we call
self.assertRaisesRegex with parameters (keyword arguments)
expected_exception, expected_regex and callable - as documented on
https://docs.python.org/3/library/unittest.html#unittest.TestCase.assertRaisesRegex
. You can see our code on
https://github.com/urievenchen/speedy-net/blob/master/speedy/core/accounts/tests/test_models.py
. When I run tests regularly (with "./manage.py test") they pass, But when
I run tests with "python -W error::DeprecationWarning manage.py test",
(with Python 3.5.5), I receive errors like this:

DeprecationWarning: 'callable' is an invalid keyword argument for this
function

See the full errors here:
https://travis-ci.org/urievenchen/speedy-net/jobs/410482655 (by the way,
with Python 3.4.6 the tests pass).

Do you know what is the problem and why I receive these deprecation
warnings?

Thanks,
Uri.


*Uri Even-Chen*
[image: photo] Phone: +972-54-3995700
Email: uri at speedy.net
Website: http://www.speedysoftware.com/uri/en/
<http://www.facebook.com/urievenchen> <http://plus.google.com/+urievenchen>
<http://www.linkedin.com/in/urievenchen> <http://github.com/urievenchen>
<http://twitter.com/urievenchen>



More information about the Python-list mailing list