Skip to content

Commit 7ce7756

Browse files
committed
Skip CInstrumenter tests explicitely
1 parent 3641fd6 commit 7ce7756

1 file changed

Lines changed: 8 additions & 10 deletions

File tree

test/test_scorep.py

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,6 @@
77
import sys
88
import pytest
99

10-
# All instrumenters (except dummy which isn't a real one)
11-
ALL_INSTRUMENTERS = ['profile', 'trace']
12-
if sys.version_info.major >= 3:
13-
ALL_INSTRUMENTERS.extend(['cProfile', 'cTrace'])
14-
1510

1611
def call(arguments, expected_returncode=0, env=None):
1712
"""
@@ -57,7 +52,13 @@ def requires_package(name):
5752
return pytest.mark.skipif(not has_package(name), reason='%s is required' % name)
5853

5954

60-
requires_python3 = pytest.mark.skipif(sys.version_info.major < 3, reason="not tested for python 2")
55+
cinstrumenter_skip_mark = pytest.mark.skipif(
56+
sys.version_info.major < 3, reason="CInstrumenter only available in Python 3")
57+
# All instrumenters (except dummy which isn't a real one)
58+
ALL_INSTRUMENTERS = ['profile', 'trace',
59+
pytest.param('cProfile', marks=cinstrumenter_skip_mark),
60+
pytest.param('cTrace', marks=cinstrumenter_skip_mark)]
61+
6162
foreach_instrumenter = pytest.mark.parametrize('instrumenter', ALL_INSTRUMENTERS)
6263

6364

@@ -276,7 +277,7 @@ def test_dummy(scorep_env):
276277
assert os.path.exists(scorep_env["SCOREP_EXPERIMENT_DIRECTORY"]), "Score-P directory exists for dummy test"
277278

278279

279-
@requires_python3
280+
@pytest.mark.skipif(sys.version_info.major < 3, reason="not tested for python 2")
280281
@foreach_instrumenter
281282
def test_numpy_dot(scorep_env, instrumenter):
282283
trace_path = get_trace_path(scorep_env)
@@ -297,9 +298,6 @@ def test_numpy_dot(scorep_env, instrumenter):
297298

298299
@foreach_instrumenter
299300
def test_threads(scorep_env, instrumenter):
300-
if instrumenter[0] == 'c' and sys.version_info.major < 3:
301-
pytest.skip("C extension class only implemented for Python3")
302-
303301
trace_path = get_trace_path(scorep_env)
304302

305303
std_out, std_err = call_with_scorep("cases/use_threads.py",

0 commit comments

Comments
 (0)