Skip to content

Commit 6db5552

Browse files
authored
Merge pull request #1152 from cloudbees-oss/nit-updates
Improvement
2 parents bb18079 + 212be34 commit 6db5552

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+338
-336
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ jobs:
8282
8383
function record() {
8484
# Record test results
85-
SMART_TESTS_SLACK_NOTIFICATION=true smart-tests record test file --session $(cat session.txt) test-results/*.xml
85+
SMART_TESTS_SLACK_NOTIFICATION=true smart-tests record tests file --session $(cat session.txt) test-results/*.xml
8686
}
8787
8888
trap record EXIT

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Usage
22

3-
See https://www.launchableinc.com/docs/resources/cli-reference/ and
4-
https://www.launchableinc.com/docs/getting-started/.
3+
See https://help.launchableinc.com/resources/cli-reference/ and
4+
https://help.launchableinc.com/sending-data-to-launchable/using-the-launchable-cli/getting-started/.
55

66
# Development
77

@@ -82,7 +82,7 @@ uv run poe install
8282
# Add runtime dependency
8383
uv add some-package
8484

85-
# Add development dependency
85+
# Add development dependency
8686
uv add --dev some-dev-package
8787
```
8888

pyproject.toml

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,23 @@
11
[project]
22
name = "smart-tests-cli"
3-
authors = [
4-
{name = "CloudBees", email = "[email protected]"}
5-
]
3+
authors = [{ name = "CloudBees", email = "[email protected]" }]
64
description = "Smart Tests CLI"
75
readme = "README.md"
8-
license = {text = "Apache Software License v2"}
6+
license = { text = "Apache Software License v2" }
97
requires-python = ">=3.13"
108
classifiers = [
119
"Programming Language :: Python :: 3",
1210
"License :: OSI Approved :: Apache Software License",
1311
"Operating System :: OS Independent",
1412
]
1513
dependencies = [
16-
"typer>=0.9.0",
17-
"requests>=2.25",
18-
"urllib3>=1.26",
14+
"typer>=0.19.1",
15+
"requests>=2.32.5",
16+
"urllib3>=2.5",
1917
"junitparser>=4.0.0",
2018
"more-itertools>=7.1.0",
21-
"python-dateutil",
22-
"tabulate",
19+
"python-dateutil>=2.9",
20+
"tabulate>=0.9",
2321
]
2422
dynamic = ["version"]
2523

@@ -37,7 +35,7 @@ dev-dependencies = [
3735
"mypy",
3836
"pre-commit",
3937
"responses",
40-
"types-pkg_resources",
38+
"types-setuptools",
4139
"types-python-dateutil",
4240
"types-requests",
4341
"types-tabulate",

smart_tests/__main__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,8 @@ def main(
157157
app.add_typer(detect_flakes_target_app, name="detect-flakes")
158158

159159
# Add record-target as a sub-app to record command
160-
record.app.add_typer(record_target_app, name="test") # Use NestedCommand version
161-
record.app.add_typer(record_target_app, name="tests") # Alias for backward compatibility
160+
record.app.add_typer(record_target_app, name="tests")
161+
162162
except Exception as e:
163163
logging.warning(f"Failed to use NestedCommand apps at init: {e}")
164164
# Fallback to original structure

smart_tests/commands/record/session.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ def session(
3232
help="Set test suite name. A test suite is a collection of test sessions. Setting a test suite allows you to "
3333
"manage data over test sessions and lineages."
3434
)],
35-
print_session: bool = True,
3635
flavors: Annotated[List[KeyValue], typer.Option(
3736
"--flavor",
3837
help="flavors",

smart_tests/commands/record/tests.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ class RecordTests:
155155
# A common mechanism to build ParseFunc by building JUnit XML report in-memory (or build it the usual way
156156
# and patch it to fix things up). This is handy as some libraries
157157
# produce invalid / broken JUnit reports
158-
JUnitXmlParseFunc = Callable[[str], ET.Element]
158+
JUnitXmlParseFunc = Callable[[str], ET.Element | ET.ElementTree]
159159

160160
@property
161161
def path_builder(self) -> CaseEvent.TestPathBuilder:

smart_tests/commands/subset.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,7 @@ def run(self):
438438
print_error_and_die("ERROR: Given arguments did not match any tests. They appear to be incorrect/non-existent.", tracking_client, Tracking.ErrorEvent.USER_ERROR) # noqa E501
439439
else:
440440
print_error_and_die(
441-
"ERROR: Expecting tests to be given, but none provided. See https://www.launchableinc.com/docs/features/predictive-test-selection/requesting-and-running-a-subset-of-tests/subsetting-with-the-launchable-cli/ and provide ones, or use the `--get-tests-from-previous-sessions` option", # noqa E501
441+
"ERROR: Expecting tests to be given, but none provided. See https://help.launchableinc.com/features/predictive-test-selection/requesting-and-running-a-subset-of-tests/ and provide ones, or use the `--get-tests-from-previous-sessions` option", # noqa E501
442442
tracking_client,
443443
Tracking.ErrorEvent.USER_ERROR)
444444

smart_tests/commands/verify.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ def check_java_version(javacmd: str) -> int:
6363
def verify(ctx: typer.Context):
6464
# Run the verification (no subcommands in this app)
6565
# In this command, regardless of REPORT_ERROR_KEY, always report an unexpected error with full stack trace
66-
# to assist troubleshooting. `click.UsageError` is handled by the invoking
66+
# to assist troubleshooting. `typer.BadParameter` is handled by the invoking
6767
# Click gracefully.
6868

6969
app_instance = ctx.obj

smart_tests/test_runners/behave.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import os
2-
from typing import Annotated, List
2+
from typing import Annotated, List, cast
33
from xml.etree import ElementTree as ET
44

55
import typer
@@ -18,7 +18,7 @@ def record_tests(
1818
client.report(r)
1919

2020
def parse_func(p: str) -> ET.ElementTree:
21-
tree = ET.parse(p)
21+
tree = cast(ET.ElementTree, ET.parse(p))
2222
for suite in tree.iter("testsuite"):
2323
if len(suite) == 0:
2424
continue

smart_tests/test_runners/cucumber.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from copy import deepcopy
66
from enum import Enum
77
from pathlib import Path
8-
from typing import Annotated, Dict, Generator, List
8+
from typing import Annotated, Dict, Generator, List, cast
99
from xml.etree import ElementTree as ET
1010

1111
import typer
@@ -41,7 +41,7 @@ def record_tests(
4141
_record_tests_from_xml(client, reports, report_file_and_test_file_map)
4242

4343
def parse_func(report: str) -> ET.ElementTree:
44-
tree = ET.parse(report)
44+
tree = cast(ET.ElementTree, ET.parse(report))
4545
for case in tree.findall("testcase"):
4646
case.attrib["file"] = str(report_file_and_test_file_map[report])
4747

0 commit comments

Comments
 (0)