Skip to content

Unexpected behavior when passing relative paths to command line options #302

@rsarm

Description

@rsarm

A ModuleNotFoundError is thrown when passing check files or directories to the -c option if this is done from a directory that's not the base ~/reframe/.

:prgenv > reframe -c ulimit_check.py -l
Command line: /home/sarafael/.local/bin/reframe --config-file /home/sarafael/git/reframe/reframe/settings.py --system generic -c ulimit_check.py -l
Reframe version: 2.13-dev0
Launched by user: sarafael
Launched on host: sarafael-thinkpad
Reframe paths
=============
    Check prefix      : 
    Check search path : 'ulimit_check.py'
    Stage dir prefix  : /home/sarafael/reframe/cscs-checks/prgenv/stage/
    Output dir prefix : /home/sarafael/reframe/cscs-checks/prgenv/output/
    Logging dir       : /home/sarafael/reframe/cscs-checks/prgenv/logs
/home/sarafael/.local/bin/reframe: unexpected error: No module named 'ulimit_check'
Traceback (most recent call last):
  File "/home/sarafael/git/reframe/reframe/frontend/cli.py", line 324, in main
    checks_found = loader.load_all()
  File "/home/sarafael/git/reframe/reframe/frontend/loader.py", line 181, in load_all
    checks.extend(self.load_from_file(d))
  File "/home/sarafael/git/reframe/reframe/frontend/loader.py", line 150, in load_from_file
    return self.load_from_module(util.import_module_from_file(filename))
  File "/home/sarafael/git/reframe/reframe/utility/__init__.py", line 51, in import_module_from_file
    return importlib.import_module(module_name)
  File "/home/sarafael/software/anaconda3/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 978, in _gcd_import
  File "<frozen importlib._bootstrap>", line 961, in _find_and_load
  File "<frozen importlib._bootstrap>", line 948, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'ulimit_check'

Also, when passing to --config-file a path that starts with a . like ../../../config/cscs.py, reframe is replacing the /s by .s and is then looking for .........config.cscs.

../../../bin/reframe: could not load settings: could not load configuration file `../../../config/cscs.py': the 'package' argument is required to perform a relative import for '.........config.cscs'

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions