Skip to content

Instantly share code, notes, and snippets.

@abelcheung
Last active January 7, 2021 11:09
Show Gist options
  • Save abelcheung/79a4ca62db3ebce0d2b42e8f697a12f2 to your computer and use it in GitHub Desktop.
Save abelcheung/79a4ca62db3ebce0d2b42e8f697a12f2 to your computer and use it in GitHub Desktop.
Pytest failure on using datadir fixture under Windows

This is bug report for pytest-datadir issue #36.

C:\Users\foobar\repo> pytest -k test_datadir -s tests\
========================================= test session starts =========================================
platform win32 -- Python 3.8.2, pytest-6.2.1, py-1.10.0, pluggy-0.13.1
rootdir: C:\Users\foobar\repo
plugins: datadir-1.3.1
collected 7 items / 6 deselected / 1 selected

tests\test_datadir.py E

=============================================== ERRORS ================================================
___________________________________ ERROR at setup of test_datadir ____________________________________
self = WindowsPath('M:/Temp'), strict = False

    def resolve(self, strict=False):
        """
        Make the path absolute, resolving all symlinks on the way and also
        normalizing it (for example turning slashes into backslashes under
        Windows).
        """
        if self._closed:
            self._raise_closed()
>       s = self._flavour.resolve(self, strict=strict)

c:\program files\python38\lib\pathlib.py:1172:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <pathlib._WindowsFlavour object at 0x0000000002E40AF0>, path = WindowsPath('M:/Temp')
strict = False

    def resolve(self, path, strict=False):
        s = str(path)
        if not s:
            return os.getcwd()
        previous_s = None
        if _getfinalpathname is not None:
            if strict:
                return self._ext_to_normal(_getfinalpathname(s))
            else:
                tail_parts = []  # End of the path after the first one not found
                while True:
                    try:
>                       s = self._ext_to_normal(_getfinalpathname(s))
E                       OSError: [WinError 1] Incorrect function: 'M:\\Temp'

c:\program files\python38\lib\pathlib.py:205: OSError
======================================= short test summary info =======================================
ERROR tests/test_datadir.py::test_datadir - OSError: [WinError 1] Incorrect function: 'M:\\Temp'
def test_datadir(datadir):
assert True
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment