Unable to use pytest from mapped network drive
See original GitHub issue- a detailed description of the bug or suggestion
Running
pyest --version
using PowerShell displays the pytest version when I’m in my home directory or any other local directory on my Windows machine. When Icd
into a mapped network drive (Q:\
) and runpyest --version
, I getPermissionError: [WinError 5] Access is denied: '.'
. I get the same error when I runpyest --version
inside as well as outside a virtual environment when I’m in a mapped network drive. - output of
pip list
from the virtual environment you are using
(env) PS Q:\Projects\Abhilash\Feeds> pip list
Package Version
------------------ -------
asn1crypto 0.24.0
astroid 2.2.5
atomicwrites 1.3.0
attrs 19.1.0
bcrypt 3.1.7
cffi 1.12.3
colorama 0.4.1
coverage 4.5.4
cryptography 2.7
importlib-metadata 0.20
isort 4.3.21
lazy-object-proxy 1.4.2
mccabe 0.6.1
more-itertools 7.2.0
packaging 19.1
paramiko 2.6.0
pip 19.0.3
pluggy 0.12.0
py 1.8.0
pycparser 2.19
pylint 2.3.1
pymssql 2.1.4
PyNaCl 1.3.0
pyparsing 2.4.2
pytest 5.1.2
pytest-cov 2.7.1
setuptools 40.8.0
six 1.12.0
typed-ast 1.4.0
wcwidth 0.1.7
wrapt 1.11.2
zipp 0.6.0
You are using pip version 19.0.3, however version 19.2.3 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip'
command.
- pytest and operating system versions
PS C:\Users\kishorea> pytest --version
This is pytest version 5.1.2, imported from c:\users\kishorea\appdata\local\programs\python\python37\lib\site-packages\pytest.py
setuptools registered plugins:
pytest-cov-2.7.1 at c:\users\kishorea\appdata\local\programs\python\python37\lib\site-packages\pytest_cov\plugin.py
PS C:\Users\kishorea>
PS C:\Users\kishorea> (Get-WMIObject win32_operatingsystem).name
Microsoft Windows 10 Enterprise|C:\WINDOWS|\Device\Harddisk0\Partition4
- minimal example if possible
PS C:\Users\kishorea> pytest --version
This is pytest version 5.1.2, imported from c:\users\kishorea\appdata\local\programs\python\python37\lib\site-packages\pytest.py
setuptools registered plugins:
pytest-cov-2.7.1 at c:\users\kishorea\appdata\local\programs\python\python37\lib\site-packages\pytest_cov\plugin.py
PS C:\Users\kishorea> q:
PS Q:\> pytest --version
Traceback (most recent call last):
File "c:\users\kishorea\appdata\local\programs\python\python37\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "c:\users\kishorea\appdata\local\programs\python\python37\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Users\kishorea\AppData\Local\Programs\Python\Python37\Scripts\pytest.exe\__main__.py", line 9, in <module>
File "c:\users\kishorea\appdata\local\programs\python\python37\lib\site-packages\_pytest\config\__init__.py", line 59, in main
config = _prepareconfig(args, plugins)
File "c:\users\kishorea\appdata\local\programs\python\python37\lib\site-packages\_pytest\config\__init__.py", line 195, in _prepareconfig
config = get_config(args, plugins)
File "c:\users\kishorea\appdata\local\programs\python\python37\lib\site-packages\_pytest\config\__init__.py", line 160, in get_config
args=args, plugins=plugins, dir=Path().resolve()
File "c:\users\kishorea\appdata\local\programs\python\python37\lib\pathlib.py", line 1151, in resolve
s = self._flavour.resolve(self, strict=strict)
File "c:\users\kishorea\appdata\local\programs\python\python37\lib\pathlib.py", line 202, in resolve
s = self._ext_to_normal(_getfinalpathname(s))
PermissionError: [WinError 5] Access is denied: '.'
PS Q:\>
Issue Analytics
- State:
- Created 4 years ago
- Comments:11 (5 by maintainers)
Top Results From Across the Web
Retrieving contents from a directory on a network drive ...
Just tested on my XP PC, Python 2.7, SMB share \\myshare os.listdir('\\\\myshare') # Fails with "WindowsError: [Error 53] The network path was not...
Read more >os.path.realpath on Windows resolves mapped network drives
relpath() fails if the target and start directories aren't on the same drive. Code that's creating a symlink in Windows has to handle...
Read more >Solved: Why is the Python script not able to read network
Solved: Hi All, I have written a python script which merely reads the file from the network drive. When I am running this...
Read more >access is denied error 5 for network drive mapping ?
I working on script running on sql server 2019 using python 3.10 . I have directory path \\192.168.7.9\Import\8 as mapped network drive and ......
Read more >running python script in visual code - network drives are not ...
on Windows 10, I have mapped network drives to several drive letters (M:\\ and G:\\ specifically), but for some reason, I can`t access...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
This will be fixed in pytest 6.0 because we are no longer resolving paths. 👍
A similar issue occurs on RAM disks (O:\ in this case):
This behavior seems to be described here: https://bugs.python.org/issue31842
Edit: Error occurs with: