| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
import pytest |
| 6 |
from scalene import scalene_profiler |
| 7 |
from unittest.mock import patch |
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
@pytest.fixture(scope="function") |
| 14 |
def scalene_cleanup(): |
| 15 |
|
| 16 |
yield |
| 17 |
|
| 18 |
with patch.object(scalene_profiler.Scalene, "stop", return_value=None): |
| 19 |
scalene_profiler.Scalene.stop() |
| 20 |
|
| 21 |
|
| 22 |
def test_scalene_stop(scalene_cleanup): |
| 23 |
|
| 24 |
with patch.object(scalene_profiler.Scalene, "start", return_value=None): |
| 25 |
scalene_profiler.Scalene.start() |
| 26 |
|
| 27 |
with patch.object(scalene_profiler.Scalene, "stop", return_value=None) as mock_stop: |
| 28 |
|
| 29 |
scalene_profiler.Scalene.stop() |
| 30 |
mock_stop.assert_called_once() |