tests: use assertRaisesRegex instead of assertRaises in test_stream_class.py
authorSimon Marchi <simon.marchi@efficios.com>
Tue, 29 Oct 2019 19:27:26 +0000 (15:27 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Fri, 1 Nov 2019 14:49:33 +0000 (10:49 -0400)
commitd5a22ce88b28f87cfcace263243510c1ad48b133
treead9da4ab2614945e144d9860eba9fee1eee902f1
parent969c1d8a5c653480fe295344fece03988d101662
tests: use assertRaisesRegex instead of assertRaises in test_stream_class.py

Using assertRaises is not very robust.  We can expect a ValueError to be
raised, but in reality the test can pass because a ValueError different
than the one we are expecting is raised, and we don't actually test what
we mean to.

Use assertRaisesRegex throughout test_stream_class.py, which validates
the exception message in addition to the type.

I have also updated a few exception messages in the process, where I
thought they could be made clearer.

Change-Id: I1419950521210e778fb49f7b92f6563c546f0150
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/2304
Tested-by: jenkins <jenkins@lttng.org>
src/bindings/python/bt2/bt2/stream_class.py
tests/bindings/python/bt2/test_stream_class.py
This page took 0.02443 seconds and 4 git commands to generate.