From f6ecaa9b7f33031d571cca44efa74a02e00dcff3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micka=C3=ABl=20Schoentgen?= Date: Mon, 14 Jan 2019 22:59:33 +0100 Subject: [PATCH 1/2] Fix ResourceWarning: unclosed file in setup.py MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Also uniformize the usage of the 'with' context manager. Signed-off-by: Mickaƫl Schoentgen --- setup.py | 5 ++++- testing/acceptance_test.py | 5 ++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/setup.py b/setup.py index b830492..03ee47a 100644 --- a/setup.py +++ b/setup.py @@ -3,12 +3,15 @@ from setuptools import setup, find_packages install_requires = ["execnet>=1.1", "pytest>=3.6.0", "pytest-forked", "six"] +with open("README.rst") as f: + long_description = f.read() + setup( name="pytest-xdist", use_scm_version={"write_to": "xdist/_version.py"}, description="pytest xdist plugin for distributed testing" " and loop-on-failing modes", - long_description=open("README.rst").read(), + long_description=long_description, license="MIT", author="holger krekel and contributors", author_email="pytest-dev@python.org,holger@merlinux.eu", diff --git a/testing/acceptance_test.py b/testing/acceptance_test.py index e0d4770..9a8e42b 100644 --- a/testing/acceptance_test.py +++ b/testing/acceptance_test.py @@ -490,9 +490,8 @@ def test_session_hooks(testdir): name = "worker" else: name = "master" - f = open(name, "w") - f.write("xy") - f.close() + with open(name, "w") as f: + f.write("xy") # let's fail on the worker if name == "worker": raise ValueError(42) From 1dec9dc246628af9934af5bfd64de299719d712d Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Mon, 14 Jan 2019 21:59:05 -0200 Subject: [PATCH 2/2] ReprEntry objects no longer have the `localssep` attribute The attribute was not used anywhere and has been removed in pytest-dev/pytest#4615 --- testing/test_remote.py | 1 - 1 file changed, 1 deletion(-) diff --git a/testing/test_remote.py b/testing/test_remote.py index 42b28a7..649739f 100644 --- a/testing/test_remote.py +++ b/testing/test_remote.py @@ -153,7 +153,6 @@ class TestReportSerialization: for i in range(len(a_entries)): assert isinstance(rep_entries[i], ReprEntry) assert rep_entries[i].lines == a_entries[i].lines - assert rep_entries[i].localssep == a_entries[i].localssep assert rep_entries[i].reprfileloc.lineno == a_entries[i].reprfileloc.lineno assert ( rep_entries[i].reprfileloc.message == a_entries[i].reprfileloc.message