Ejemplo n.º 1
0
 def test_as_fn(self):
     "Should work as a callable"
     nix.cd('/tmp')
     cwd = os.getcwd()
     if sys.platform == 'darwin':
         cwd = cwd.replace('/private', '')
     self.assertEqual('/tmp', cwd)
Ejemplo n.º 2
0
 def test_accepts_path(self):
     "Should Duck-type with Path objects"
     nix.cd(Path('/tmp'))
     cwd = os.getcwd()
     if sys.platform == 'darwin':
         cwd = cwd.replace('/private', '')
     self.assertEqual('/tmp', cwd)
Ejemplo n.º 3
0
 def test_accepts_path(self):
     "Should Duck-type with Path objects"
     nix.cd(Path('/tmp'))
     cwd = os.getcwd()
     if sys.platform == 'darwin':
         cwd = cwd.replace('/private', '')        
     self.assertEqual('/tmp', cwd)
Ejemplo n.º 4
0
 def test_as_fn(self):
     "Should work as a callable"
     nix.cd('/tmp')
     cwd = os.getcwd()
     if sys.platform == 'darwin':
         cwd = cwd.replace('/private', '')
     self.assertEqual('/tmp', cwd)
Ejemplo n.º 5
0
 def test_contextmanager(self):
     "Should work as a contextmanager"
     with nix.cd('/tmp') as path:
         cwd = os.getcwd()
         if sys.platform == 'darwin':
             cwd = cwd.replace('/private', '')
         self.assertEqual('/tmp', cwd)
         self.assertIsInstance(path, Path)
         self.assertEqual('/tmp', path)
     self.assertEqual(self.startdir, os.getcwd())
Ejemplo n.º 6
0
 def test_contextmanager(self):
     "Should work as a contextmanager"
     with nix.cd('/tmp') as path:
         cwd = os.getcwd()
         if sys.platform == 'darwin':
             cwd = cwd.replace('/private', '')
         self.assertEqual('/tmp', cwd)
         self.assertIsInstance(path, Path)
         self.assertEqual('/tmp', path)
     self.assertEqual(self.startdir, os.getcwd())
Ejemplo n.º 7
0
 def test_contextmanager_raises(self):
     "Should propagate exceptions"
     with self.assertRaises(RuntimeError):
         with nix.cd('/tmp'):
             raise RuntimeError('!')
     self.assertEqual(self.startdir, os.getcwd())
Ejemplo n.º 8
0
 def cd(self, target):
     return nix.cd(target)
Ejemplo n.º 9
0
 def test_contextmanager_raises(self):
     "Should propagate exceptions"
     with self.assertRaises(RuntimeError):
         with nix.cd('/tmp'):
             raise RuntimeError('!')
     self.assertEqual(self.startdir, os.getcwd())