diff --git a/headphones/softchroot.py b/headphones/softchroot.py index 6176be6c..5219a8fd 100644 --- a/headphones/softchroot.py +++ b/headphones/softchroot.py @@ -6,7 +6,7 @@ class SoftChroot(object): path = path.strip() if (not os.path.exists(path) or - not os.path.isdir(path)): + not os.path.isdir(path)): raise SoftChrootError('No such directory: %s' % path) path = path.strip(os.path.sep) + os.path.sep diff --git a/headphones/softchroot_test.py b/headphones/softchroot_test.py index a7910692..424e2eac 100644 --- a/headphones/softchroot_test.py +++ b/headphones/softchroot_test.py @@ -18,8 +18,10 @@ class SoftChrootTest(TestCase): path = os.path.join('/tmp', 'notexist', 'asdf', '11', '12', 'np', 'itsssss') + cf = None with self.assertRaises(SoftChrootError) as exc: cf = SoftChroot(path) + self.assertIsNone(cf) self.assertRegexpMatches(str(exc.exception), r'No such directory') self.assertRegexpMatches(str(exc.exception), path) @@ -33,8 +35,10 @@ class SoftChrootTest(TestCase): os_mock.path.sep = os.path.sep os_mock.path.isdir.side_effect = lambda x: x != path + cf = None with self.assertRaises(SoftChrootError) as exc: - cf = SoftChroot(str(path)) + cf = SoftChroot(path) + self.assertIsNone(cf) self.assertTrue(os_mock.path.isdir.called)