Skip to content

Commit

Permalink
Tests: Use pathlib for files read/write (test_generate_copy_without_r…
Browse files Browse the repository at this point in the history
…ender_override.py)
  • Loading branch information
insspb committed Jun 8, 2022
1 parent b40fb40 commit 14433e1
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions tests/test_generate_copy_without_render_override.py
@@ -1,5 +1,6 @@
"""Verify correct work of `_copy_without_render` context option."""
import os
from pathlib import Path

import pytest

Expand Down Expand Up @@ -62,33 +63,33 @@ def test_generate_copy_without_render_extensions():
assert 'test_copy_without_render-not-rendered' in dir_contents
assert 'test_copy_without_render-rendered' in dir_contents

with open('test_copy_without_render/README.txt') as f:
with Path('test_copy_without_render/README.txt').open() as f:
assert '{{cookiecutter.render_test}}' in f.read()

with open('test_copy_without_render/README.rst') as f:
with Path('test_copy_without_render/README.rst').open() as f:
assert 'I have been rendered!' in f.read()

with open(
with Path(
'test_copy_without_render/test_copy_without_render-rendered/README.txt'
) as f:
).open() as f:
assert '{{cookiecutter.render_test}}' in f.read()

with open(
with Path(
'test_copy_without_render/test_copy_without_render-rendered/README.rst'
) as f:
).open() as f:
assert 'I have been rendered' in f.read()

with open(
with Path(
'test_copy_without_render/'
'test_copy_without_render-not-rendered/'
'README.rst'
) as f:
).open() as f:
assert '{{cookiecutter.render_test}}' in f.read()

with open('test_copy_without_render/rendered/not_rendered.yml') as f:
with Path('test_copy_without_render/rendered/not_rendered.yml').open() as f:
assert '{{cookiecutter.render_test}}' in f.read()

with open(
with Path(
'test_copy_without_render/' 'test_copy_without_render-rendered/' 'README.md'
) as f:
).open() as f:
assert '{{cookiecutter.render_test}}' in f.read()

0 comments on commit 14433e1

Please sign in to comment.