Skip to content

Conversation

@rsarm
Copy link
Contributor

@rsarm rsarm commented Sep 27, 2018

Closes #451.

@codecov-io
Copy link

codecov-io commented Sep 27, 2018

Codecov Report

Merging #480 into master will decrease coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            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
Impacted Files Coverage Δ
reframe/frontend/loader.py 93.87% <100%> (-0.47%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 917ed65...ae34e9c. Read the comment docs.

Copy link
Contributor

@vkarak vkarak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. We will need unit tests to avoid the bug reappearing.
  2. 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'

if node.module.startswith('reframe'):
if not node.module:
self._has_import = False
elif node.module.startswith('reframe'):
Copy link
Contributor

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

@vkarak vkarak merged commit b7aa320 into reframe-hpc:master Oct 2, 2018
@rsarm rsarm deleted the frontend/check-validation branch November 26, 2019 13:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants