示例#1
0
 def test_cp_file_recursive(self):
     "Recursive does nothing"
     f1 = self.tdir / 'one.txt'
     f2 = self.tdir + 'two.txt'
     f1 << 'Contents!'
     nix.cp(f1, f2, recursive=True)
     self.assertTrue(filecmp.cmp(f1, f2, False))
示例#2
0
 def test_cp_file(self):
     "Copy self to dest"
     f1 = self.tdir / 'one.txt'
     f2 = self.tdir + 'two.txt'
     f1 << 'Contents!'
     nix.cp(f1, f2)
     self.assertTrue(filecmp.cmp(f1, f2, False))
示例#3
0
 def test_cp_file_recursive(self):
     "Recursive does nothing"
     f1 = self.tdir / 'one.txt'
     f2 = self.tdir + 'two.txt'
     f1 << 'Contents!'
     nix.cp(f1, f2, recursive=True)
     self.assertTrue(filecmp.cmp(f1, f2, False))
示例#4
0
 def test_cp_file(self):
     "Copy self to dest"
     f1 = self.tdir / 'one.txt'
     f2 = self.tdir + 'two.txt'
     f1 << 'Contents!'
     nix.cp(f1, f2)
     self.assertTrue(filecmp.cmp(f1, f2, False))
示例#5
0
 def test_cp_dir_recursive(self):
     "Should copy the tree"
     d1 = self.tdir / 'this'
     d2 = self.tdir / 'that'
     d1.touch('one.txt', 'two.txt')
     self.tdir.mkdir('this')
     nix.cp(d1, d2, recursive=True)
     self.assertEqual([], filecmp.dircmp(d1, d2).diff_files)
示例#6
0
 def test_cp_dir_recursive(self):
     "Should copy the tree"
     d1 = self.tdir / 'this'
     d2 = self.tdir / 'that'
     d1.touch('one.txt', 'two.txt')
     self.tdir.mkdir('this')
     nix.cp(d1, d2, recursive=True)
     self.assertEqual([], filecmp.dircmp(d1, d2).diff_files)
示例#7
0
 def test_cp_target_exists(self):
     "Should raise"
     with self.assertRaises(exceptions.ExistsError):
         self.tdir.touch('whatever', 'whateverer')
         nix.cp(self.tdir + 'whatever', self.tdir + 'whateverer')
示例#8
0
 def test_cp_nonexistant(self):
     "Should raise"
     with self.assertRaises(exceptions.DoesNotExistError):
         nix.cp(self.tdir + 'whatever', self.tdir + 'whateverer')
示例#9
0
 def test_cp_dir(self):
     "Is a no-op"
     self.tdir.mkdir('this')
     p = self.tdir / 'that'
     nix.cp(self.tdir / 'this', p)
     self.assertFalse(p)
示例#10
0
 def cp(self, resource, target, recursive=False):
     return nix.cp(resource, target, recursive=recursive)
示例#11
0
 def test_cp_target_exists(self):
     "Should raise"
     with self.assertRaises(exceptions.ExistsError):
         self.tdir.touch('whatever', 'whateverer')
         nix.cp(self.tdir + 'whatever', self.tdir + 'whateverer')
示例#12
0
 def test_cp_nonexistant(self):
     "Should raise"
     with self.assertRaises(exceptions.DoesNotExistError):
         nix.cp(self.tdir + 'whatever', self.tdir + 'whateverer')
示例#13
0
 def test_cp_dir(self):
     "Is a no-op"
     self.tdir.mkdir('this')
     p = self.tdir / 'that'
     nix.cp(self.tdir / 'this', p)
     self.assertFalse(p)