Closed Saransh-cpp closed 7 months ago
I'm also seeing in this in my CI builds. Are there any easy ways to resolve this via version pinning?
Looks as though the changes are likely due to pytest>=8.0
(released two days ago).
I have a patch in https://github.com/Erotemic/xdoctest/pull/150 that should handle pytest 8.x as well as previous versions. Will merge and release a new branch once CI passes. For now ensure pytest is < 8.0
.
I'm having issues getting the dashboards to work on windows. I've verified that it only happens with pytest 8.0 on windows other platforms seem fine.
https://github.com/Erotemic/xdoctest/actions/runs/7704989009/job/20998236140
It's just 2 tests that are failing, both having to do with running the pytest CLI: test_simple_pytest_cli
and test_simple_pytest_import_error_cli
. What these tests basically do is setup a dummy module in a temporary directory and then call pytest on it via the command line. For some reason on windows it no longer works. An example of the command it tries to run is:
C:\hostedtoolcache\windows\Python\3.12.1\x64\python.exe -m pytest -v -s --xdoctest-verbose=3 --xdoctest-supress-import-errors --xdoctest C:\Users\RUNNER~1\AppData\Local\Temp\tmpcttcs8zz
and pytest prints:
============================= test session starts =============================
platform win32 -- Python 3.12.1, pytest-8.0.0, pluggy-1.4.0 -- C:\hostedtoolcache\windows\Python\3.12.1\x64\python.exe
cachedir: .pytest_cache
rootdir: D:\a\xdoctest\xdoctest\testdir_py3.12_7704989009_Windows
plugins: cov-4.1.0, xdoctest-1.1.3
collecting ... collected 0 items
============================ no tests ran in 0.05s ============================
So it's not recognizing that the directory has a python file with a doctest in it. I'm wondering if the RUNNER~1
is causing an issue with windows short-vs-long paths. If I run dir
on the directory I get:
Volume in drive C is Windows
Volume Serial Number is 9CBA-7E40
Directory of C:\Users\RUNNER~1\AppData\Local\Temp\tmpcttcs8zz
01/30/2024 01:36 AM <DIR> .
01/30/2024 01:36 AM <DIR> ..
01/30/2024 01:36 AM 205 imperr_test_mod.py
1 File(s) 205 bytes
2 Dir(s) 80,790,720,512 bytes free
which seems fine.
For the other test, which calls pytest directly on a file, it gives this output and error:
============================= test session starts =============================
platform win32 -- Python 3.12.1, pytest-8.0.0, pluggy-1.4.0
rootdir: D:\a\xdoctest\xdoctest\testdir_py3.12_7704989009_Windows
plugins: cov-4.1.0, xdoctest-1.1.3
collected 0 items
============================ no tests ran in 0.06s ============================
ERROR: not found: C:\Users\RUNNER~1\AppData\Local\Temp\tmp31o2lm30\bokmdnkn.py
(no match in any of [<Dir Users>])
Which indicates to me pytest itself might be having a hard time resolving this short path.
If anyone has any ideas I could use some help on this.
I believe that I've been able to resolve the issue. It seems like ensuring that the tests use long paths intead of short paths resolves the issue. I made an issue in pytest to make them aware of the problem here: https://github.com/pytest-dev/pytest/issues/11895
But as far as xdoctest is concerned, everything should be good to go. I'm going to merge and make a release and the new version should fix most pytest 8.0 issues (unless you are using short paths on windows).
new release is live
Python version: all
xdoctest
throws an error in CI just at setup. This same CI pipeline was working fine the last week and no changes have been made since then. The error seems to be originating from withinxdoctest
.Command used:
See the failing logs for the complete error.
Stacktrace for a single doctest error: