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
16 changes: 2 additions & 14 deletions reframe/frontend/loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,29 +21,17 @@ 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:
if m.name.startswith('reframe'):
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='',
Expand Down
7 changes: 7 additions & 0 deletions unittests/resources/checks/bad/relative_imports.py
Original file line number Diff line number Diff line change
@@ -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