Change strategy regarding #1332.

Instead of changing the directory separator globally, we change it only
when we generate/update the readme data file.
This commit is contained in:
funilrys 2020-07-13 15:34:28 +02:00
parent b8b067b6ab
commit abf763e9a0
No known key found for this signature in database
GPG Key ID: 0D8BFEF5515C00C6

View 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: