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 -v' shows full path on Windows when pytest.ini is on substituted drive #7333

Closed
3 tasks done
thorstenkampe opened this issue Jun 7, 2020 · 4 comments · Fixed by #6523
Closed
3 tasks done
Labels
topic: collection related to the collection phase topic: reporting related to terminal output and user-facing messages and errors

Comments

@thorstenkampe
Copy link

thorstenkampe commented Jun 7, 2020

  • a detailed description of the bug or suggestion
  • platform win32 -- Python 3.8.3, pytest-5.4.3, py-1.8.1, pluggy-0.13.1
  • minimal example if possible

The subject says it all: pytest on Windows shows full path of the test file in verbose mode when there is a pytest.ini in the current directory and the directory is on a substituted drive:

> pwd
Path
----
F:\cygwin\home\thorsten\python\modules

> pytest -v
platform win32 -- Python 3.8.3, pytest-5.4.3, py-1.8.1, pluggy-0.13.1 -- f:\scoop\apps\python\current\python.exe
cachedir: .pytest_cache
rootdir: C:\data\flash drive\cygwin\home\thorsten\python\modules
collected 32 items

test_toolbox.py::test_assert_installed PASSED
test_toolbox.py::Test_get_version::test_1 PASSED
test_toolbox.py::Test_get_version::test_2 PASSED
> touch pytest.ini
> pytest -v
platform win32 -- Python 3.8.3, pytest-5.4.3, py-1.8.1, pluggy-0.13.1 -- f:\scoop\apps\python\current\python.exe
cachedir: .pytest_cache
rootdir: F:\cygwin\home\thorsten\python\modules, inifile: pytest.ini
collected 32 items

F:\cygwin\home\thorsten\python\modules\test_toolbox.py::test_assert_installed PASSED
F:\cygwin\home\thorsten\python\modules\test_toolbox.py::Test_get_version::test_1 PASSED
F:\cygwin\home\thorsten\python\modules\test_toolbox.py::Test_get_version::test_2 PASSED
@thorstenkampe
Copy link
Author

thorstenkampe commented Jun 7, 2020

One more observation: creating an empty pytest.ini changes the rootdir log line from rootdir: C:\data\flash drive\cygwin\home\thorsten\python\modules to rootdir: F:\cygwin\home\thorsten\python\modules. This reflects the fact that F: is a substituted drive:

> subst
F:\: => C:\data\flash drive

Changing the subject acccordingly.

@thorstenkampe thorstenkampe changed the title 'pytest -v' shows full path on Windows when pytest.ini exists 'pytest -v' shows full path on Windows when pytest.ini is on substituted drive Jun 7, 2020
@Zac-HD Zac-HD added topic: collection related to the collection phase topic: reporting related to terminal output and user-facing messages and errors labels Jun 8, 2020
@Zac-HD
Copy link
Member

Zac-HD commented Jun 8, 2020

What do you think it should display?

@thorstenkampe
Copy link
Author

thorstenkampe commented Jun 8, 2020

@Zac-HD pytest should display just the file name (as it does on Linux and when the test file is not on a substituted drive). For me it looks like the current path is incorrectly determined. I'm in F:\cygwin\home\thorsten\python\modules - not in C:\data\flash drive\cygwin\home\thorsten\python\modules (the latter is "mounted"/substituted to the former)

@nicoddemus
Copy link
Member

Thanks @thorstenkampe!

This will be fixed by #6523. 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: collection related to the collection phase topic: reporting related to terminal output and user-facing messages and errors
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants