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

pytest exits with 1 due to "NotADirectoryError: [WinError 267] The directory name is invalid" #12964

Closed
2 of 4 tasks
yarikoptic opened this issue Nov 14, 2024 · 1 comment
Closed
2 of 4 tasks

Comments

@yarikoptic
Copy link

In dandi/dandi-cli#1509 we added a new test test_DownloadDirectory_basic, which on Windows does pass (2024-11-12T15:36:00.3595344Z dandi/tests/test_download.py::test_DownloadDirectory_basic PASSED) but then at the end of the process, but still while running other tests (?) we get following

2024-11-12T15:37:34.6100544Z dandi/tests/test_validate.py::test_validate_bids_errors[invalid_asl003] PASSED
2024-11-12T15:37:36.1230673Z Traceback (most recent call last):
2024-11-12T15:37:36.1241917Z   File "<frozen ntpath>", line 696, in realpath
2024-11-12T15:37:36.1244122Z NotADirectoryError: [WinError 267] The directory name is invalid: 'C:\\Users\\runneradmin\\AppData\\Local\\Temp\\pytest-of-runneradmin\\pytest-0\\test_DownloadDirectory_basiccurrent'
2024-11-12T15:37:36.1246057Z 
2024-11-12T15:37:36.1246708Z During handling of the above exception, another exception occurred:
2024-11-12T15:37:36.1247474Z 
2024-11-12T15:37:36.1247702Z Traceback (most recent call last):
2024-11-12T15:37:36.1248529Z   File "<frozen runpy>", line 198, in _run_module_as_main
2024-11-12T15:37:36.1249634Z   File "<frozen runpy>", line 88, in _run_code
2024-11-12T15:37:36.1250938Z   File "C:\hostedtoolcache\windows\Python\3.11.9\x64\Lib\site-packages\pytest\__main__.py", line 9, in <module>
2024-11-12T15:37:36.1252239Z     raise SystemExit(pytest.console_main())
2024-11-12T15:37:36.1252861Z                      ^^^^^^^^^^^^^^^^^^^^^
2024-11-12T15:37:36.1254208Z   File "C:\hostedtoolcache\windows\Python\3.11.9\x64\Lib\site-packages\_pytest\config\__init__.py", line 201, in console_main
2024-11-12T15:37:36.1255504Z     code = main()
2024-11-12T15:37:36.1255881Z            ^^^^^^
2024-11-12T15:37:36.1256970Z   File "C:\hostedtoolcache\windows\Python\3.11.9\x64\Lib\site-packages\_pytest\config\__init__.py", line 175, in main
2024-11-12T15:37:36.1258572Z     ret: ExitCode | int = config.hook.pytest_cmdline_main(config=config)
2024-11-12T15:37:36.1259453Z                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-11-12T15:37:36.1260777Z   File "C:\hostedtoolcache\windows\Python\3.11.9\x64\Lib\site-packages\pluggy\_hooks.py", line 513, in __call__
2024-11-12T15:37:36.1262301Z     return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
2024-11-12T15:37:36.1263285Z            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-11-12T15:37:36.1264637Z   File "C:\hostedtoolcache\windows\Python\3.11.9\x64\Lib\site-packages\pluggy\_manager.py", line 120, in _hookexec
2024-11-12T15:37:36.1266077Z     return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
2024-11-12T15:37:36.1266930Z            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-11-12T15:37:36.1268293Z   File "C:\hostedtoolcache\windows\Python\3.11.9\x64\Lib\site-packages\pluggy\_callers.py", line 139, in _multicall
2024-11-12T15:37:36.1269999Z     raise exception.with_traceback(exception.__traceback__)
2024-11-12T15:37:36.1271443Z   File "C:\hostedtoolcache\windows\Python\3.11.9\x64\Lib\site-packages\pluggy\_callers.py", line 103, in _multicall
2024-11-12T15:37:36.1272669Z     res = hook_impl.function(*args)
2024-11-12T15:37:36.1273236Z           ^^^^^^^^^^^^^^^^^^^^^^^^^
2024-11-12T15:37:36.1274508Z   File "C:\hostedtoolcache\windows\Python\3.11.9\x64\Lib\site-packages\_pytest\main.py", line 330, in pytest_cmdline_main
2024-11-12T15:37:36.1275831Z     return wrap_session(config, _main)
2024-11-12T15:37:36.1276404Z            ^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-11-12T15:37:36.1277627Z   File "C:\hostedtoolcache\windows\Python\3.11.9\x64\Lib\site-packages\_pytest\main.py", line 318, in wrap_session
2024-11-12T15:37:36.1278899Z     config.hook.pytest_sessionfinish(
2024-11-12T15:37:36.1280146Z   File "C:\hostedtoolcache\windows\Python\3.11.9\x64\Lib\site-packages\pluggy\_hooks.py", line 513, in __call__
2024-11-12T15:37:36.1281665Z     return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
2024-11-12T15:37:36.1282630Z            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-11-12T15:37:36.1284044Z   File "C:\hostedtoolcache\windows\Python\3.11.9\x64\Lib\site-packages\pluggy\_manager.py", line 120, in _hookexec
2024-11-12T15:37:36.1285498Z     return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
2024-11-12T15:37:36.1286358Z            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-11-12T15:37:36.1287409Z   File "C:\hostedtoolcache\windows\Python\3.11.9\x64\Lib\site-packages\pluggy\_callers.py", line 139, in _multicall
2024-11-12T15:37:36.1288182Z     raise exception.with_traceback(exception.__traceback__)
2024-11-12T15:37:36.1288941Z   File "C:\hostedtoolcache\windows\Python\3.11.9\x64\Lib\site-packages\pluggy\_callers.py", line 122, in _multicall
2024-11-12T15:37:36.1289680Z     teardown.throw(exception)  # type: ignore[union-attr]
2024-11-12T15:37:36.1290050Z     ^^^^^^^^^^^^^^^^^^^^^^^^^
2024-11-12T15:37:36.1290910Z   File "C:\hostedtoolcache\windows\Python\3.11.9\x64\Lib\site-packages\_pytest\logging.py", line 868, in pytest_sessionfinish
2024-11-12T15:37:36.1291593Z     return (yield)
2024-11-12T15:37:36.1291816Z             ^^^^^
2024-11-12T15:37:36.1292417Z   File "C:\hostedtoolcache\windows\Python\3.11.9\x64\Lib\site-packages\pluggy\_callers.py", line 122, in _multicall
2024-11-12T15:37:36.1293150Z     teardown.throw(exception)  # type: ignore[union-attr]
2024-11-12T15:37:36.1293522Z     ^^^^^^^^^^^^^^^^^^^^^^^^^
2024-11-12T15:37:36.1294207Z   File "C:\hostedtoolcache\windows\Python\3.11.9\x64\Lib\site-packages\_pytest\terminal.py", line 893, in pytest_sessionfinish
2024-11-12T15:37:36.1294909Z     result = yield
2024-11-12T15:37:36.1295115Z              ^^^^^
2024-11-12T15:37:36.1295689Z   File "C:\hostedtoolcache\windows\Python\3.11.9\x64\Lib\site-packages\pluggy\_callers.py", line 122, in _multicall
2024-11-12T15:37:36.1296402Z     teardown.throw(exception)  # type: ignore[union-attr]
2024-11-12T15:37:36.1296774Z     ^^^^^^^^^^^^^^^^^^^^^^^^^
2024-11-12T15:37:36.1297456Z   File "C:\hostedtoolcache\windows\Python\3.11.9\x64\Lib\site-packages\_pytest\warnings.py", line 141, in pytest_sessionfinish
2024-11-12T15:37:36.1298132Z     return (yield)
2024-11-12T15:37:36.1298337Z             ^^^^^
2024-11-12T15:37:36.1298916Z   File "C:\hostedtoolcache\windows\Python\3.11.9\x64\Lib\site-packages\pluggy\_callers.py", line 103, in _multicall
2024-11-12T15:37:36.1299573Z     res = hook_impl.function(*args)
2024-11-12T15:37:36.1299868Z           ^^^^^^^^^^^^^^^^^^^^^^^^^
2024-11-12T15:37:36.1300546Z   File "C:\hostedtoolcache\windows\Python\3.11.9\x64\Lib\site-packages\_pytest\tmpdir.py", line 311, in pytest_sessionfinish
2024-11-12T15:37:36.1301228Z     cleanup_dead_symlinks(basetemp)
2024-11-12T15:37:36.1301939Z   File "C:\hostedtoolcache\windows\Python\3.11.9\x64\Lib\site-packages\_pytest\pathlib.py", line 354, in cleanup_dead_symlinks
2024-11-12T15:37:36.1302764Z     if not left_dir.resolve().exists():
2024-11-12T15:37:36.1303065Z            ^^^^^^^^^^^^^^^^^^
2024-11-12T15:37:36.1303575Z   File "C:\hostedtoolcache\windows\Python\3.11.9\x64\Lib\pathlib.py", line 993, in resolve
2024-11-12T15:37:36.1488376Z     s = os.path.realpath(self, strict=strict)
2024-11-12T15:37:36.1488998Z         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-11-12T15:37:36.1490250Z   File "<frozen ntpath>", line 710, in realpath
2024-11-12T15:37:36.1490884Z   File "<frozen ntpath>", line 650, in _getfinalpathname_nonstrict
2024-11-12T15:37:36.1492267Z NotADirectoryError: [WinError 267] The directory name is invalid: 'C:\\Users\\runneradmin\\AppData\\Local\\Temp\\pytest-of-runneradmin\\pytest-0\\test_DownloadDirectory_basiccurrent'
2024-11-12T15:37:37.0246197Z dandi/tests/test_validate.py::test_validate_bids_errors[invalid_pet001] PASSED
2024-11-12T15:37:37.0261893Z ##[error]Process completed with exit code 1.

traceback dumped on us. Happens in other versions of pythons as well, only on Windows.

2024-11-12T15:34:25.0475124Z platform win32 -- Python 3.11.9, pytest-8.3.3, pluggy-1.5.0 -- C:\hostedtoolcache\windows\Python\3.11.9\x64\python.exe
2024-11-12T15:32:35.6448181Z Collecting pytest (from dandi==0.63.1+38.gccaccdfb)
2024-11-12T15:32:35.6597868Z   Downloading pytest-8.3.3-py3-none-any.whl.metadata (7.5 kB)
2024-11-12T15:32:35.7387646Z Collecting pytest-cov (from dandi==0.63.1+38.gccaccdfb)
2024-11-12T15:32:35.7436755Z   Downloading pytest_cov-6.0.0-py3-none-any.whl.metadata (27 kB)
2024-11-12T15:32:35.8270218Z Collecting pytest-mock (from dandi==0.63.1+38.gccaccdfb)
2024-11-12T15:32:35.8312504Z   Downloading pytest_mock-3.14.0-py3-none-any.whl.metadata (3.8 kB)
2024-11-12T15:32:35.8997748Z Collecting pytest-rerunfailures (from dandi==0.63.1+38.gccaccdfb)
2024-11-12T15:32:35.9054092Z   Downloading pytest_rerunfailures-14.0-py3-none-any.whl.metadata (18 kB)
2024-11-12T15:32:35.9739174Z Collecting pytest-timeout (from dandi==0.63.1+38.gccaccdfb)
2024-11-12T15:32:35.9781848Z   Downloading pytest_timeout-2.3.1-py3-none-any.whl.metadata (20 kB)
  • a detailed description of the bug or problem you are having
  • output of pip list from the virtual environment you are using
  • pytest and operating system versions
  • minimal example if possible
@RonnyPfannschmidt
Copy link
Member

This is a user error

Deleting the tmp path that pytest controls and putting a file there just breaks things

@The-Compiler The-Compiler closed this as not planned Won't fix, can't repro, duplicate, stale Nov 15, 2024
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

No branches or pull requests

3 participants