diff --git a/unittests/test_cfood_metadata.py b/unittests/test_cfood_metadata.py
index c606a0a1afcc15d48164694768bae02adfb0fc0b..b123f98584ba99ed4fec412732cb2bf536034a91 100644
--- a/unittests/test_cfood_metadata.py
+++ b/unittests/test_cfood_metadata.py
@@ -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)
diff --git a/unittests/test_crawler.py b/unittests/test_crawler.py
index e88ce454061fb268fa49e986f8392f71296beb07..ad69c6f57cbc8d48d194507d7c1aa79c9da7521b 100644
--- a/unittests/test_crawler.py
+++ b/unittests/test_crawler.py
@@ -824,9 +824,9 @@ def test_restricted_path(create_mock):
 
 
 def test_split_restricted_path():
-    assert ["el"] == split_restricted_path("/el")
-    assert ["el"] == split_restricted_path("/el/")
-    assert ["el", "el"] == split_restricted_path("/el/el")
+    assert ["el"] == split_restricted_path(os.path.sep + "el")
+    assert ["el"] == split_restricted_path(os.path.sep + "el" + os.path.sep)
+    assert ["el", "el"] == split_restricted_path(os.path.sep + "el" + os.path.sep + "el")
 
 
 # Filter the warning because we want to have it here and this way it does not hinder running
diff --git a/unittests/test_macros.py b/unittests/test_macros.py
index a87b633e8585a03431575426733cae6ba31b7acf..03fe0e665652bb12e204d76857771c1d064ec28a 100644
--- a/unittests/test_macros.py
+++ b/unittests/test_macros.py
@@ -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
 
 
diff --git a/unittests/test_scanner.py b/unittests/test_scanner.py
index 5cbbc63406ffb3f5ec1f9019ed7877d7880d7b69..120d804c7895b8411b4f051b6ac8a08495f71359 100644
--- a/unittests/test_scanner.py
+++ b/unittests/test_scanner.py
@@ -30,7 +30,7 @@ from functools import partial
 from pathlib import Path
 from tempfile import NamedTemporaryFile
 from unittest.mock import MagicMock, Mock, patch
-
+import os
 import linkahead as db
 import pytest
 import yaml
@@ -110,7 +110,7 @@ def test_record_structure_generation():
     assert len(subc[1]) == 0
 
     # The data analysis node creates one variable for the node itself:
-    assert subd[0]["DataAnalysis"] == "examples_article/DataAnalysis"
+    assert subd[0]["DataAnalysis"] == os.path.join("examples_article", "DataAnalysis")
     assert subc[0]["DataAnalysis"] is False
 
     subd = dbt.debug_tree[dircheckstr("DataAnalysis", "2020_climate-model-predict")]
@@ -128,9 +128,10 @@ def test_record_structure_generation():
     assert subd[0]["identifier"] == "climate-model-predict"
     assert subd[0]["Project"].__class__ == db.Record
 
-    assert subd[0]["DataAnalysis"] == "examples_article/DataAnalysis"
+    assert subd[0]["DataAnalysis"] == os.path.join("examples_article", "DataAnalysis")
     assert subc[0]["DataAnalysis"] is True
-    assert subd[0]["project_dir"] == "examples_article/DataAnalysis/2020_climate-model-predict"
+    assert subd[0]["project_dir"] == os.path.join(
+        "examples_article", "DataAnalysis", "2020_climate-model-predict")
     assert subc[0]["project_dir"] is False
 
     # Check the copy flags for the first level in the hierarchy:
diff --git a/unittests/test_utilities.py b/unittests/test_utilities.py
index 463e304a99161f2294e5d202611dcf0b829e2045..a9b052524957b6f8c1e0378e3153fc06f4f36806 100644
--- a/unittests/test_utilities.py
+++ b/unittests/test_utilities.py
@@ -20,22 +20,23 @@
 #
 
 import pytest
-
+from os.path import sep
 from caoscrawler.crawl import split_restricted_path
 from caoscrawler.utils import MissingImport, get_shared_resource_link
 
 
 def test_split_restricted_path():
     assert split_restricted_path("") == []
-    assert split_restricted_path("/") == []
-    assert split_restricted_path("test/") == ["test"]
-    assert split_restricted_path("/test/") == ["test"]
-    assert split_restricted_path("test/bla") == ["test", "bla"]
-    assert split_restricted_path("/test/bla") == ["test", "bla"]
-    assert split_restricted_path("/test1/test2/bla") == ["test1", "test2", "bla"]
-    assert split_restricted_path("/test//bla") == ["test", "bla"]
-    assert split_restricted_path("//test/bla") == ["test", "bla"]
-    assert split_restricted_path("///test//bla////") == ["test", "bla"]
+    assert split_restricted_path(f"{sep}") == []
+    assert split_restricted_path(f"test{sep}") == ["test"]
+    assert split_restricted_path(f"{sep}test{sep}") == ["test"]
+    assert split_restricted_path(f"test{sep}bla") == ["test", "bla"]
+    assert split_restricted_path(f"{sep}test{sep}bla") == ["test", "bla"]
+    assert split_restricted_path(f"{sep}test1{sep}test2{sep}bla") == ["test1", "test2", "bla"]
+    assert split_restricted_path(f"{sep}test{sep}{sep}bla") == ["test", "bla"]
+    assert split_restricted_path(f"{sep}{sep}test{sep}bla") == ["test", "bla"]
+    assert split_restricted_path(
+        f"{sep}{sep}{sep}test{sep}{sep}bla{sep}{sep}{sep}{sep}") == ["test", "bla"]
 
 
 def test_dummy_class():