| 1 | # file scalene/scalene_profiler.py:375-378 |
| 2 | # lines [375, 376, 378] |
| 3 | # branches [] |
| 4 | |
| 5 | import pytest |
| 6 | from scalene.scalene_profiler import Scalene |
| 7 | |
| 8 | |
| 9 | @pytest.fixture |
| 10 | def scalene_cleanup(): |
| 11 | # Fixture to clean up any modifications made to the Scalene class |
| 12 | original_child_pids = Scalene.child_pids.copy() |
| 13 | yield |
| 14 | Scalene.child_pids = original_child_pids |
| 15 | |
| 16 | |
| 17 | def test_add_child_pid(scalene_cleanup): |
| 18 | # Test to ensure that add_child_pid adds a pid to the child_pids set |
| 19 | test_pid = 12345 |
| 20 | assert test_pid not in Scalene.child_pids |
| 21 | Scalene.add_child_pid(test_pid) |
| 22 | assert test_pid in Scalene.child_pids |