Skip to content

Commit ad37ce0

Browse files
author
Vasileios Karakasis
authored
Merge branch 'master' into feat/remove-depreated-attributes
2 parents 095e13e + a3942ab commit ad37ce0

File tree

6 files changed

+48
-5
lines changed

6 files changed

+48
-5
lines changed

.github/workflows/main.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,25 @@ jobs:
4646
- name: Run Unittests
4747
run: |
4848
docker run reframe:${{ matrix.modules-version }}
49+
50+
flake8:
51+
if: github.event_name == 'pull_request'
52+
runs-on: ubuntu-latest
53+
steps:
54+
- uses: actions/checkout@v2
55+
with:
56+
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

reframe/core/buildsystems.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -426,8 +426,9 @@ def emit_build_commands(self, environ):
426426
cmd_parts += [nvcc, *cppflags, *cxxflags, self.srcfile,
427427
'-o', executable, *ldflags]
428428
else:
429-
BuildSystemError('could not guess language of file: %s' %
430-
self.srcfile)
429+
raise BuildSystemError(
430+
f'could not guess language of file: {self.srcfile}'
431+
)
431432

432433
return [' '.join(cmd_parts)]
433434

reframe/frontend/cli.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616

1717
import reframe
1818
import reframe.core.config as config
19-
import reframe.core.environments as env
2019
import reframe.core.exceptions as errors
2120
import reframe.core.logging as logging
2221
import reframe.core.runtime as runtime

reframe/frontend/loader.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,11 @@
1010
import ast
1111
import collections.abc
1212
import inspect
13-
import io
1413
import os
1514

1615
import reframe.utility as util
1716
import reframe.utility.osext as osext
18-
from reframe.core.exceptions import NameConflictError, RegressionTestLoadError
17+
from reframe.core.exceptions import NameConflictError
1918
from reframe.core.logging import getlogger
2019

2120

unittests/test_buildsystems.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,3 +235,10 @@ def test_compiler_pick(lang):
235235
}
236236
assert ([f'{compilers[lang]} {build_system.srcfile} -o foo.x'] ==
237237
build_system.emit_build_commands(ProgEnvironment('testenv')))
238+
239+
240+
def test_singlesource_unknown_language():
241+
build_system = bs.SingleSource()
242+
build_system.srcfile = 'foo.bar'
243+
with pytest.raises(BuildSystemError, match='could not guess language'):
244+
build_system.emit_build_commands(ProgEnvironment('testenv'))

unittests/test_pipeline.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -457,6 +457,21 @@ def __init__(self):
457457
test.compile()
458458

459459

460+
def test_sourcepath_non_existent(local_exec_ctx):
461+
@fixtures.custom_prefix('unittests/resources/checks')
462+
class MyTest(rfm.CompileOnlyRegressionTest):
463+
def __init__(self):
464+
self.valid_prog_environs = ['*']
465+
self.valid_systems = ['*']
466+
467+
test = MyTest()
468+
test.setup(*local_exec_ctx)
469+
test.sourcepath = 'non_existent.c'
470+
test.compile()
471+
with pytest.raises(BuildError):
472+
test.compile_wait()
473+
474+
460475
def test_extra_resources(testsys_system):
461476
@fixtures.custom_prefix('unittests/resources/checks')
462477
class MyTest(HelloTest):

0 commit comments

Comments
 (0)