Skip to content
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

ENH: Relocate contents in test_run.py to tests #176

Merged
merged 2 commits into from
Oct 19, 2023

Conversation

jhlegarreta
Copy link
Contributor

  • ENH: Add missing test for wm_cluster_remove_outliers.py script
  • ENH: Relocate contents in test_run.py to tests

Add missing test for `wm_cluster_remove_outliers.py` script.

Left behind in commit cf5ddd8.
Relocate contents in `test_run.py` to the appropriate tests:
- The file is removed, and thus removed from the scripts list in
  `setup.py`.
- The relocated contents are commented out as no testing data exists
  yet.

Allows tests to pass. Fixes:
```
==================================== ERRORS ====================================
_____________________ ERROR collecting testing/test_run.py _____________________
(...)
testing/test_run.py:17: in <module>
    wm_quality_control_tractography.main()
bin/wm_quality_control_tractography.py:56: in main
    exit()
/opt/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/_sitebuiltins.py:26: in __call__
    raise SystemExit(code)
E   SystemExit: None
------------------------------- Captured stdout --------------------------------
Importing whitematteranalysis package.
<wm_quality_control_tractography.py> Starting...
<wm_quality_control_tractography.py> Error: Input directory input_tractography/ does not exist.
```

raised for example in:
https://github.com/SlicerDMRI/whitematteranalysis/actions/runs/6499690724/job/17653542925?pr=157#step:6:849
@jhlegarreta
Copy link
Contributor Author

jhlegarreta commented Oct 12, 2023

PR #173 should be merged before this one.

Tests will still fail because there is an error unrelated to the tests and having to do with the version of setuptools conflicting, as
wma requires 44.0.0 and .github/workflows/test_package.yaml installs a newer version, resulting in:

_________________________ test_help_option[inprocess] __________________________

script_runner = <ScriptRunner inprocess>

    def test_help_option(script_runner):
        ret = script_runner.run(["harden_transform_with_slicer.py", "--help"])
>       assert ret.success
E       assert False
E        +  where False = <pytest_console_scripts.RunResult object at 0x7fbcc922b280>.success

bin/tests/test_harden_transform_with_slicer.py:6: AssertionError
----------------------------- Captured stdout call -----------------------------
# Running console script: ['harden_transform_with_slicer.py', '--help']
# Script return code: 1
# Script stdout:

# Script stderr:
Traceback (most recent call last):
  File "/opt/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/site-packages/pytest_console_scripts-1.4.1-py3.8.egg/pytest_console_scripts/__init__.py", line 319, in exec_script
    exec(compiled, {'__name__': '__main__'})
  File "/opt/hostedtoolcache/Python/3.8.18/x64/bin/harden_transform_with_slicer.py", line 4, in <module>
    __import__('pkg_resources').run_script('whitematteranalysis==0.3.0', 'harden_transform_with_slicer.py')
  File "/home/runner/.local/lib/python3.8/site-packages/pkg_resources/__init__.py", line 722, in run_script
    self.require(requires)[0].run_script(script_name, ns)
  File "/home/runner/.local/lib/python3.8/site-packages/pkg_resources/__init__.py", line 968, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/home/runner/.local/lib/python3.8/site-packages/pkg_resources/__init__.py", line 829, in resolve
    dist = self._resolve_dist(
  File "/home/runner/.local/lib/python3.8/site-packages/pkg_resources/__init__.py", line 875, in _resolve_dist
    raise VersionConflict(dist, req).with_context(dependent_req)
pkg_resources.ContextualVersionConflict: (setuptools 68.2.2 (/home/runner/.local/lib/python3.8/site-packages), Requirement.parse('setuptools==44.0.*'), {'whitematteranalysis'})

raised for exampled in
https://github.com/SlicerDMRI/whitematteranalysis/actions/runs/6499992828/job/17654460785?pr=176#step:5:823

This is addressed in
https://github.com/SlicerDMRI/whitematteranalysis/pull/157/files#diff-4d7c51b1efe9043e44439a949dfd92e5827321b34082903477fd04876edb7552R12

@jhlegarreta
Copy link
Contributor Author

Further test cases can be imported from PR #74 in a separate PR.

@ljod ljod merged commit 92d789f into SlicerDMRI:master Oct 19, 2023
0 of 4 checks passed
@jhlegarreta jhlegarreta deleted the RelocateTestRunScriptContents branch October 19, 2023 13:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants