From 25a4b558cd65c126ac8954b970670bbbdac63eb8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micka=C3=ABl=20Schoentgen?= Date: Sat, 1 Sep 2018 15:58:33 +0200 Subject: [PATCH 1/2] Fix 2 ResourceWarning: unclosed file, in tests --- tests/integration/test_install_twists.py | 7 ++++--- tests/integration/test_uninstall.py | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/tests/integration/test_install_twists.py b/tests/integration/test_install_twists.py index 8653e2c0..c9dded43 100644 --- a/tests/integration/test_install_twists.py +++ b/tests/integration/test_install_twists.py @@ -210,9 +210,10 @@ Requests = "==2.14.0" # Inline comment c = p.pipenv("install python_DateUtil") assert c.return_code == 0 assert "python-dateutil" in p.pipfile["packages"] - contents = open(p.pipfile_path).read() - assert "# Pre comment" in contents - assert "# Inline comment" in contents + with open(p.pipfile_path) as f: + contents = f.read() + assert "# Pre comment" in contents + assert "# Inline comment" in contents @pytest.mark.files diff --git a/tests/integration/test_uninstall.py b/tests/integration/test_uninstall.py index d1d08eb0..e19a1400 100644 --- a/tests/integration/test_uninstall.py +++ b/tests/integration/test_uninstall.py @@ -148,6 +148,7 @@ python_DateUtil = "*" # Inline comment c = p.pipenv("uninstall python_dateutil") assert "Requests" in p.pipfile["packages"] assert "python_DateUtil" not in p.pipfile["packages"] - contents = open(p.pipfile_path).read() - assert "# Pre comment" in contents - assert "# Inline comment" in contents + with open(p.pipfile_path) as f: + contents = f.read() + assert "# Pre comment" in contents + assert "# Inline comment" in contents From f2b50190e5a73f4c090ca0ed24cde1b9617620a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micka=C3=ABl=20Schoentgen?= Date: Sat, 1 Sep 2018 16:02:29 +0200 Subject: [PATCH 2/2] Add NEWs entry --- news/2808.trivial | 1 + 1 file changed, 1 insertion(+) create mode 100644 news/2808.trivial diff --git a/news/2808.trivial b/news/2808.trivial new file mode 100644 index 00000000..04c2f48b --- /dev/null +++ b/news/2808.trivial @@ -0,0 +1 @@ +Fix 2 ResourceWarning: unclosed file, in tests.