File: test_coverup_103.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 (24 lines) | stat: -rw-r--r-- 871 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
24
# file scalene/scalene_profiler.py:895-897
# lines [895, 896, 897]
# branches []

import pytest
from scalene.scalene_profiler import Scalene

# Create a fixture to setup the Scalene for testing
@pytest.fixture
def scalene_profiler():
    # Setup code if necessary
    yield Scalene
    # Teardown code if necessary

def test_print_stacks(capsys, scalene_profiler):
    # Assuming __stats is accessible and has a stacks attribute.
    # If it's not accessible, the test needs to be adjusted accordingly.
    # For the purpose of this test, we will mock __stats.stacks
    scalene_profiler._Scalene__stats = type('', (), {})()  # Create a mock object for __stats
    scalene_profiler._Scalene__stats.stacks = ["stack1", "stack2"]
    scalene_profiler.print_stacks()
    captured = capsys.readouterr()
    assert "stack1" in captured.out
    assert "stack2" in captured.out