File: test_coverup_131.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 (22 lines) | stat: -rw-r--r-- 759 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
# file scalene/scalene_profiler.py:879-893
# lines [884]
# branches ['883->884']

import pytest
from scalene.scalene_profiler import Scalene

@pytest.fixture
def scalene_cleanup():
    # Store original state
    original_files_to_profile = Scalene._Scalene__files_to_profile.copy()
    yield
    # Restore original state after test
    Scalene._Scalene__files_to_profile = original_files_to_profile

def test_profile_this_code_without_files_to_profile(scalene_cleanup):
    # Ensure __files_to_profile is empty
    Scalene._Scalene__files_to_profile.clear()
    # Call the method with arbitrary arguments
    result = Scalene.profile_this_code("somefile.py", 10)
    # Assert that the result is True when __files_to_profile is empty
    assert result == True