Open yasirroni opened 1 year ago
hi @yasirroni , sorry I am late responding to this.
I don't have a windows device and generally restrict testing to Linux. Were you able to resolve this problem? If so, please share how.
I haven't been able to resolve it. The one package that I know can do something like that is jupytext
. I hope I can make a PR for windows later if I got the time.
I see. I don't think we can expect this to work on windows as documented, the best course of action for this case may be:
pytest --nbmake .
and add arguments for selecting your notebooks.Are you able to find a way to do this natively with powershell?
MWE that working:
pytest -c pyproject.toml --nbmake
with pyproject.toml
file:
[tool.pytest.ini_options]
testpaths = ["tests", "notebooks"]
But, if there is a .py
files in notebooks/
dir, it will also be tested by pytest
. I haven't know how to make all .py
on tests/
and .ipynb
in notebooks/
.
Don't forget to ignore checkpoints
:
[tool.pytest.ini_options]
testpaths = ["tests", "notebooks"]
norecursedirs = ["hooks", "*.egg", ".eggs", "dist", "build", "docs", ".tox", ".git", "__pycache__", ".ipynb_checkpoints"]
But, as far as I understand, pytest --nbmake -n=auto **/*ipynb
means that **/*ipynb
belongs to nbmake
parameters (not pytest
parameters)? If yes, implementing glob inside nbmake
and pass that to pytest
should be possible? #CMIIW
When you enter **/*ipynb
into the shell. It is expanded by the interpreter (on linux this is bash, on windows this is powershell).
Pytest and nbmake receive the output of the expanded **/*ipynb
(which is x.ipynb y.ipynb ...
)
If I'm correct, we shouldn't implement wildcards again in pytest/nbmake because it violates the single responsibility principle.
Are you able to share with me the output from pytest --nbmake --collect-only
?
We can use the collected names to form a selector.
platform win32 -- Python 3.8.10, pytest-7.2.0, pluggy-1.0.0
rootdir: PATH, configfile: pyproject.toml, testpaths: tests, notebooks
plugins: anyio-3.6.2, nbmake-1.3.5, cov-4.0.0, lazy-fixture-0.6.3, mock-3.10.0, xdist-3.1.0
collected 23 items
<Package tests>
<Module test_NAMEt.py>
<Function test_TESTNAME1>
<Function test_TESTNAME2>
<Function test_TESTNAME3>
<Function test_TESTNAME>
<NotebookFile notebooks/NOTEBOOK1.ipynb>
<NotebookItem >
<NotebookFile notebooks/NOTEBOOK2.ipynb>
<NotebookItem >
Note that I already separate my tests to testpaths: tests (for py files), notebooks (for ipynb files, no longer any py files)
This issue can be closed actually because config solve it. But, this issue could tell other users when they are using this package at the first time and see that bare pytest --nbmake -n=auto **/*ipynb
could not find any files, come here, understand that they need at least include config for windows user.
Describe the bug Run
pytest --nbmake -n=auto **/*ipynb
get no file in PowershellTo Reproduce Steps to reproduce the behavior:
pytest --nbmake -n=auto **/*ipynb
Expected behavior Works like in the doc
Desktop (please complete the following information):