Skip to content

Commit d4051f7

Browse files
author
Vasileios Karakasis
authored
Merge branch 'master' into feat/disable_old_settings
2 parents 12503d3 + 26da6e4 commit d4051f7

File tree

9 files changed

+55
-67
lines changed

9 files changed

+55
-67
lines changed

.github/linters/.flake8

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[flake8]
2+
select = F401

.github/workflows/main.yml

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -47,24 +47,15 @@ jobs:
4747
run: |
4848
docker run reframe:${{ matrix.modules-version }}
4949
50-
flake8:
51-
if: github.event_name == 'pull_request'
50+
unusedimports:
5251
runs-on: ubuntu-latest
5352
steps:
5453
- uses: actions/checkout@v2
5554
with:
5655
fetch-depth: 0
57-
- name: Changed Python Files
58-
run: |
59-
echo 'CHANGED_PYTHON_FILES<<EOF' >> $GITHUB_ENV
60-
git diff --name-only ${{ github.event.pull_request.base.sha }}..${{ github.sha }} | grep '.py' >> $GITHUB_ENV
61-
echo 'EOF' >> $GITHUB_ENV
62-
- uses: actions/setup-python@v2
63-
with:
64-
python-version: 3.8
65-
- name: Unused Imports Check
66-
run: |
67-
pip install flake8
68-
echo 'Checking Python Files:'
69-
for f in "$CHANGED_PYTHON_FILES"; do echo "$f"; done
70-
flake8 --select F401 $CHANGED_PYTHON_FILES
56+
- name: Lint Code Base
57+
uses: github/super-linter@v3
58+
env:
59+
VALIDATE_ALL_CODEBASE: false
60+
VALIDATE_PYTHON_FLAKE8: true
61+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
</a>
44

