Example #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)
Example #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)
Example #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)
Example #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)
Example #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())
Example #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())
Example #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())
Example #8
0
 def cd(self, target):
     return nix.cd(target)
Example #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())