diff options
Diffstat (limited to 'osprofiler/tests/test_profiler.py')
-rw-r--r-- | osprofiler/tests/test_profiler.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/osprofiler/tests/test_profiler.py b/osprofiler/tests/test_profiler.py index 13288e7..88b96d1 100644 --- a/osprofiler/tests/test_profiler.py +++ b/osprofiler/tests/test_profiler.py @@ -156,6 +156,18 @@ class WithTraceTestCase(test.TestCase): mock_stop.reset_mock() mock_stop.assert_called_once_with() + @mock.patch("osprofiler.profiler.stop") + @mock.patch("osprofiler.profiler.start") + def test_with_trace_etype(self, mock_start, mock_stop): + + def foo(): + with profiler.Trace("foo"): + raise ValueError("bar") + + self.assertRaises(ValueError, foo) + mock_start.assert_called_once_with("foo", info=None) + mock_stop.assert_called_once_with(info={"etype": "ValueError"}) + @profiler.trace("function", info={"info": "some_info"}) def tracede_func(i): |