Skip to content
Snippets Groups Projects
Commit 3ebadf37 authored by Florian Spreckelsen's avatar Florian Spreckelsen
Browse files

MAINT: Use platform-independent tmp and paths

parent c4d76f94
No related branches found
No related tags found
2 merge requests!217TST: Make NamedTemporaryFiles Windows-compatible,!208ENH: Allow crawler_main to operate on a list of paths
Pipeline #58715 passed
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
# #
import logging import logging
import tempfile
from pathlib import Path from pathlib import Path
...@@ -49,7 +50,7 @@ def test_list_of_paths(clear_database, monkeypatch): ...@@ -49,7 +50,7 @@ def test_list_of_paths(clear_database, monkeypatch):
monkeypatch.setattr(crawl, "_update_status_record", _mock_update_status_record) monkeypatch.setattr(crawl, "_update_status_record", _mock_update_status_record)
# mock SSS environment # mock SSS environment
monkeypatch.setenv("SHARED_DIR", "/tmp") monkeypatch.setenv("SHARED_DIR", tempfile.gettempdir())
# We need only one dummy RT # We need only one dummy RT
rt = db.RecordType(name="TestType").insert() rt = db.RecordType(name="TestType").insert()
......
...@@ -465,8 +465,8 @@ def scan_directory(dirname: Union[str, list[str]], crawler_definition_path: str, ...@@ -465,8 +465,8 @@ def scan_directory(dirname: Union[str, list[str]], crawler_definition_path: str,
# TODO: needs to be covered somewhere else # TODO: needs to be covered somewhere else
crawled_directory = dname crawled_directory = dname
if not dir_structure_name and dname.endswith('/'): if not dir_structure_name and dname.endswith(os.path.sep):
if dname == '/': if dname == os.path.sep:
# Crawling the entire file system # Crawling the entire file system
dir_structure_name = "root" dir_structure_name = "root"
else: else:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment