Skip to content

Commit cdb3b52

Browse files
committed
enhance test for run_pip_check to also test with unversioned_packages as tuple value
1 parent 5ec30b5 commit cdb3b52

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

test/easyblocks/easyblock_specific.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,25 @@ def mocked_run_shell_cmd_pip(cmd, **kwargs):
379379
with self.mocked_stdout_stderr():
380380
python.run_pip_check(python_cmd=sys.executable)
381381

382+
# test ignored of unversioned Python packages
383+
def mocked_run_shell_cmd_pip(cmd, **kwargs):
384+
if "pip check" in cmd:
385+
output = "No broken requirements found."
386+
elif "pip list" in cmd:
387+
output = '[{"name": "zero", "version": "0.0.0"}]'
388+
elif "pip --version" in cmd:
389+
output = "pip 20.0"
390+
else:
391+
# unexpected command
392+
return None
393+
394+
return RunShellCmdResult(cmd=cmd, exit_code=0, output=output, stderr=None, work_dir=None,
395+
out_file=None, err_file=None, cmd_sh=None, thread_id=None, task_id=None)
396+
397+
python.run_shell_cmd = mocked_run_shell_cmd_pip
398+
with self.mocked_stdout_stderr():
399+
python.run_pip_check(python_cmd=sys.executable, unversioned_packages=('zero', ))
400+
382401
# inject all possible errors
383402
def mocked_run_shell_cmd_pip(cmd, **kwargs):
384403
if "pip check" in cmd:

0 commit comments

Comments
 (0)