mirror of
https://github.com/rembo10/headphones.git
synced 2026-07-21 00:14:02 +01:00
pep8 and pyflakes
This commit is contained in:
@@ -6,7 +6,7 @@ class SoftChroot(object):
|
|||||||
path = path.strip()
|
path = path.strip()
|
||||||
|
|
||||||
if (not os.path.exists(path) or
|
if (not os.path.exists(path) or
|
||||||
not os.path.isdir(path)):
|
not os.path.isdir(path)):
|
||||||
raise SoftChrootError('No such directory: %s' % path)
|
raise SoftChrootError('No such directory: %s' % path)
|
||||||
|
|
||||||
path = path.strip(os.path.sep) + os.path.sep
|
path = path.strip(os.path.sep) + os.path.sep
|
||||||
|
|||||||
@@ -18,8 +18,10 @@ class SoftChrootTest(TestCase):
|
|||||||
|
|
||||||
path = os.path.join('/tmp', 'notexist', 'asdf', '11', '12', 'np', 'itsssss')
|
path = os.path.join('/tmp', 'notexist', 'asdf', '11', '12', 'np', 'itsssss')
|
||||||
|
|
||||||
|
cf = None
|
||||||
with self.assertRaises(SoftChrootError) as exc:
|
with self.assertRaises(SoftChrootError) as exc:
|
||||||
cf = SoftChroot(path)
|
cf = SoftChroot(path)
|
||||||
|
self.assertIsNone(cf)
|
||||||
|
|
||||||
self.assertRegexpMatches(str(exc.exception), r'No such directory')
|
self.assertRegexpMatches(str(exc.exception), r'No such directory')
|
||||||
self.assertRegexpMatches(str(exc.exception), path)
|
self.assertRegexpMatches(str(exc.exception), path)
|
||||||
@@ -33,8 +35,10 @@ class SoftChrootTest(TestCase):
|
|||||||
os_mock.path.sep = os.path.sep
|
os_mock.path.sep = os.path.sep
|
||||||
os_mock.path.isdir.side_effect = lambda x: x != path
|
os_mock.path.isdir.side_effect = lambda x: x != path
|
||||||
|
|
||||||
|
cf = None
|
||||||
with self.assertRaises(SoftChrootError) as exc:
|
with self.assertRaises(SoftChrootError) as exc:
|
||||||
cf = SoftChroot(str(path))
|
cf = SoftChroot(path)
|
||||||
|
self.assertIsNone(cf)
|
||||||
|
|
||||||
self.assertTrue(os_mock.path.isdir.called)
|
self.assertTrue(os_mock.path.isdir.called)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user