Skip to content

Commit f439abd

Browse files
author
Vasileios Karakasis
committed
Merge branch 'master' into tensorflow_test
2 parents b36ce0d + 47fc045 commit f439abd

File tree

9 files changed

+67
-7
lines changed

9 files changed

+67
-7
lines changed

cscs-checks/apps/jupyter/check_ipcmagic.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
import reframe as rfm
77

8-
from hpctestlib.sciapps.jupyter.ipcmagic import ipcmagic_check
8+
from hpctestlib.interactive.jupyter.ipcmagic import ipcmagic_check
99

1010

1111
@rfm.simple_test

cscs-checks/apps/spark/spark_check.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
import reframe as rfm
77

8-
from hpctestlib.data_analytics.spark.compute_pi import compute_pi_check
8+
from hpctestlib.data_analytics.spark.spark_checks import compute_pi_check
99

1010

1111
@rfm.simple_test

docs/hpctestlib.rst

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,15 @@ This is a collection of generic tests that you can either run out-of-the-box by
77
Scientific Applications
88
-----------------------
99

10-
.. automodule:: hpctestlib.apps.amber.nve
10+
.. automodule:: hpctestlib.sciapps.amber.nve
11+
:members:
12+
:show-inheritance:
13+
14+
15+
Data Analytics
16+
--------------
17+
18+
.. automodule:: hpctestlib.data_analytics.spark.spark_checks
1119
:members:
1220
:show-inheritance:
1321

@@ -21,9 +29,9 @@ Python
2129

2230

2331
Interactive Computing
24-
----------------------
32+
---------------------
2533

26-
.. automodule:: hpctestlib.apps.jupyter.ipcmagic
34+
.. automodule:: hpctestlib.interactive.jupyter.ipcmagic
2735
:members:
2836
:show-inheritance:
2937

hpctestlib/data_analytics/spark/compute_pi/__init__.py renamed to hpctestlib/data_analytics/spark/spark_checks.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class compute_pi_check(rfm.RunOnlyRegressionTest, pin_prefix=True):
3535

3636
#: Parameter encoding the variant of the test.
3737
#:
38-
#: :type:`str`
38+
#: :type: :class:`str`
3939
#: :values: ``['spark', 'pyspark']``
4040
variant = parameter(['spark', 'pyspark'])
4141

reframe/core/pipeline.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2203,6 +2203,26 @@ def skip_if(self, cond, msg=None):
22032203
if cond:
22042204
self.skip(msg)
22052205

2206+
def skip_if_no_procinfo(self, msg=None):
2207+
'''Skip test if no processor topology information is available.
2208+
2209+
This method has effect only if called after the ``setup`` stage.
2210+
2211+
:arg msg: A message explaining why the test was skipped.
2212+
If not specified, a default message will be used.
2213+
2214+
.. versionadded:: 3.9.1
2215+
'''
2216+
if not self.current_partition:
2217+
return
2218+
2219+
proc = self.current_partition.processor
2220+
pname = self.current_partition.fullname
2221+
if msg is None:
2222+
msg = f'no topology information found for partition {pname!r}'
2223+
2224+
self.skip_if(not proc.info, msg)
2225+
22062226
def __str__(self):
22072227
return "%s(name='%s', prefix='%s')" % (type(self).__name__,
22082228
self.name, self.prefix)

unittests/test_pipeline.py

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
from reframe.core.containers import _STAGEDIR_MOUNT
1818
from reframe.core.exceptions import (BuildError, PipelineError, ReframeError,
1919
PerformanceError, SanityError,
20-
ReframeSyntaxError)
20+
SkipTestError, ReframeSyntaxError)
2121

2222

2323
def _run(test, partition, prgenv):
@@ -1455,3 +1455,35 @@ def test_not_configured_container_platform(container_test, local_exec_ctx):
14551455

14561456
with pytest.raises(PipelineError):
14571457
_run(container_test(platform, 'ubuntu:18.04'), *local_exec_ctx)
1458+
1459+
1460+
def test_skip_if_no_topo(HelloTest, local_exec_ctx):
1461+
class MyTest(HelloTest):
1462+
skip_message = variable(str, type(None), value=None)
1463+
1464+
@run_after('setup')
1465+
def access_topo(self):
1466+
self.skip_if_no_procinfo(self.skip_message)
1467+
1468+
class EchoTest(rfm.RunOnlyRegressionTest):
1469+
valid_systems = ['*']
1470+
valid_prog_environs = ['*']
1471+
executable = 'echo'
1472+
sanity_patterns = sn.assert_true(1)
1473+
1474+
@run_before('setup')
1475+
def access_topo(self):
1476+
self.skip_if_no_procinfo()
1477+
1478+
# The test should be skipped, because the auto-detection has not run
1479+
t = MyTest()
1480+
with pytest.raises(SkipTestError, match='no topology.*information'):
1481+
_run(t, *local_exec_ctx)
1482+
1483+
# Re-run to test that the custom message is used
1484+
t.skip_message = 'custom message'
1485+
with pytest.raises(SkipTestError, match='custom message'):
1486+
_run(t, *local_exec_ctx)
1487+
1488+
# This test should run to completion without problems
1489+
_run(EchoTest(), *local_exec_ctx)

0 commit comments

Comments
 (0)