oscap-anaconda-addon/SOURCES/oscap-anaconda-addon-1.2.1-no_tmp_path-PR_161.patch
2021-09-09 23:24:09 +00:00

33 lines
1.3 KiB
Diff

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