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

Removing tmp_dir test fixture in favor of pytest's tmp_path. #7129

Closed

Conversation

upsideon
Copy link

@upsideon upsideon commented Dec 1, 2022

Pull Request Check List

Resolves: #6934

These changes remove the custom tmp_dir test fixture in favor of pytest's built-in tmp_path fixture for creating temporary directories. Only test code has been updated, so there was no need to add additional tests or documentation.

  • Added tests for changed code.
  • Updated documentation for changed code.

@upsideon
Copy link
Author

upsideon commented Dec 1, 2022

It looks like the Windows builds are failing due to a failure in cloning this repository as you can see in the build log here. I don't believe this is caused by the changes in this pull request as it seems unrelated. Has this been seen before?

@upsideon upsideon force-pushed the remove-tmp-dir-fixture branch from 962f273 to 1d0c2fc Compare December 3, 2022 01:33
@radoering radoering force-pushed the remove-tmp-dir-fixture branch from 1d0c2fc to 9b0c020 Compare December 7, 2022 16:30
@radoering
Copy link
Member

It seems to be caused by the changes. See

poetry/tests/conftest.py

Lines 295 to 301 in 0ca8b7e

@pytest.fixture
def tmp_dir() -> Iterator[str]:
dir_ = tempfile.mkdtemp(prefix="poetry_")
yield Path(dir_).resolve().as_posix()
remove_directory(dir_, force=True)
and
def remove_directory(
path: Path | str, *args: Any, force: bool = False, **kwargs: Any
) -> None:
"""
Helper function handle safe removal, and optionally forces stubborn file removal.
This is particularly useful when dist files are read-only or git writes read-only
files on Windows.
Internally, all arguments are passed to `shutil.rmtree`.
"""

@radoering
Copy link
Member

Closing in favor of #7412

@radoering radoering closed this Apr 16, 2023
Copy link

github-actions bot commented Mar 3, 2024

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 3, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update tests to use tmp_path over tmp_dir
2 participants