Skip to content

Commit 76276d5

Browse files
authored
Merge pull request #1645 from carver/always-clean-tmp-package-directory
Package test: always delete temp dir
2 parents 59be468 + 02f30a2 commit 76276d5

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

scripts/release/test_package.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,13 @@ def install_wheel(venv_path, wheel_path, extras=tuple()):
3939

4040

4141
def test_install_local_wheel():
42-
temporary_dir = TemporaryDirectory()
43-
venv_path = create_venv(Path(temporary_dir.name))
44-
wheel_path = find_wheel(Path('.'))
45-
install_wheel(venv_path, wheel_path, extras=['p2p', 'trinity'])
46-
print("Installed", wheel_path.absolute(), "to", venv_path)
47-
print(f"Activate with `source {venv_path}/bin/activate`")
48-
input("Press enter when the test has completed. The directory will be deleted.")
49-
temporary_dir.cleanup()
42+
with TemporaryDirectory() as tmpdir:
43+
venv_path = create_venv(Path(tmpdir))
44+
wheel_path = find_wheel(Path('.'))
45+
install_wheel(venv_path, wheel_path, extras=['p2p', 'trinity'])
46+
print("Installed", wheel_path.absolute(), "to", venv_path)
47+
print(f"Activate with `source {venv_path}/bin/activate`")
48+
input("Press enter when the test has completed. The directory will be deleted.")
5049

5150

5251
if __name__ == '__main__':

0 commit comments

Comments
 (0)