Skip to content

Commit dc7e309

Browse files
committed
Replaced open/read/close logic with 'read_text' and added encoding to address EncodingWarning.
1 parent eebb121 commit dc7e309

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

distutils/tests/test_config.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""Tests for distutils.pypirc.pypirc."""
22

33
import os
4+
import pathlib
45
from distutils.tests import support
56

67
import pytest
@@ -91,12 +92,7 @@ def test_server_empty_registration(self):
9192
assert not os.path.exists(rc)
9293
cmd._store_pypirc('tarek', 'xxx')
9394
assert os.path.exists(rc)
94-
f = open(rc)
95-
try:
96-
content = f.read()
97-
assert content == WANTED
98-
finally:
99-
f.close()
95+
assert pathlib.Path(rc).read_text(encoding='utf-8') == WANTED
10096

10197
def test_config_interpolation(self):
10298
# using the % character in .pypirc should not raise an error (#20120)

0 commit comments

Comments
 (0)