Skip to content

Commit

Permalink
Merge pull request #113 from launchableinc/fix-file-no-match-error
Browse files Browse the repository at this point in the history
Fix TypeError when file/glob does not match any file
  • Loading branch information
ninjinkun authored Jan 27, 2021
2 parents bd08948 + 184f56d commit d4d15d0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion launchable/test_runners/launchable.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def record_tests(client, source_roots):
# By following the shell convention, if the file doesn't exist or GLOB doesn't match anything,
# raise it as an error. Note this can happen for reasons other than a configuration error.
# For example, if a build catastrophically failed and no tests got run.
click.echo("No matches found: " % root, err=True)
click.echo("No matches found: {}".format(root), err=True)
# intentionally exiting with zero
return

Expand Down
9 changes: 9 additions & 0 deletions tests/test_runners/test_googletest.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,12 @@ def test_record_failed_test_googletest(self):
self.test_files_dir.joinpath('fail/record_test_result.json'))

self.assert_json_orderless_equal(expected, payload)

@responses.activate
def test_record_empty_dir(self):
path = 'latest/gtest_*_results.xml'
result = self.cli('record', 'tests', '--session', self.session,
'googletest', path)
self.assertEqual(result.output.rstrip(
'\n'), "No matches found: {}".format(path))
self.assertEqual(result.exit_code, 0)

0 comments on commit d4d15d0

Please sign in to comment.