mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-04-16 02:21:46 +04:00
Add test for tmp_env_file removal
This commit is contained in:
parent
a2ca862130
commit
9c9e8c1ac4
2 changed files with 49 additions and 2 deletions
|
|
@ -67,6 +67,7 @@ def install_environment(
|
|||
with open(env_yaml_path) as env_file:
|
||||
env_yaml = yaml_load(env_file)
|
||||
env_yaml['dependencies'] += additional_dependencies
|
||||
tmp_env_file = None
|
||||
try:
|
||||
with NamedTemporaryFile(
|
||||
suffix='.yml',
|
||||
|
|
@ -80,7 +81,7 @@ def install_environment(
|
|||
tmp_env_file.name, cwd=prefix.prefix_dir,
|
||||
)
|
||||
finally:
|
||||
if os.path.exists(tmp_env_file.name):
|
||||
if tmp_env_file and os.path.exists(tmp_env_file.name):
|
||||
os.remove(tmp_env_file.name)
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue