# Path: test/util.py
# def assert_never(x: NoReturn) -> NoReturn:
# def do_nothing():
# def busy_wait(duration):
# def walk_frames(frame: BaseFrame) -> Generator[BaseFrame, None, None]:
# def first(iterator: Iterator[T]) -> Optional[T]:
# T = TypeVar("T")
# 
# Path: test/low_level/util.py



import sys
import time
import pytest
from typing import Any
from ..util import busy_wait, flaky_in_ci
from .util import parametrize_setstatprofile




class CallCounter:
    def __init__(self) -> None:
        self.count = 0

    def __call__(self, *args: Any, **kwds: Any) -> Any:
        self.count += 1


@flaky_in_ci
@parametrize_setstatprofile
def test_100ms(setstatprofile):
    counter = CallCounter()
    setstatprofile(counter, 0.1)
    busy_wait(1.0)
    setstatprofile(None)
    assert 8 < counter.count < 12


@flaky_in_ci
@parametrize_setstatprofile
def test_10ms(setstatprofile):
    counter = CallCounter()
    setstatprofile(counter, 0.01)

# Path: test/util.py
# def assert_never(x: NoReturn) -> NoReturn:
# def do_nothing():
# def busy_wait(duration):
# def walk_frames(frame: BaseFrame) -> Generator[BaseFrame, None, None]:
# def first(iterator: Iterator[T]) -> Optional[T]:
# T = TypeVar("T")
# 
# Path: test/low_level/util.py



# Path: test/low_level/test_setstatprofile.py
import sys
import time
import pytest
from typing import Any
from ..util import busy_wait, flaky_in_ci
from .util import parametrize_setstatprofile





class CallCounter:
    def __init__(self) -> None:
        self.count = 0

    def __call__(self, *args: Any, **kwds: Any) -> Any:
        self.count += 1


@flaky_in_ci
@parametrize_setstatprofile
def test_100ms(setstatprofile):
    counter = CallCounter()
    setstatprofile(counter, 0.1)
    busy_wait(1.0)
    setstatprofile(None)
    assert 8 < counter.count < 12


@flaky_in_ci
@parametrize_setstatprofile
def test_10ms(setstatprofile):
    counter = CallCounter()
    setstatprofile(counter, 0.01)

    busy_wait(1.0)