Fix not closed files handlers
@@ -26,7 +26,8 @@ def test_jinja2_time_extension(tmp_path):
changelog_file = os.path.join(project_dir, 'HISTORY.rst')
assert os.path.isfile(changelog_file)
- changelog_lines = Path(changelog_file).open(encoding='utf-8').readlines()
+ with Path(changelog_file).open(encoding='utf-8') as f:
+ changelog_lines = f.readlines()
expected_lines = [
'History\n',
@@ -57,6 +58,7 @@ def test_jinja2_uuid_extension(tmp_path):
changelog_file = os.path.join(project_dir, 'id')
assert os.path.isfile(changelog_file)
- changelog_lines = Path(changelog_file).open(encoding='utf-8').readlines()
+ with Path(changelog_file).open(encoding='utf-8') as f:
+ changelog_lines = f.readlines()
uuid.UUID(changelog_lines[0], version=4)
