Skip to content

Commit f00f9ec

Browse files
authored
Merge pull request #403 from BoboTiG/fix-resource-leaks
Fix ResourceWarning: unclosed file in setup.py
2 parents 48b7014 + 1dec9dc commit f00f9ec

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

setup.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,15 @@
33
install_requires = ["execnet>=1.1", "pytest>=3.6.0", "pytest-forked", "six"]
44

55

6+
with open("README.rst") as f:
7+
long_description = f.read()
8+
69
setup(
710
name="pytest-xdist",
811
use_scm_version={"write_to": "xdist/_version.py"},
912
description="pytest xdist plugin for distributed testing"
1013
" and loop-on-failing modes",
11-
long_description=open("README.rst").read(),
14+
long_description=long_description,
1215
license="MIT",
1316
author="holger krekel and contributors",
1417

testing/acceptance_test.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -490,9 +490,8 @@ def pytest_sessionfinish(session):
490490
name = "worker"
491491
else:
492492
name = "master"
493-
f = open(name, "w")
494-
f.write("xy")
495-
f.close()
493+
with open(name, "w") as f:
494+
f.write("xy")
496495
# let's fail on the worker
497496
if name == "worker":
498497
raise ValueError(42)

testing/test_remote.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,6 @@ def test_repr_entry():
153153
for i in range(len(a_entries)):
154154
assert isinstance(rep_entries[i], ReprEntry)
155155
assert rep_entries[i].lines == a_entries[i].lines
156-
assert rep_entries[i].localssep == a_entries[i].localssep
157156
assert rep_entries[i].reprfileloc.lineno == a_entries[i].reprfileloc.lineno
158157
assert (
159158
rep_entries[i].reprfileloc.message == a_entries[i].reprfileloc.message

0 commit comments

Comments
 (0)