Change strategy regarding #1332.
authorfunilrys <redacted>
Mon, 13 Jul 2020 13:34:28 +0000 (15:34 +0200)
committerfunilrys <redacted>
Mon, 13 Jul 2020 13:35:16 +0000 (15:35 +0200)
Instead of changing the directory separator globally, we change it only
when we generate/update the readme data file.

testUpdateHostsFile.py

index 17c6edcb63f0322d03aee9c955fe2536d42c04e9..57a21f239f8d75b38f6e39106ad6871f8a691fe0 100644 (file)
@@ -64,7 +64,7 @@ class Base(unittest.TestCase):
     @property
     def sep(self):
         if platform.system().lower() == "windows":
-            return "/"
+            return "\\"
         return os.sep
 
     def assert_called_once(self, mock_method):
@@ -1125,12 +1125,13 @@ class TestUpdateReadmeData(BaseMockDir):
         )
         update_readme_data(self.readme_file, **kwargs)
 
+        if platform.system().lower() == "windows":
+            sep = "/"
+        else:
+            sep = self.sep
+
         expected = {
-            "base": {
-                "location": "foo" + self.sep,
-                "sourcesdata": "hosts",
-                "entries": 5,
-            },
+            "base": {"location": "foo" + sep, "sourcesdata": "hosts", "entries": 5},
             "foo": "bar",
         }
 
@@ -1147,8 +1148,13 @@ class TestUpdateReadmeData(BaseMockDir):
         )
         update_readme_data(self.readme_file, **kwargs)
 
+        if platform.system().lower() == "windows":
+            sep = "/"
+        else:
+            sep = self.sep
+
         expected = {
-            "base": {"location": "foo" + self.sep, "sourcesdata": "hosts", "entries": 5}
+            "base": {"location": "foo" + sep, "sourcesdata": "hosts", "entries": 5}
         }
 
         with open(self.readme_file, "r") as f:
@@ -1167,12 +1173,13 @@ class TestUpdateReadmeData(BaseMockDir):
         )
         update_readme_data(self.readme_file, **kwargs)
 
+        if platform.system().lower() == "windows":
+            sep = "/"
+        else:
+            sep = self.sep
+
         expected = {
-            "com-org": {
-                "location": "foo" + self.sep,
-                "sourcesdata": "hosts",
-                "entries": 5,
-            }
+            "com-org": {"location": "foo" + sep, "sourcesdata": "hosts", "entries": 5}
         }
 
         with open(self.readme_file, "r") as f:
git clone https://git.99rst.org/PROJECT