Skip to content

Commit

Permalink
Ignore empty __init__.py when constructing test map (#413)
Browse files Browse the repository at this point in the history
* Ignore empty __init__.py when constructing test map

* just whitespace is empty
  • Loading branch information
kavigupta committed Apr 12, 2020
1 parent c581f2e commit 18058a9
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions client/api/assignment.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,15 @@ def get_student_email(self):
def get_identifier(self):
return auth.get_identifier(self.cmd_args, endpoint=self.endpoint)

def is_empty_init(self, path):
if os.path.basename(path) != '__init__.py':
return False

with open(path) as f:
contents = f.read()

return contents.strip() == ""

def _load_tests(self):
"""Loads all tests specified by test_map."""
log.info('Loading tests')
Expand All @@ -193,6 +202,8 @@ def _load_tests(self):
parameter = ''

for file in sorted(glob.glob(file_pattern)):
if self.is_empty_init(file):
continue
try:
module = importlib.import_module(self._TESTS_PACKAGE + '.' + source)
except ImportError:
Expand Down

0 comments on commit 18058a9

Please sign in to comment.