Skip to content

Commit

Permalink
fix up tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Zylphrex committed Jan 6, 2023
1 parent d8add1b commit a9ffd5b
Showing 1 changed file with 7 additions and 12 deletions.
19 changes: 7 additions & 12 deletions tests/test_profiler.py
Expand Up @@ -26,6 +26,8 @@
sys.version_info < (3, 3), reason="Profiling is only supported in Python >= 3.3"
)

requires_gevent = pytest.mark.skipif(gevent is None, reason="gevent not enabled")


def process_test_sample(sample):
return [(tid, (stack, stack)) for tid, stack in sample]
Expand All @@ -34,10 +36,10 @@ def process_test_sample(sample):
@pytest.mark.parametrize(
"mode",
[
pytest.param("magic"),
pytest.param("foo"),
pytest.param(
"gevent",
marks=pytest.mark.skipif(gevent is None, reason="gevent not installed"),
marks=pytest.mark.skipif(gevent is not None, reason="gevent not enabled"),
),
],
)
Expand All @@ -51,10 +53,7 @@ def test_profiler_invalid_mode(mode, teardown_profiling):
[
pytest.param("thread"),
pytest.param("sleep"),
pytest.param(
"gevent",
marks=pytest.mark.skipif(gevent is None, reason="gevent not installed"),
),
pytest.param("gevent", marks=requires_gevent),
],
)
def test_profiler_valid_mode(mode, teardown_profiling):
Expand Down Expand Up @@ -284,7 +283,7 @@ def get_scheduler_threads(scheduler):
pytest.param(
GeventScheduler,
marks=[
pytest.mark.skipif(gevent is None, reason="gevent not installed"),
requires_gevent,
pytest.mark.skip(
reason="cannot find this thread via threading.enuerate()"
),
Expand Down Expand Up @@ -611,11 +610,7 @@ def test_thread_scheduler_single_background_thread(scheduler_class):
("scheduler_class",),
[
pytest.param(ThreadScheduler, id="thread scheduler"),
pytest.param(
GeventScheduler,
marks=pytest.mark.skipif(gevent is None, reason="gevent not installed"),
id="gevent scheduler",
),
pytest.param(GeventScheduler, marks=requires_gevent, id="gevent scheduler"),
],
)
def test_profile_processing(
Expand Down

0 comments on commit a9ffd5b

Please sign in to comment.