pep8 and pyflakes

This commit is contained in:
maxkoryukov
2016-02-03 06:52:35 +05:00
parent 89ddd937b0
commit 28cbf6d803
2 changed files with 6 additions and 2 deletions

View File

@@ -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

View File

@@ -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)