diff --git a/reframe/frontend/loader.py b/reframe/frontend/loader.py index c072330efb..5e48310a7f 100644 --- a/reframe/frontend/loader.py +++ b/reframe/frontend/loader.py @@ -21,7 +21,7 @@ def __init__(self): @property def valid(self): - return self._has_import and self._has_regression_test + return self._has_import def visit_Import(self, node): for m in node.names: @@ -29,21 +29,9 @@ def visit_Import(self, node): self._has_import = True def visit_ImportFrom(self, node): - if node.module.startswith('reframe'): + if node.module is not None and node.module.startswith('reframe'): self._has_import = True - def visit_ClassDef(self, node): - for b in node.bases: - try: - # Unqualified name as in `class C(RegressionTest)` - cls_name = b.id - except AttributeError: - # Qualified name as in `class C(rfm.RegressionTest)` - cls_name = b.attr - - if 'RegressionTest' in cls_name: - self._has_regression_test = True - class RegressionCheckLoader: def __init__(self, load_path, prefix='', diff --git a/unittests/resources/checks/bad/relative_imports.py b/unittests/resources/checks/bad/relative_imports.py new file mode 100644 index 0000000000..deba89b30b --- /dev/null +++ b/unittests/resources/checks/bad/relative_imports.py @@ -0,0 +1,7 @@ +# +# module to test reframe's loader with relative imports +# +from . import invalid_iterable +from .. import hellocheck +from .invalid_iterable import _get_checks +from ..hellocheck import HelloTest