Skip to content
Snippets Groups Projects
Commit 9bad8e2c authored by Joscha Schmiedt's avatar Joscha Schmiedt
Browse files

TST: Make NamedTemporaryFiles Windows-compatible

Don't open files twice (add delete=False, which causes file to not be opened)
parent 34dc48a5
No related branches found
No related tags found
2 merge requests!217TST: Make NamedTemporaryFiles Windows-compatible,!207Resolve "Failing unit tests on Windows"
Pipeline #58511 passed with warnings
......@@ -18,7 +18,7 @@
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#
from tempfile import NamedTemporaryFile
from unittest.mock import MagicMock, Mock, patch
from unittest.mock import patch
import pytest
import yaml
......@@ -33,7 +33,7 @@ def _temp_file_load(txt: str):
definition using load_definition from Crawler.
"""
definition = None
with NamedTemporaryFile() as f:
with NamedTemporaryFile(delete=False) as f:
f.write(txt.encode())
f.flush()
definition = load_definition(f.name)
......
......@@ -50,10 +50,10 @@ def _temp_file_load(txt: str):
definition using load_definition from Crawler.
"""
definition = None
with NamedTemporaryFile() as f:
with NamedTemporaryFile(delete=False) as f:
f.write(txt.encode())
f.flush()
definition = load_definition(f.name)
definition = load_definition(f.name)
return definition
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment