Viranshul-P commented on code in PR #41619:
URL: https://github.com/apache/beam/pull/41619#discussion_r4683550594
##########
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:
Thanks, done in 7417d9a5371. The test now runs only on Windows
(`@unittest.skipUnless(platform.system() == 'Windows', ...)`) and uses the real
separators, no mock. `test_match_glob_with_forward_slashes` still runs on every
platform. Both tests fail on master and pass with the fix on Windows.
--
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]