Skip to content

Conversation

@gayanW
Copy link
Contributor

@gayanW gayanW commented Jul 25, 2025

This outputs a CLI warning if the total test duration is 0 (before rounding) when user executes launchable record tests

image

This outputs a CLI warning if the total test duration is 0 (before rounding) when user executes `launchable record tests`
@gayanW gayanW requested a review from ono-max July 25, 2025 06:00
rows = [[file_count, test_count, success_count, fail_count, duration]]
click.echo(tabulate(rows, header, tablefmt="github", floatfmt=".2f"))

if duration == 0:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please write a test for your change?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added a test case

@sonarqubecloud
Copy link

rows = [[file_count, test_count, success_count, fail_count, duration]]
click.echo(tabulate(rows, header, tablefmt="github", floatfmt=".2f"))

if duration == 0:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please check what the output looks like test case count is 0? I guess that another warning might be displayed. If so, this warning might be not necessary.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If test case count is zero it just prints the following and returns:
https://github.com/launchableinc/cli/blob/991e9197c1354f016cca60e2a4bced23638bac22/launchable/commands/record/tests.py#L618-L620

(cli) gweerakutti@gayans-macbook-pro cli % launchable record build --name "no_tests"                                              
/Users/gweerakutti/.local/share/virtualenvs/cli-JevRS2r6/lib/python3.9/site-packages/launchable/version.py:1: UserWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html. The pkg_resources package is slated for removal as early as 2025-11-30. Refrain from using this package or pin to Setuptools<81.
  from pkg_resources import DistributionNotFound, get_distribution
Launchable transferred 1 more commit from repository /Users/gweerakutti/Documents/code/github/launchableinc/cli
Launchable recorded build no_tests to workspace defaulttm/my-initial-tests with commits from 1 repository:

| Name   | Path   | HEAD Commit                              |
|--------|--------|------------------------------------------|
| .      | .      | 991e9197c1354f016cca60e2a4bced23638bac22 |

Visit https://app.launchableinc.com/organizations/defaulttm/workspaces/my-initial-tests/data/builds/4267492 to view this build and its test sessions
(cli) gweerakutti@gayans-macbook-pro cli % launchable record tests --allow-test-before-build file tests/data/broken_xml/no_testcase.xml 
/Users/gweerakutti/.local/share/virtualenvs/cli-JevRS2r6/lib/python3.9/site-packages/launchable/version.py:1: UserWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html. The pkg_resources package is slated for removal as early as 2025-11-30. Refrain from using this package or pin to Setuptools<81.
  from pkg_resources import DistributionNotFound, get_distribution
Looks like tests didn't run? If not, make sure the right files/directories were passed into `launchable record tests`

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

click.echo(tabulate(rows, header, tablefmt="github", floatfmt=".2f"))

if duration == 0:
click.echo(click.style("\nTotal test duration is 0."
Copy link
Contributor

@ono-max ono-max Jul 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you decide to output this warning before the URL information, such as Visit https://app.launchableinc.com/organizations/{organization}/workspaces/ ...? I wanna know the reason.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As it related to total duration shown in the table, I output it just after that. Other than that there's no particular reason. If it's better to output warnings at the end, as a practice, I can update it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, I just wanted to know the reason.

@gayanW gayanW merged commit f9755c1 into main Jul 28, 2025
15 checks passed
@gayanW gayanW deleted the AIENG-202 branch July 28, 2025 07:05
@github-actions github-actions bot mentioned this pull request Jul 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants