1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
|
# file scalene/scalene_profiler.py:1399-1405
# lines [1399, 1400, 1405]
# branches []
import os
import pytest
from scalene.scalene_profiler import Scalene
# Test function to cover the before_fork method
def test_before_fork(monkeypatch):
# Setup: Mock the stop_signal_queues method
monkeypatch.setattr(Scalene, 'stop_signal_queues', lambda: None)
# Test: Call the before_fork method
Scalene.before_fork()
# Verify: Since we mocked the method, we can't check the actual state, so we just ensure the method was called
# In a real test, we would need to check the actual state or use a more sophisticated mock
# No assertions are needed here as we are just testing that the method can be called without error
# Ensure that the test is only run when called by pytest and not during import
if __name__ == "__main__":
pytest.main([__file__])
|