tools: pytest version 7 throwing PytestRemovedIn8Warning because of py.path.local use in pytest_workflow
Description of the bug
Pytest is throwing an error that it didn’t do before in the Gitpod environment. No idea when the change happened though.
Command used and terminal output
Testing the seqkit-pair module, this is the error:
gitpod /workspace/modules (seqkit-pair) $ PROFILE=docker pytest --tag seqkit-pair --symlink --keep-workflow-wd
================================================================================================================================================ test session starts =================================================================================================================================================
platform linux -- Python 3.9.5, pytest-7.0.0, pluggy-1.0.0
rootdir: /workspace/modules
plugins: workflow-1.6.0
collecting ...
collected 633 items
tests/test_versions_yml.py sssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss [ 43%]
ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss [ 91%]
ssssssssssssssssssssssssssssssssssssssssssssssssssssssss [100%]
================================================================================================================================================== warnings summary ==================================================================================================================================================
../../opt/conda/lib/python3.9/site-packages/_pytest/nodes.py:140: 416 warnings
/opt/conda/lib/python3.9/site-packages/_pytest/nodes.py:140: PytestRemovedIn8Warning: The (fspath: py.path.local) argument to YamlFile is deprecated. Please use the (path: pathlib.Path) argument instead.
See https://docs.pytest.org/en/latest/deprecations.html#fspath-argument-for-node-constructors-replaced-with-pathlib-path
return super().__call__(*k, **kw)
-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
========================================================================================================================================= 633 skipped, 416 warnings in 4.82s =========================================================================================================================================
and testing the fastqc which didn’t have any problems before:
gitpod /workspace/modules (seqkit-pair) $ PROFILE=docker pytest --tag fastqc --symlink --keep-workflow-wd
================================================================================================================================================ test session starts =================================================================================================================================================
platform linux -- Python 3.9.5, pytest-7.0.0, pluggy-1.0.0
rootdir: /workspace/modules
plugins: workflow-1.6.0
collecting ...
collected 641 items
fastqc single-end:
command: nextflow run ./tests/modules/fastqc/ -entry test_fastqc_single_end -c ./tests/config/nextflow.config -c ./tests/modules/fastqc/nextflow.config -c ./tests/modules/fastqc/nextflow.config
directory: /tmp/pytest_workflow_m6wtmjgu/fastqc_single-end
stdout: /tmp/pytest_workflow_m6wtmjgu/fastqc_single-end/log.out
stderr: /tmp/pytest_workflow_m6wtmjgu/fastqc_single-end/log.err
'fastqc single-end' done.
fastqc paired-end:
command: nextflow run ./tests/modules/fastqc/ -entry test_fastqc_paired_end -c ./tests/config/nextflow.config -c ./tests/modules/fastqc/nextflow.config -c ./tests/modules/fastqc/nextflow.config
directory: /tmp/pytest_workflow_m6wtmjgu/fastqc_paired-end
stdout: /tmp/pytest_workflow_m6wtmjgu/fastqc_paired-end/log.out
stderr: /tmp/pytest_workflow_m6wtmjgu/fastqc_paired-end/log.err
'fastqc paired-end' done.
tests/test_versions_yml.py ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss..sssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss [ 42%]
ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss [ 90%]
ssssssssssssssssssssssssssssssssssssssssssssssssssssssss [ 98%]
tests/modules/fastqc/test.yml ........ [100%] Keeping temporary directories and logs. Use '--kwd' or '--keep-workflow-wd' to disable this behaviour.
================================================================================================================================================== warnings summary ==================================================================================================================================================
../../opt/conda/lib/python3.9/site-packages/_pytest/nodes.py:140: 416 warnings
/opt/conda/lib/python3.9/site-packages/_pytest/nodes.py:140: PytestRemovedIn8Warning: The (fspath: py.path.local) argument to YamlFile is deprecated. Please use the (path: pathlib.Path) argument instead.
See https://docs.pytest.org/en/latest/deprecations.html#fspath-argument-for-node-constructors-replaced-with-pathlib-path
return super().__call__(*k, **kw)
../../opt/conda/lib/python3.9/site-packages/pytest_workflow/plugin.py:391
/opt/conda/lib/python3.9/site-packages/pytest_workflow/plugin.py:391: UserWarning: .git dir detected: /workspace/modules/.git. pytest-workflow will copy the entire .git directory and all files ignored by git. It is recommended to use the --git-aware option.
warnings.warn(
-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
=================================================================================================================================== 10 passed, 631 skipped, 417 warnings in 36.15s ===================================================================================================================================
System information
No response
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 1
- Comments: 27 (27 by maintainers)
Yes, I tried that on Gitpod.
The
--git-awareflag insolves the
UserWarning: .git dir detected.I don’t exactly, but the message sounds to me like a
--git-awareflag should be added to the pytest call (wherever that is done).@mahesh-panchal This “failure” will manifest independent of Gitpod, so it might be good to title this issue something not Gitpod specific like “pytest version 7 throwing PytestRemovedIn8Warning because of py.path.local use in pytest_workflow”.
tl;dr: Unsurprisingly there’s still use of the old Python path handling. It is originating from pytest workflow 1.6 and will be resolved in the next release.
How to find out: Here’s a more useful pytest output (note the
-W errorto make warnings behave like errors producing tracebacks and the--tb=longto see the complete traceback):So the problem is in pytest wokflow which uses the
fspathinstead ofpathargument hereYamlFile.from_parent(parent, fspath=path)inpytest_workflow.plugin.pyon line 122. This has been fixed in the pytest workflow code - see this blame from this commit.This issue should be resolved once pytest workflow 1.7 is released and used in nextflow/Gitpod.
Have a nice day 😃
PS: not closing this issue just now, because the solution has not manifested here in nf-core, yet.
On the Gitpod: https://gitpod.io/#https://github.com/nf-core/modules/, and then open a terminal from the “Hamburger” icon (three dashes) in the top left.
Alternatively, locally, you can do:
And then to run the fastqc pytest, do: