diff --git a/integrationtests/test_crawler_main.py b/integrationtests/test_crawler_main.py index 793dd6edab18eb03794bf8bd7c9e140047fc1b32..a2eebf4f04e195754eaf71dc5e829b6a77a4cc4b 100644 --- a/integrationtests/test_crawler_main.py +++ b/integrationtests/test_crawler_main.py @@ -18,6 +18,7 @@ # import logging +import tempfile from pathlib import Path @@ -49,7 +50,7 @@ def test_list_of_paths(clear_database, monkeypatch): monkeypatch.setattr(crawl, "_update_status_record", _mock_update_status_record) # mock SSS environment - monkeypatch.setenv("SHARED_DIR", "/tmp") + monkeypatch.setenv("SHARED_DIR", tempfile.gettempdir()) # We need only one dummy RT rt = db.RecordType(name="TestType").insert() diff --git a/src/caoscrawler/scanner.py b/src/caoscrawler/scanner.py index 6b4d7a12bb9102d46d3724b436be02756c60e88a..af1f4173e95827606a02979ddd6d7fcd9f133271 100644 --- a/src/caoscrawler/scanner.py +++ b/src/caoscrawler/scanner.py @@ -465,8 +465,8 @@ def scan_directory(dirname: Union[str, list[str]], crawler_definition_path: str, # TODO: needs to be covered somewhere else crawled_directory = dname - if not dir_structure_name and dname.endswith('/'): - if dname == '/': + if not dir_structure_name and dname.endswith(os.path.sep): + if dname == os.path.sep: # Crawling the entire file system dir_structure_name = "root" else: