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

Add patching getcwd/getcwdb for nt #894

Merged
merged 1 commit into from
Oct 10, 2023

Conversation

mrbean-bremen
Copy link
Member

@mrbean-bremen mrbean-bremen commented Oct 9, 2023

Turns out that the fix for #892 actually worked, but with the concrete test code it failed under Windows in the CI because the current working dir was on another drive than C:.
The notation with a slash (or backslash) at the beginning of the path under Windows means that it uses the current drive. On creating the path, the current drive in the fake fs was used (which is C: by default) by calling getcwd in the fake fs, but importlib.util.spec_from_file_location used os.fspath that under Windows uses nt.getcwd instead of os.getcwd, which was not patched.
Patching nt.getcwd fixes this.

Tasks

  • Unit tests added that reproduce the issue or prove feature is working
  • Fix or feature added
  • Pre-commit CI shows no errors
  • Unit tests passing

- fixes Windows problem if called from fspath, if
  the real current drive is not C:
- fixes test for pytest-dev#892 under Windows
@mrbean-bremen mrbean-bremen merged commit 567480c into pytest-dev:main Oct 10, 2023
63 checks passed
@mrbean-bremen mrbean-bremen deleted the getcwd branch October 10, 2023 17:46
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

Successfully merging this pull request may close these issues.

1 participant