Skip to content

Commit

Permalink
Tests: Use pathlib for files read/write (test_generate_hooks.py)
Browse files Browse the repository at this point in the history
  • Loading branch information
insspb committed Jun 8, 2022
1 parent 8876b10 commit eb7930e
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions tests/test_generate_hooks.py
Expand Up @@ -2,6 +2,7 @@
import errno
import os
import sys
from pathlib import Path

import pytest

Expand Down Expand Up @@ -123,7 +124,7 @@ def test_run_failing_hook_removes_output_directory():

hook_path = os.path.join(hooks_path, 'pre_gen_project.py')

with open(hook_path, 'w') as f:
with Path(hook_path).open('w') as f:
f.write("#!/usr/bin/env python\n")
f.write("import sys; sys.exit(1)\n")

Expand Down Expand Up @@ -152,7 +153,7 @@ def test_run_failing_hook_preserves_existing_output_directory():

hook_path = os.path.join(hooks_path, 'pre_gen_project.py')

with open(hook_path, 'w') as f:
with Path(hook_path).open('w') as f:
f.write("#!/usr/bin/env python\n")
f.write("import sys; sys.exit(1)\n")

Expand Down

0 comments on commit eb7930e

Please sign in to comment.