Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions test_reframe.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@
parser = argparse.ArgumentParser(
add_help=False,
usage='%(prog)s [REFRAME_OPTIONS...] [NOSE_OPTIONS...]')
parser.add_argument(
'--rfm-offline', action='store_true',
help='Skip unit tests that require Internet access'
)
parser.add_argument(
'--rfm-user-config', action='store', metavar='FILE',
help='Config file to use for native unit tests.'
Expand All @@ -47,6 +51,7 @@

test_util.USER_CONFIG_FILE = user_config
test_util.USER_SYSTEM = options.rfm_user_system
test_util.OFFLINE = options.rfm_offline
test_util.init_runtime()

# If no positional argument is specified, use the `unittests` directory,
Expand Down
5 changes: 5 additions & 0 deletions unittests/test_ci.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
from reframe.core.exceptions import ReframeError
from reframe.frontend.loader import RegressionCheckLoader

import unittests.utility as test_util


def _generate_test_cases(checks):
return dependencies.toposort(
Expand All @@ -30,6 +32,9 @@ def hello_test():


def test_ci_gitlab_pipeline():
if test_util.OFFLINE:
pytest.skip('offline tests requested')

loader = RegressionCheckLoader([
'unittests/resources/checks_unlisted/deps_complex.py'
])
Expand Down
3 changes: 3 additions & 0 deletions unittests/test_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -769,6 +769,9 @@ def validate(self):


def test_sourcesdir_git(local_exec_ctx):
if test_util.OFFLINE:
pytest.skip('offline tests requested')

@test_util.custom_prefix('unittests/resources/checks')
class MyTest(rfm.RunOnlyRegressionTest):
sourcesdir = 'https://github.com/reframe-hpc/ci-hello-world.git'
Expand Down
3 changes: 3 additions & 0 deletions unittests/test_utility.py
Original file line number Diff line number Diff line change
Expand Up @@ -476,6 +476,9 @@ def test_git_repo_hash_no_git_repo(git_only, monkeypatch, tmp_path):


def test_git_repo_exists(git_only):
if test_util.OFFLINE:
pytest.skip('offline tests requested')

assert osext.git_repo_exists('https://github.com/reframe-hpc/reframe.git',
timeout=10)
assert not osext.git_repo_exists('reframe.git', timeout=10)
Expand Down
3 changes: 3 additions & 0 deletions unittests/utility.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@
USER_CONFIG_FILE = None
USER_SYSTEM = None

# Skip unit tests requiring Internet access
OFFLINE = False


def init_runtime():
site_config = config.load_config('unittests/resources/config/settings.py')
Expand Down
Loading