You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beam.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2018/10/09 22:59:00 UTC

[jira] [Work logged] (BEAM-5693) Python SDK tests failing on Windows

     [ https://issues.apache.org/jira/browse/BEAM-5693?focusedWorklogId=152959&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-152959 ]

ASF GitHub Bot logged work on BEAM-5693:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 09/Oct/18 22:58
            Start Date: 09/Oct/18 22:58
    Worklog Time Spent: 10m 
      Work Description: pabloem closed pull request #6620: [BEAM-5693] Adding fixes to work properly with files on windows
URL: https://github.com/apache/beam/pull/6620
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/sdks/python/apache_beam/io/localfilesystem_test.py b/sdks/python/apache_beam/io/localfilesystem_test.py
index 46ed6a29f41..e86b00a0d2d 100644
--- a/sdks/python/apache_beam/io/localfilesystem_test.py
+++ b/sdks/python/apache_beam/io/localfilesystem_test.py
@@ -161,17 +161,25 @@ def test_match_file_exception(self):
 
   @parameterized.expand([
       param('*',
-            files=['a', 'b', 'c/x'],
+            files=['a', 'b', os.path.join('c', 'x')],
             expected=['a', 'b']),
       param('**',
-            files=['a', 'b/x', 'c/x'],
-            expected=['a', 'b/x', 'c/x']),
-      param('*/*',
-            files=['a', 'b/x', 'c/x', 'd/x/y'],
-            expected=['b/x', 'c/x']),
-      param('**/*',
-            files=['a', 'b/x', 'c/x', 'd/x/y'],
-            expected=['b/x', 'c/x', 'd/x/y']),
+            files=['a', os.path.join('b', 'x'), os.path.join('c', 'x')],
+            expected=['a', os.path.join('b', 'x'), os.path.join('c', 'x')]),
+      param(os.path.join('*', '*'),
+            files=['a',
+                   os.path.join('b', 'x'),
+                   os.path.join('c', 'x'),
+                   os.path.join('d', 'x', 'y')],
+            expected=[os.path.join('b', 'x'), os.path.join('c', 'x')]),
+      param(os.path.join('**', '*'),
+            files=['a',
+                   os.path.join('b', 'x'),
+                   os.path.join('c', 'x'),
+                   os.path.join('d', 'x', 'y')],
+            expected=[os.path.join('b', 'x'),
+                      os.path.join('c', 'x'),
+                      os.path.join('d', 'x', 'y')]),
   ])
   def test_match_glob(self, pattern, files, expected):
     for filename in files:
@@ -205,7 +213,7 @@ def test_match_directory_contents(self):
     open(path1, 'a').close()
     open(path2, 'a').close()
 
-    result = self.fs.match([self.tmpdir + '/'])[0]
+    result = self.fs.match([os.path.join(self.tmpdir, '*')])[0]
     files = [f.path for f in result.metadata_list]
     self.assertCountEqual(files, [path1, path2])
 
@@ -399,7 +407,7 @@ def test_delete_globs(self):
 
     self.fs.delete([
         os.path.join(dir, 'path*'),
-        os.path.join(dir, 'aaa/b*')
+        os.path.join(dir, 'aaa', 'b*')
     ])
 
     # One empty nested directory is left
@@ -433,8 +441,8 @@ def test_delete_glob_errors(self):
                                  r'^Delete operation failed') as error:
       self.fs.delete([
           os.path.join(dir, 'path*'),
-          os.path.join(dir, 'aaa/b*'),
-          os.path.join(dir, 'aaa/d*')  # doesn't match anything, will raise
+          os.path.join(dir, 'aaa', 'b*'),
+          os.path.join(dir, 'aaa', 'd*')  # doesn't match anything, will raise
       ])
 
     self.check_tree(
@@ -454,7 +462,7 @@ def test_delete_glob_errors(self):
             .exception_details
             .keys()
         ),
-        [os.path.join(dir, 'aaa/d*')]
+        [os.path.join(dir, 'aaa', 'd*')]
     )
 
     with self.assertRaisesRegexp(BeamIOError,
diff --git a/sdks/python/apache_beam/runners/interactive/cache_manager.py b/sdks/python/apache_beam/runners/interactive/cache_manager.py
index ee74936c2c3..75805d6826b 100644
--- a/sdks/python/apache_beam/runners/interactive/cache_manager.py
+++ b/sdks/python/apache_beam/runners/interactive/cache_manager.py
@@ -93,7 +93,7 @@ def __init__(self, cache_dir=None):
     if cache_dir:
       self._cache_dir = filesystems.FileSystems.join(
           cache_dir,
-          datetime.datetime.now().strftime("cache-%y-%m-%d-%H:%M:%S"))
+          datetime.datetime.now().strftime("cache-%y-%m-%d-%H_%M_%S"))
     else:
       self._cache_dir = tempfile.mkdtemp(
           prefix='interactive-temp-', dir=os.environ.get('TEST_TMPDIR', None))
diff --git a/sdks/python/apache_beam/testing/pipeline_verifiers_test.py b/sdks/python/apache_beam/testing/pipeline_verifiers_test.py
index 0cce915f58c..16ffee96c6e 100644
--- a/sdks/python/apache_beam/testing/pipeline_verifiers_test.py
+++ b/sdks/python/apache_beam/testing/pipeline_verifiers_test.py
@@ -20,6 +20,7 @@
 from __future__ import absolute_import
 
 import logging
+import os
 import tempfile
 import unittest
 from builtins import range
@@ -100,14 +101,15 @@ def test_file_checksum_matcher_success(self):
       temp_dir = tempfile.mkdtemp()
       for _ in range(case['num_files']):
         self.create_temp_file(case['content'], temp_dir)
-      matcher = verifiers.FileChecksumMatcher(temp_dir + '/*',
+      matcher = verifiers.FileChecksumMatcher(os.path.join(temp_dir, '*'),
                                               case['expected_checksum'])
       hc_assert_that(self._mock_result, matcher)
 
   @patch.object(LocalFileSystem, 'match')
   def test_file_checksum_matcher_read_failed(self, mock_match):
     mock_match.side_effect = IOError('No file found.')
-    matcher = verifiers.FileChecksumMatcher('dummy/path', Mock())
+    matcher = verifiers.FileChecksumMatcher(
+        os.path.join('dummy', 'path'), Mock())
     with self.assertRaises(IOError):
       hc_assert_that(self._mock_result, matcher)
     self.assertTrue(mock_match.called)
@@ -140,7 +142,7 @@ def test_file_checksum_matcher_sleep_before_verify(self, mocked_sleep):
     temp_dir = tempfile.mkdtemp()
     case = self.test_cases[0]
     self.create_temp_file(case['content'], temp_dir)
-    matcher = verifiers.FileChecksumMatcher(temp_dir + '/*',
+    matcher = verifiers.FileChecksumMatcher(os.path.join(temp_dir, '*'),
                                             case['expected_checksum'],
                                             10)
     hc_assert_that(self._mock_result, matcher)


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Issue Time Tracking
-------------------

            Worklog Id:     (was: 152959)
            Time Spent: 10m
    Remaining Estimate: 0h

> Python SDK tests failing on Windows
> -----------------------------------
>
>                 Key: BEAM-5693
>                 URL: https://issues.apache.org/jira/browse/BEAM-5693
>             Project: Beam
>          Issue Type: Bug
>          Components: sdk-py-core
>            Reporter: Pablo Estrada
>            Assignee: Pablo Estrada
>            Priority: Major
>          Time Spent: 10m
>  Remaining Estimate: 0h
>




--
This message was sent by Atlassian JIRA
(v7.6.3#76005)