Пример #1
0
 def test_ls_dotfile(self):
     "Shouldn't see dotfiles"
     nix.touch(Path(self.tdir) + '.dotrc')
     self.assertTrue(os.path.isfile(self.tdir + '/.dotrc'))
     contents = nix.ls(Path(self.tdir))
     contents.sort()
     self.assertEqual(['bar.txt', 'foo.txt'], contents)
Пример #2
0
 def test_with_tmp_contents(self):
     "Should kill directory contents"
     with Path.temp() as p:
         val = str(p)
         touch(p + 'my.txt')
         self.assertTrue(os.path.exists(str(p + 'my.txt')))
     self.assertFalse(os.path.exists(val))
Пример #3
0
 def test_ls_a_ignore_backups(self):
     "Should ignore ~ files even with all"
     nix.touch(Path(self.tdir) + 'dotrc~')
     self.assertTrue(os.path.isfile(self.tdir + '/dotrc~'))
     contents = nix.ls(self.tdir, ignore_backups=True, all=True)
     contents.sort()
     self.assertEqual(['.', '..', 'bar.txt', 'foo.txt'], contents)
Пример #4
0
 def test_ls_dotfile(self):
     "Shouldn't see dotfiles"
     nix.touch(Path(self.tdir) + '.dotrc')
     self.assertTrue(os.path.isfile(self.tdir + '/.dotrc'))
     contents = nix.ls(Path(self.tdir))
     contents.sort()
     self.assertEqual(['bar.txt', 'foo.txt'], contents)
Пример #5
0
 def test_ls_almost_all(self):
     "Should see most dotfiles"
     nix.touch(Path(self.tdir) + '.dotrc')
     self.assertTrue(os.path.isfile(self.tdir + '/.dotrc'))
     contents = nix.ls(self.tdir, almost_all=True)
     contents.sort()
     self.assertEqual(['.dotrc', 'bar.txt', 'foo.txt'], contents)
Пример #6
0
 def test_with_tmp_contents(self):
     "Should kill directory contents"
     with Path.temp() as p:
         val = str(p)
         touch(p + 'my.txt')
         self.assertTrue(os.path.exists(str(p + 'my.txt')))
     self.assertFalse(os.path.exists(val))
Пример #7
0
 def test_ls_almost_all(self):
     "Should see most dotfiles"
     nix.touch(Path(self.tdir) + '.dotrc')
     self.assertTrue(os.path.isfile(self.tdir + '/.dotrc'))
     contents = nix.ls(self.tdir, almost_all=True)
     contents.sort()
     self.assertEqual(['.dotrc', 'bar.txt', 'foo.txt'], contents)
Пример #8
0
 def test_ls_a_ignore_backups(self):
     "Should ignore ~ files even with all"
     nix.touch(Path(self.tdir) + 'dotrc~')
     self.assertTrue(os.path.isfile(self.tdir + '/dotrc~'))
     contents = nix.ls(self.tdir, ignore_backups=True, all=True)
     contents.sort()
     self.assertEqual(['.', '..', 'bar.txt', 'foo.txt'], contents)
Пример #9
0
 def test_iter_dir(self):
     "Iterate through lines in a file"
     p = Path(self.tdir)
     touch(p + 'foo.txt')
     touch(p + 'bar.txt')
     i = ['foo.txt', 'bar.txt']
     for branch in p:
         self.assertIn(branch, i)
Пример #10
0
 def test_iter_dir(self):
     "Iterate through lines in a file"
     p = Path(self.tdir)
     touch(p + 'foo.txt')
     touch(p + 'bar.txt')
     i = ['foo.txt', 'bar.txt']
     for branch in p:
         self.assertIn(branch, i)
Пример #11
0
 def test_touch_path(self):
     "Create from a Path object"
     filestr = self.tdir + '/foo.txt'
     filepath = Path(filestr)
     nix.touch(filepath)
     self.assertTrue(os.path.isfile(filestr))
Пример #12
0
 def setUp(self):
     tmpath = self.tmpath = tempfile.mktemp()
     self.tdir = tempfile.mkdtemp()
     touch(tmpath)
Пример #13
0
 def setUp(self):
     self.tfile = tempfile.mktemp()
     self.tdir = tempfile.mkdtemp()
     nix.touch(self.tfile)
     nix.mkdir_p(self.tdir)
     self.fs = filesystem.DiskFilesystem()
Пример #14
0
 def setUp(self):
     self.tdir = tempfile.mkdtemp()
     p = Path(self.tdir)
     nix.touch(p + 'foo.txt')
     nix.touch(p + 'bar.txt')
Пример #15
0
 def setUp(self):
     self.tdir = tempfile.mkdtemp()
     self.src = self.tdir + '/target'
     nix.touch(self.src)
Пример #16
0
 def setUp(self):
     tmpath = self.tmpath = tempfile.mktemp()
     self.tdir = tempfile.mkdtemp()
     touch(tmpath)
Пример #17
0
 def setUp(self):
     self.tdir = tempfile.mkdtemp()
     self.src = self.tdir  + '/target'
     nix.touch(self.src)
Пример #18
0
 def test_contents_dir(self):
     "list of files"
     p = Path(self.tdir)
     touch(p + 'myfile.txt')
     self.assertIn(self.tdir + '/myfile.txt', p.contents)
     self.assertEqual(1, len(p.contents))
Пример #19
0
 def test_contents_dir(self):
     "list of files"
     p = Path(self.tdir)
     touch(p + 'myfile.txt')
     self.assertIn(self.tdir + '/myfile.txt', p.contents)
     self.assertEqual(1, len(p.contents))
Пример #20
0
 def test_touches(self):
     "Create a file"
     filepath = self.tdir + '/foo.txt'
     nix.touch(filepath)
     self.assertTrue(os.path.isfile(filepath))
Пример #21
0
 def test_touches(self):
     "Create a file"
     filepath = self.tdir + '/foo.txt'
     nix.touch(filepath)
     self.assertTrue(os.path.isfile(filepath))
Пример #22
0
 def setUp(self):
     self.tdir = tempfile.mkdtemp()
     p = Path(self.tdir)
     nix.touch(p + 'foo.txt')
     nix.touch(p + 'bar.txt')
Пример #23
0
 def test_touch_path(self):
     "Create from a Path object"
     filestr = self.tdir + '/foo.txt'
     filepath = Path(filestr)
     nix.touch(filepath)
     self.assertTrue(os.path.isfile(filestr))
Пример #24
0
 def touch(self, resource):
     return nix.touch(resource)