Example #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)
Example #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))
Example #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)
Example #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)
Example #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)
Example #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))
Example #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)
Example #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)
Example #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)
Example #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)
Example #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))
Example #12
0
 def setUp(self):
     tmpath = self.tmpath = tempfile.mktemp()
     self.tdir = tempfile.mkdtemp()
     touch(tmpath)
Example #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()
Example #14
0
 def setUp(self):
     self.tdir = tempfile.mkdtemp()
     p = Path(self.tdir)
     nix.touch(p + 'foo.txt')
     nix.touch(p + 'bar.txt')
Example #15
0
 def setUp(self):
     self.tdir = tempfile.mkdtemp()
     self.src = self.tdir + '/target'
     nix.touch(self.src)
Example #16
0
 def setUp(self):
     tmpath = self.tmpath = tempfile.mktemp()
     self.tdir = tempfile.mkdtemp()
     touch(tmpath)
Example #17
0
 def setUp(self):
     self.tdir = tempfile.mkdtemp()
     self.src = self.tdir  + '/target'
     nix.touch(self.src)
Example #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))
Example #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))
Example #20
0
 def test_touches(self):
     "Create a file"
     filepath = self.tdir + '/foo.txt'
     nix.touch(filepath)
     self.assertTrue(os.path.isfile(filepath))
Example #21
0
 def test_touches(self):
     "Create a file"
     filepath = self.tdir + '/foo.txt'
     nix.touch(filepath)
     self.assertTrue(os.path.isfile(filepath))
Example #22
0
 def setUp(self):
     self.tdir = tempfile.mkdtemp()
     p = Path(self.tdir)
     nix.touch(p + 'foo.txt')
     nix.touch(p + 'bar.txt')
Example #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))
Example #24
0
 def touch(self, resource):
     return nix.touch(resource)