-
Notifications
You must be signed in to change notification settings - Fork 117
[bugfix] Remove the validation of the name of the test's base classes #480
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Codecov Report
@@ Coverage Diff @@
## master #480 +/- ##
==========================================
- Coverage 91.37% 91.36% -0.01%
==========================================
Files 70 70
Lines 8796 8788 -8
==========================================
- Hits 8037 8029 -8
Misses 759 759
Continue to review full report at Codecov.
|
vkarak
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- We will need unit tests to avoid the bug reappearing.
- If you parse a file with a relative import, the validation crashes:
from . import foo./reframe.py: unexpected error: 'NoneType' object has no attribute 'startswith'
Traceback (most recent call last):
File "/users/karakasv/Devel/reframe/reframe/frontend/cli.py", line 359, in main
checks_found = loader.load_all()
File "/users/karakasv/Devel/reframe/reframe/frontend/loader.py", line 175, in load_all
checks.extend(self.load_from_file(d))
File "/users/karakasv/Devel/reframe/reframe/frontend/loader.py", line 141, in load_from_file
if not self._validate_source(filename):
File "/users/karakasv/Devel/reframe/reframe/frontend/loader.py", line 74, in _validate_source
validator.visit(source_tree)
File "/apps/common/UES/jenkins/SLES12/easybuild/software/Python-bare/3.6.5/lib/python3.6/ast.py", line 253, in visit
return visitor(node)
File "/apps/common/UES/jenkins/SLES12/easybuild/software/Python-bare/3.6.5/lib/python3.6/ast.py", line 261, in generic_visit
self.visit(item)
File "/apps/common/UES/jenkins/SLES12/easybuild/software/Python-bare/3.6.5/lib/python3.6/ast.py", line 253, in visit
return visitor(node)
File "/users/karakasv/Devel/reframe/reframe/frontend/loader.py", line 32, in visit_ImportFrom
if node.module.startswith('reframe'):
AttributeError: 'NoneType' object has no attribute 'startswith'
reframe/frontend/loader.py
Outdated
| if node.module.startswith('reframe'): | ||
| if not node.module: | ||
| self._has_import = False | ||
| elif node.module.startswith('reframe'): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would simply test as follows:
if node.module is not None and node.module.startswith('reframe'):
self._has_import = True
Closes #451.