def test_cwd(self): from cu.syspath import ls self.assertEqual(local.cwd, os.getcwd()) self.assertTrue('__init__.py' not in ls().splitlines()) with local.cwd('../cu'): self.assertTrue('__init__.py' in ls().splitlines()) self.assertTrue('__init__.py' not in ls().splitlines()) self.assertRaises(OSError, local.cwd.chdir, '../non_exist1N9')
def test_imports(self): from cu.syspath import ls self.assertTrue('test_local.py' in local['ls']().splitlines()) self.assertTrue('test_local.py' in ls().splitlines()) self.assertRaises(CommandNotFound, lambda: local['non_exist1N9']) try: from cu.syspath import non_exist1N9 except CommandNotFound: pass else: self.fail('from cu.syspath import non_exist1N9')