File: test_coverup_107.py

package info (click to toggle)
scalene 1.5.51-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 15,528 kB
  • sloc: cpp: 22,930; python: 13,403; javascript: 11,769; ansic: 817; makefile: 196; sh: 45
file content (23 lines) | stat: -rw-r--r-- 825 bytes parent folder | download
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:1828-1831
# lines [1828, 1829, 1831]
# branches []

import pytest
from scalene.scalene_profiler import Scalene

@pytest.fixture(scope="function")
def scalene_cleanup(monkeypatch):
    # Fixture to reset the state after the test
    # Store the original state
    original_state = getattr(Scalene, '_Scalene__initialized', False)
    yield
    # Restore the original state
    monkeypatch.setattr(Scalene, '_Scalene__initialized', original_state)

def test_set_initialized(scalene_cleanup, monkeypatch):
    # Set Scalene as not initialized
    monkeypatch.setattr(Scalene, '_Scalene__initialized', False)
    # Call the method to set Scalene as initialized
    Scalene.set_initialized()
    # Check if Scalene is now initialized
    assert getattr(Scalene, '_Scalene__initialized') == True