예제 #1
0
 def test_copy_error(self):
   path1 = os.path.join(self.tmpdir, 'f1')
   path2 = os.path.join(self.tmpdir, 'f2')
   with self.assertRaisesRegexp(BeamIOError,
                                r'^Copy operation failed') as error:
     FileSystems.copy([path1], [path2])
   self.assertEqual(error.exception.exception_details.keys(), [(path1, path2)])
예제 #2
0
    def test_copy(self):
        path1 = os.path.join(self.tmpdir, 'f1')
        path2 = os.path.join(self.tmpdir, 'f2')
        with open(path1, 'a') as f:
            f.write('Hello')

        FileSystems.copy([path1], [path2])
        self.assertTrue(filecmp.cmp(path1, path2))
  def test_copy(self):
    path1 = os.path.join(self.tmpdir, 'f1')
    path2 = os.path.join(self.tmpdir, 'f2')
    with open(path1, 'a') as f:
      f.write('Hello')

    FileSystems.copy([path1], [path2])
    self.assertTrue(filecmp.cmp(path1, path2))
예제 #4
0
 def test_copy_error(self):
   path1 = os.path.join(self.tmpdir, 'f1')
   path2 = os.path.join(self.tmpdir, 'f2')
   with self.assertRaises(BeamIOError) as error:
     FileSystems.copy([path1], [path2])
   self.assertTrue(
       error.exception.message.startswith('Copy operation failed'))
   self.assertEqual(error.exception.exception_details.keys(), [(path1, path2)])
예제 #5
0
 def test_copy_error(self):
   path1 = os.path.join(self.tmpdir, 'f1')
   path2 = os.path.join(self.tmpdir, 'f2')
   with self.assertRaises(BeamIOError) as error:
     FileSystems.copy([path1], [path2])
   self.assertTrue(
       error.exception.message.startswith('Copy operation failed'))
   self.assertEqual(error.exception.exception_details.keys(), [(path1, path2)])
예제 #6
0
    def test_copy_directory(self):
        path_t1 = os.path.join(self.tmpdir, 't1')
        path_t2 = os.path.join(self.tmpdir, 't2')
        FileSystems.mkdirs(path_t1)
        FileSystems.mkdirs(path_t2)

        path1 = os.path.join(path_t1, 'f1')
        path2 = os.path.join(path_t2, 'f1')
        with open(path1, 'a') as f:
            f.write('Hello')

        FileSystems.copy([path_t1], [path_t2])
        self.assertTrue(filecmp.cmp(path1, path2))
  def test_copy_directory(self):
    path_t1 = os.path.join(self.tmpdir, 't1')
    path_t2 = os.path.join(self.tmpdir, 't2')
    FileSystems.mkdirs(path_t1)
    FileSystems.mkdirs(path_t2)

    path1 = os.path.join(path_t1, 'f1')
    path2 = os.path.join(path_t2, 'f1')
    with open(path1, 'a') as f:
      f.write('Hello')

    FileSystems.copy([path_t1], [path_t2])
    self.assertTrue(filecmp.cmp(path1, path2))