55
[![Build Status](https://github.com/eth-cscs/reframe/workflows/ReFrame%20CI/badge.svg)](https://github.com/eth-cscs/reframe/actions?query=workflow%3A%22ReFrame+CI%22)
6+
[![GitHub Super-Linter](https://github.com/eth-cscs/reframe/workflows/Lint%20Code%20Base/badge.svg)](https://github.com/marketplace/actions/super-linter)
67
[![Documentation Status](https://readthedocs.org/projects/reframe-hpc/badge/?version=latest)](https://reframe-hpc.readthedocs.io/en/latest/?badge=latest)
78
[![codecov.io](https://codecov.io/gh/eth-cscs/reframe/branch/master/graph/badge.svg)](https://codecov.io/github/eth-cscs/reframe)<br/>
89
![GitHub release (latest by date including pre-releases)](https://img.shields.io/github/v/release/eth-cscs/reframe?include_prereleases)

docs/manpage.rst

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -893,21 +893,6 @@ Here is an alphabetical list of the environment variables recognized by ReFrame:
893893
================================== ==================
894894

895895

896-
.. versionadded:: 3.3
897-
898-
.. envvar:: RFM_UNUSE_MODULE_PATHS
899-
900-
A colon-separated list of module paths to be unused before acting on any tests.
901-
902-
.. table::
903-
:align: left
904-
905-
================================== ==================
906-
Associated command line option :option:`--unuse-module-path`
907-
Associated configuration parameter :js:attr:`unuse_module_paths` general configuration parameter
908-
================================== ==================
909-
910-
911896
.. envvar:: RFM_USE_LOGIN_SHELL
912897

913898
Use a login shell for the generated job scripts.

reframe/frontend/cli.py

Lines changed: 32 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -737,34 +737,47 @@ def print_infoline(param, value):
737737
printer.debug(str(e))
738738
raise
739739

740+
def module_use(*paths):
741+
try:
742+
rt.modules_system.searchpath_add(*paths)
743+
except errors.EnvironError as e:
744+
printer.warning(f'could not add module paths correctly')
745+
printer.debug(str(e))
746+
747+
def module_unuse(*paths):
748+
try:
749+
rt.modules_system.searchpath_remove(*paths)
750+
except errors.EnvironError as e:
751+
printer.warning(f'could not remove module paths correctly')
752+
printer.debug(str(e))
753+
740754
printer.debug('(Un)using module paths from command line')
755+
module_paths = {}
741756
for d in options.module_paths:
742757
if d.startswith('-'):
743-
try:
744-
rt.modules_system.searchpath_remove(d[1:])
745-
except errors.EnvironError as e:
746-
printer.warning(
747-
f'could not remove module path {d} correctly; '
748-
f'skipping...'
749-
)
750-
printer.verbose(str(e))
758+
module_paths.setdefault('-', [])
759+
module_paths['-'].append(d[1:])
751760
elif d.startswith('+'):
752-
try:
753-
rt.modules_system.searchpath_add(d[1:])
754-
except errors.EnvironError as e:
755-
printer.warning(
756-
f'could not add module path {d} correctly; '
757-
f'skipping...'
758-
)
759-
printer.verbose(str(e))
761+
module_paths.setdefault('+', [])
762+
module_paths['+'].append(d[1:])
763+
else:
764+
module_paths.setdefault('x', [])
765+
module_paths['x'].append(d)
766+
767+
for op, paths in module_paths.items():
768+
if op == '+':
769+
module_use(*paths)
770+
elif op == '-':
771+
module_unuse(*paths)
760772
else:
761-
# Here we make sure that we don't try to remove an empty path
762-
# from the searchpath
773+
# First empty the current module path in a portable way
763774
searchpath = [p for p in rt.modules_system.searchpath if p]
764775
if searchpath:
765776
rt.modules_system.searchpath_remove(*searchpath)
766777

767-
rt.modules_system.searchpath_add(d)
778+
# Treat `A:B` syntax as well in this case
779+
paths = itertools.chain(*(p.split(':') for p in paths))
780+
module_use(*paths)
768781

769782
printer.debug('Loading user modules from command line')
770783
for m in site_config.get('general/0/user_modules'):

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from reframe import VERSION
99

1010
with open('README.md') as read_me:
11-
long_description = ''.join(read_me.readlines()[15:])
11+
long_description = ''.join(read_me.readlines()[16:])
1212

1313
setuptools.setup(
1414
name='ReFrame-HPC',

unittests/test_buildsystems.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
#
44
# SPDX-License-Identifier: BSD-3-Clause
55

6-
import abc
7-
import functools
86
import pytest
97

108
import reframe.core.buildsystems as bs

unittests/test_cli.py

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,14 @@
33
#
44
# SPDX-License-Identifier: BSD-3-Clause
55

6+
import contextlib
7+
import io
68
import itertools
79
import os
8-
import pathlib
910
import pytest
1011
import re
1112
import sys
12-
from contextlib import redirect_stdout, redirect_stderr, suppress
13-
from io import StringIO
1413

15-
import reframe.core.config as config
1614
import reframe.core.environments as env
1715
import reframe.core.logging as logging
1816
import reframe.core.runtime as rt
@@ -26,11 +24,11 @@ def run_command_inline(argv, funct, *args, **kwargs):
2624
sys.argv = argv
2725
exitcode = None
2826

29-
captured_stdout = StringIO()
30-
captured_stderr = StringIO()
27+
captured_stdout = io.StringIO()
28+
captured_stderr = io.StringIO()
3129
print(*sys.argv)
32-
with redirect_stdout(captured_stdout):
33-
with redirect_stderr(captured_stderr):
30+
with contextlib.redirect_stdout(captured_stdout):
31+
with contextlib.redirect_stderr(captured_stderr):
3432
try:
3533
with rt.temp_runtime(None):
3634
exitcode = funct(*args, **kwargs)
@@ -591,13 +589,13 @@ def test_unload_module(run_reframe, user_exec_ctx):
591589
assert returncode == 0
592590

593591

594-
def test_unuse_module_path(run_reframe, user_exec_ctx, monkeypatch):
592+
def test_unuse_module_path(run_reframe, user_exec_ctx):
595593
ms = rt.runtime().modules_system
596594
if ms.name == 'nomod':
597595
pytest.skip('no modules system found')
598596

599597
module_path = 'unittests/modules'
600-
monkeypatch.setenv('MODULEPATH', module_path)
598+
ms.searchpath_add(module_path)
601599
returncode, stdout, stderr = run_reframe(
602600
more_options=[f'--module-path=-{module_path}', '--module=testmod_foo'],
603601
config_file=fixtures.USER_CONFIG_FILE, action='run',
@@ -632,6 +630,9 @@ def test_overwrite_module_path(run_reframe, user_exec_ctx):
632630
pytest.skip('no modules system found')
633631

634632
module_path = 'unittests/modules'
633+
with contextlib.suppress(KeyError):
634+
module_path += f':{os.environ["MODULEPATH"]}'
635+
635636
returncode, stdout, stderr = run_reframe(
636637
more_options=[f'--module-path={module_path}', '--module=testmod_foo'],
637638
config_file=fixtures.USER_CONFIG_FILE, action='run',

unittests/test_pipeline.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
# SPDX-License-Identifier: BSD-3-Clause
55

66
import os
7-
import pathlib
87
import pytest
98
import re
109

@@ -14,8 +13,7 @@
1413
import reframe.utility.sanity as sn
1514
import unittests.fixtures as fixtures
1615
from reframe.core.exceptions import (BuildError, PipelineError, ReframeError,
17-
ReframeSyntaxError, PerformanceError,
18-
SanityError)
16+
PerformanceError, SanityError)
1917
from reframe.frontend.loader import RegressionCheckLoader
2018
from unittests.resources.checks.hellocheck import HelloTest
2119
from unittests.resources.checks.pinnedcheck import PinnedTest
@@ -827,7 +825,6 @@ def __init__(self, a, b):
827825

828826

829827
def test_registration_of_tests():
830-
import sys
831828
import unittests.resources.checks_unlisted.good as mod
832829

833830
checks = mod._rfm_gettests()

0 commit comments

Comments
 (0)