mirror of
https://github.com/boykopovar/AnyPS5.git
synced 2026-11-07 13:39:55 +00:00
Merge pull request #7106 from emirplus/fix/select-tests-trailing-separator
fix(tools): handle trailing separators in select_tests root paths
This commit is contained in:
2 files changed
+14
-2
No files matched your search
@@ -101,11 +101,13 @@ class Build:
|
||||
|
||||
|
||||
def inside(path, root):
|
||||
return os.path.normcase(path).startswith(os.path.normcase(root) + os.sep)
|
||||
prefix = os.path.normcase(root).rstrip(os.sep) + os.sep
|
||||
return os.path.normcase(path).startswith(prefix)
|
||||
|
||||
|
||||
def relative(path, root):
|
||||
return path[len(root) + 1:].replace(os.sep, "/")
|
||||
root_len = len(root.rstrip(os.sep))
|
||||
return path[root_len + 1:].replace(os.sep, "/")
|
||||
|
||||
|
||||
def chunks(names):
|
||||
|
||||
@@ -129,6 +129,16 @@ class CaseInsensitivePathTests(unittest.TestCase):
|
||||
self.assertIsNone(build.repo(os.path.join(os.sep, "WORK", "SOURCE", "BUILD", "Generated.h")))
|
||||
self.assertEqual(build.key(os.path.join("tests", "MemoryPoolTest.exe")), build.key(os.path.join(os.sep, "WORK", "SOURCE", "BUILD", "TESTS", "memorypooltest.exe")))
|
||||
|
||||
def test_trailing_separator_in_root_is_handled(self):
|
||||
with mock.patch.object(select_tests.os.path, "normcase", str.lower):
|
||||
build = self.build()
|
||||
build.source = build.source + os.sep
|
||||
build.path = build.path + os.sep
|
||||
self.assertEqual(build.output(os.path.join(os.sep, "work", "source", "build", "tests", "MemoryPoolTest.exe")), "tests/MemoryPoolTest.exe")
|
||||
self.assertEqual(build.output(os.path.join("tests", "MemoryPoolTest.exe")), "tests/MemoryPoolTest.exe")
|
||||
self.assertEqual(build.repo(os.path.join(os.sep, "work", "source", "core", "libSceAgc", "Driver.cpp")), "core/libSceAgc/Driver.cpp")
|
||||
self.assertIsNone(build.repo(os.path.join(os.sep, "WORK", "SOURCE", "BUILD", "Generated.h")))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
Reference in new issue
Block a user