Blame SOURCES/oscap-anaconda-addon-1.2.1-no_tmp_path-PR_161.patch

e53e7a
From 56ee09bf171e0311e970b6bbd8c4c6d1114aca60 Mon Sep 17 00:00:00 2001
e53e7a
From: Matej Tyc <matyc@redhat.com>
e53e7a
Date: Tue, 29 Jun 2021 23:44:28 +0200
e53e7a
Subject: [PATCH] Dont use the tmp_path fixture.
e53e7a
e53e7a
The rhel8 pytest doesn't know it yet,
e53e7a
so it shouldn't be in the RHEL8 branch.
e53e7a
---
e53e7a
 tests/test_data_fetch.py | 13 +++++++------
e53e7a
 1 file changed, 7 insertions(+), 6 deletions(-)
e53e7a
e53e7a
diff --git a/tests/test_data_fetch.py b/tests/test_data_fetch.py
e53e7a
index cfc56b9..3b18e1e 100644
e53e7a
--- a/tests/test_data_fetch.py
e53e7a
+++ b/tests/test_data_fetch.py
e53e7a
@@ -61,9 +61,10 @@ def test_unsupported_url():
e53e7a
     assert not data_fetch.can_fetch_from("aaaaa")
e53e7a
 
e53e7a
 
e53e7a
-def test_fetch_local(tmp_path):
e53e7a
-    source_path = pathlib.Path(__file__).absolute()
e53e7a
-    dest_path = tmp_path / "dest"
e53e7a
-    data_fetch.fetch_data("file://" + str(source_path), dest_path)
e53e7a
-    with open(dest_path, "r") as copied_file:
e53e7a
-        assert "This line is here and in the copied file as well" in copied_file.read()
e53e7a
+def test_fetch_local():
e53e7a
+    with tempfile.NamedTemporaryFile() as f:
e53e7a
+        dest_path = pathlib.Path(f.name)
e53e7a
+        source_path = pathlib.Path(__file__).absolute()
e53e7a
+        data_fetch.fetch_data("file://" + str(source_path), dest_path)
e53e7a
+        with open(dest_path, "r") as copied_file:
e53e7a
+            assert "This line is here and in the copied file as well" in copied_file.read()