Skip to content

PymatgenTest add auto-used tmp_path fixture (replaces ScratchDir) #3067

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

Merged
merged 9 commits into from
Jun 14, 2023

Conversation

janosh
Copy link
Member

@janosh janosh commented Jun 14, 2023

534af30 PymatgenTest add @pytest.fixture(autouse=True) def _tmp_dir(self, tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> None:
a189032 remove many no longer needed monty.tempfile.ScratchDir(".")

@shyuep It's a bit more magical since people who don't look at PymatgenTest won't know that their tests now run in a temporary directory by default due to this new fixture. But the code is cleaner now imo and less chance of failing tests leaving behind undeleted files in the repo that litter git status.

janosh added 2 commits June 14, 2023 08:04
    def _tmp_dir(self, tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> None:

make all tests run a in a temporary directory accessible via self.tmp_path
@janosh janosh added tests Issues with or changes to the pymatgen test suite housekeeping Moving around or cleaning up old code/files labels Jun 14, 2023
@janosh janosh enabled auto-merge (squash) June 14, 2023 07:42
@janosh janosh changed the title Pymatgen test autoused tmp path fixture PymatgenTest add auto-used tmp_path fixture (replaces ScratchDir) Jun 14, 2023
@janosh janosh merged commit a7b0b16 into master Jun 14, 2023
@janosh janosh deleted the PymatgenTest-autoused-tmp-path-fixture branch June 14, 2023 11:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
housekeeping Moving around or cleaning up old code/files tests Issues with or changes to the pymatgen test suite
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant