Exemplo n.º 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))
Exemplo n.º 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))
Exemplo n.º 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))
Exemplo n.º 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))
Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 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')
Exemplo n.º 8
0
 def test_cp_nonexistant(self):
     "Should raise"
     with self.assertRaises(exceptions.DoesNotExistError):
         nix.cp(self.tdir + 'whatever', self.tdir + 'whateverer')
Exemplo n.º 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)
Exemplo n.º 10
0
 def cp(self, resource, target, recursive=False):
     return nix.cp(resource, target, recursive=recursive)
Exemplo n.º 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')
Exemplo n.º 12
0
 def test_cp_nonexistant(self):
     "Should raise"
     with self.assertRaises(exceptions.DoesNotExistError):
         nix.cp(self.tdir + 'whatever', self.tdir + 'whateverer')
Exemplo n.º 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)