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)
committerSimon Marchi <simon.marchi@efficios.com>
Thu, 31 Oct 2019 15:22:42 +0000 (11:22 -0400)
commit9191043554194636a244960eb0a49c59582a4fb6
treed1bc8c9733d1a2e4f73b0c84129239f562645764
parentc4f23e30bf67d2523163614bc9461d84cbe1ae80
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.025127 seconds and 4 git commands to generate.