Skip to content

Commit

Permalink
flake8
Browse files Browse the repository at this point in the history
  • Loading branch information
Miroslav Shubernetskiy committed Sep 9, 2014
1 parent 0fa0cde commit e9c6379
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 11 deletions.
17 changes: 12 additions & 5 deletions skipnose/skipnose.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,20 @@ def options(self, parser, env=os.environ):
"""
truth = ('true', '1', 'on')
skipnose_on = env.get(self.env_opt, 'False').lower() in truth
skip_include = filter(bool, re.split(r'[,;:]', env.get(self.env_include_opt, '')))
skip_exclude = filter(bool, re.split(r'[,;:]', env.get(self.env_exclude_opt, '')))
skip_include = filter(
bool, re.split(r'[,;:]', env.get(self.env_include_opt, ''))
)
skip_exclude = filter(
bool, re.split(r'[,;:]', env.get(self.env_exclude_opt, ''))
)

parser.add_option(
'--with-skipnose',
action='store_true',
default=skipnose_on,
dest='skipnose',
help='skipnose: enable skipnose nose plugin (alternatively, set ${}=1)'
help='skipnose: enable skipnose nose plugin '
'(alternatively, set ${}=1)'
''.format(self.env_opt)
)
parser.add_option(
Expand All @@ -70,7 +75,8 @@ def options(self, parser, env=os.environ):
action='append',
default=list(skip_include),
dest='skipnose_include',
help='skipnose: which directory to include in tests using glob syntax.'
help='skipnose: which directory to include in tests '
'using glob syntax.'
'can be specified multiple times. '
'(alternatively, set ${} as [,;:] delimited string)'
''.format(self.env_include_opt)
Expand All @@ -80,7 +86,8 @@ def options(self, parser, env=os.environ):
action='append',
default=list(skip_exclude),
dest='skipnose_exclude',
help='skipnose: which directory to exclude in tests using glob syntax.'
help='skipnose: which directory to exclude in tests '
'using glob syntax.'
'can be specified multiple times. '
'(alternatively, set ${} as [,;:] delimited string)'
''.format(self.env_exclude_opt)
Expand Down
16 changes: 10 additions & 6 deletions tests/tests_skipnose.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ def setUp(self):
('/test/bar/dog/one/api/subapi', ('api-child',)),
('/test/bar/dog/one/api/subapi/moreapi', ('api-child',)),
('/test/bar/dog/one/api/subapi/evenmoreapi', ('api-child',)),
('/test/bar/dog/one/api/subapi/evenmoreapi/crazyapi', ('api-child',)),
('/test/bar/dog/one/api/subapi/evenmoreapi/api', ('api-child',)),
('/test/foo', ('api-parent-foo', 'foo')),
('/test/foo/api', ('api', 'foo-child')),
('/test/foo/api/subapi', ('api-child', 'foo-child')),
Expand All @@ -127,7 +127,7 @@ def setUp(self):
('/test/foo/nonapi/folderone', ('non-api', 'foo-child')),
('/test/foo/nonapi/foldertwo', ('non-api', 'foo-child')),
('/test/foo/nonapi/foldertwo/morestuff', ('non-api', 'foo-child')),
('/test/foo/nonapi/foldertwo/toomuchstuff', ('non-api', 'foo-child')),
('/test/foo/nonapi/foldertwo/toomuch', ('non-api', 'foo-child')),
)

def _mock_walk_subfolders(self, path):
Expand All @@ -152,7 +152,8 @@ def test_want_directory_include(self, mock_walk_subfolders):
self.plugin.skipnose_include = ['api']
for path, properties in self.test_paths:
accepted = ('api-parent', 'api-parent-foo', 'api', 'api-child')
expected = None if any(map(lambda i: i in properties, accepted)) else False
expected = (None if any(map(lambda i: i in properties, accepted))
else False)
actual = self.plugin.wantDirectory(path)
self.assertEqual(actual, expected,
'{} != {} for {}'.format(actual, expected, path))
Expand All @@ -167,7 +168,8 @@ def test_want_directory_include_multiple(self, mock_walk_subfolders):
self.plugin.skipnose_include = ['api', 'foo']
for path, properties in self.test_paths:
accepted = ('api-parent', 'api', 'api-child', 'foo', 'foo-child')
expected = None if any(map(lambda i: i in properties, accepted)) else False
expected = (None if any(map(lambda i: i in properties, accepted))
else False)
actual = self.plugin.wantDirectory(path)
self.assertEqual(actual, expected,
'{} != {} for {}'.format(actual, expected, path))
Expand All @@ -182,7 +184,8 @@ def test_want_directory_exclude(self):
if 'api-child' in properties:
continue
accepted = ('api-parent', 'api-parent-foo', 'non-api')
expected = None if any(map(lambda i: i in properties, accepted)) else False
expected = (None if any(map(lambda i: i in properties, accepted))
else False)
actual = self.plugin.wantDirectory(path)
self.assertEqual(actual, expected,
'{} != {} for {}'.format(actual, expected, path))
Expand All @@ -197,7 +200,8 @@ def test_want_directory_exclude_multiple(self):
if 'api-child' in properties or 'foo-child' in properties:
continue
accepted = ('api-parent', 'non-api', 'foo-parent')
expected = None if any(map(lambda i: i in properties, accepted)) else False
expected = (None if any(map(lambda i: i in properties, accepted))
else False)
actual = self.plugin.wantDirectory(path)
self.assertEqual(actual, expected,
'{} != {} for {}'.format(actual, expected, path))

0 comments on commit e9c6379

Please sign in to comment.