-
Notifications
You must be signed in to change notification settings - Fork 13
Display a warning if total test duration is 0 #1084
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This outputs a CLI warning if the total test duration is 0 (before rounding) when user executes `launchable record tests`
| rows = [[file_count, test_count, success_count, fail_count, duration]] | ||
| click.echo(tabulate(rows, header, tablefmt="github", floatfmt=".2f")) | ||
|
|
||
| if duration == 0: |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
|
| rows = [[file_count, test_count, success_count, fail_count, duration]] | ||
| click.echo(tabulate(rows, header, tablefmt="github", floatfmt=".2f")) | ||
|
|
||
| if duration == 0: |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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`
There was a problem hiding this comment.
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." |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.



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