Abacn commented on code in PR #41619:
URL: https://github.com/apache/beam/pull/41619#discussion_r4683230547
##########
sdks/python/apache_beam/io/localfilesystem_test.py:
##########
@@ -229,6 +230,35 @@ def test_match_directory_contents(self):
files = [f.path for f in result.metadata_list]
self.assertCountEqual(files, [path1, path2])
+ def test_match_glob_with_forward_slashes(self):
+ # On Windows, listed paths use '\', but a pattern may use '/'.
+ self.fs.mkdirs(os.path.join(self.tmpdir, 'data'))
+ for name in ['a.txt', 'b.txt', 'c.csv']:
+ open(os.path.join(self.tmpdir, 'data', name), 'a').close()
+
+ pattern = self.tmpdir.replace(os.sep, '/') + '/data/*.txt'
+ result = self.fs.match([pattern])[0]
+ files = [os.path.basename(f.path) for f in result.metadata_list]
+ self.assertCountEqual(files, ['a.txt', 'b.txt'])
+
+ with self.tmpdir_as_cwd():
+ result = self.fs.match(['data/*.txt'])[0]
+ files = [os.path.basename(f.path) for f in result.metadata_list]
+ self.assertCountEqual(files, ['a.txt', 'b.txt'])
+
+ def test_match_files_treats_both_separators_alike_on_windows(self):
Review Comment:
instead of using mock we can skip the test on non-windows host. We have
windows tests separately
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]