Skip to content

Commit

Permalink
Merge pull request #135 from launchableinc/test-count-diagnostics
Browse files Browse the repository at this point in the history
Test count diagnostics
  • Loading branch information
kohsuke authored Feb 5, 2021
2 parents 7932a17 + 2039ce1 commit ba6f2c0
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions launchable/commands/record/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,11 @@ def scan(self, base, pattern):
def run(self):
token, org, workspace = parse_token()

count = 0 # count number of test cases sent

# generator that creates the payload incrementally
def payload():
nonlocal count
yield '{"events": ['
first = True # used to control ',' in printing

Expand All @@ -139,6 +142,7 @@ def payload():
if not first:
yield ','
first = False
count += 1

yield json.dumps(CaseEvent.from_case_and_suite(self.path_builder, case, suite, p))
yield ']}'
Expand Down Expand Up @@ -167,6 +171,9 @@ def printer(f):
res.raise_for_status()
res = client.request("patch", "{}/close".format(session_id), headers=headers)
res.raise_for_status()
click.echo("Processed {} tests".format(count))
if count==0:
click.echo(click.style("Looks like tests didn't run? If not, make sure the right files/directories are passed",'yellow'))
except Exception as e:
if os.getenv(REPORT_ERROR_KEY):
raise e
Expand Down

0 comments on commit ba6f2c0

Please sign in to comment.