Skip to content

Commit

Permalink
[ckan#3391] simplify test class filtering
Browse files Browse the repository at this point in the history
  • Loading branch information
wardi committed Jan 7, 2017
1 parent b82a936 commit 09012b3
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions ckan/ckan_nose_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,18 +83,10 @@ def options(self, parser, env):
help='drop database and reinitialize before tests are run')

def wantClass(self, cls):
name = cls.__name__

wanted = (not cls.__name__.startswith('_')
and (issubclass(cls, unittest.TestCase)
or re.search('(?:^|[\b_\./-])[Tt]est', name)
))

if self.segments and str(hashlib.md5(name).hexdigest())[0] not in self.segments:
if self.segments and str(hashlib.md5(
cls.__name__).hexdigest())[0] not in self.segments:
return False

return wanted

def wantFunction(self, fn):
if self.segments and hashlib.md5(
fn.__name__).hexdigest()[0] not in self.segments:
Expand Down

0 comments on commit 09012b3

Please sign in to comment.