charisma-cli 0.5.5__tar.gz → 0.6.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {charisma_cli-0.5.5 → charisma_cli-0.6.1}/PKG-INFO +18 -1
- {charisma_cli-0.5.5 → charisma_cli-0.6.1}/README.md +17 -0
- {charisma_cli-0.5.5 → charisma_cli-0.6.1}/pyproject.toml +1 -1
- {charisma_cli-0.5.5 → charisma_cli-0.6.1}/src/charisma_cli/__init__.py +1 -1
- {charisma_cli-0.5.5 → charisma_cli-0.6.1}/src/charisma_cli/main.py +62 -4
- {charisma_cli-0.5.5 → charisma_cli-0.6.1}/src/charisma_cli/models.py +1 -0
- {charisma_cli-0.5.5 → charisma_cli-0.6.1}/src/charisma_cli/parser.py +1 -0
- {charisma_cli-0.5.5 → charisma_cli-0.6.1}/src/charisma_cli/read_client.py +20 -0
- {charisma_cli-0.5.5 → charisma_cli-0.6.1}/src/charisma_cli/read_models.py +32 -0
- {charisma_cli-0.5.5 → charisma_cli-0.6.1}/src/charisma_cli/uploader.py +2 -0
- {charisma_cli-0.5.5 → charisma_cli-0.6.1}/src/charisma_cli/watcher.py +3 -2
- {charisma_cli-0.5.5 → charisma_cli-0.6.1}/tests/test_silent_mode.py +16 -1
- charisma_cli-0.6.1/tests/test_testplan_cmd.py +56 -0
- {charisma_cli-0.5.5 → charisma_cli-0.6.1}/tests/test_uploader.py +12 -0
- {charisma_cli-0.5.5 → charisma_cli-0.6.1}/tests/test_watcher.py +5 -0
- {charisma_cli-0.5.5 → charisma_cli-0.6.1}/.gitignore +0 -0
- {charisma_cli-0.5.5 → charisma_cli-0.6.1}/src/charisma_cli/config.py +0 -0
- {charisma_cli-0.5.5 → charisma_cli-0.6.1}/src/charisma_cli/launch_url.py +0 -0
- {charisma_cli-0.5.5 → charisma_cli-0.6.1}/src/charisma_cli/retry.py +0 -0
- {charisma_cli-0.5.5 → charisma_cli-0.6.1}/src/charisma_cli/subprocess_mgr.py +0 -0
- {charisma_cli-0.5.5 → charisma_cli-0.6.1}/tests/__init__.py +0 -0
- {charisma_cli-0.5.5 → charisma_cli-0.6.1}/tests/conftest.py +0 -0
- {charisma_cli-0.5.5 → charisma_cli-0.6.1}/tests/test_bamboo_labels.py +0 -0
- {charisma_cli-0.5.5 → charisma_cli-0.6.1}/tests/test_cli.py +0 -0
- {charisma_cli-0.5.5 → charisma_cli-0.6.1}/tests/test_config.py +0 -0
- {charisma_cli-0.5.5 → charisma_cli-0.6.1}/tests/test_integration.py +0 -0
- {charisma_cli-0.5.5 → charisma_cli-0.6.1}/tests/test_launch_url.py +0 -0
- {charisma_cli-0.5.5 → charisma_cli-0.6.1}/tests/test_models.py +0 -0
- {charisma_cli-0.5.5 → charisma_cli-0.6.1}/tests/test_open_launch_payload.py +0 -0
- {charisma_cli-0.5.5 → charisma_cli-0.6.1}/tests/test_parser.py +0 -0
- {charisma_cli-0.5.5 → charisma_cli-0.6.1}/tests/test_read_client.py +0 -0
- {charisma_cli-0.5.5 → charisma_cli-0.6.1}/tests/test_read_client_attachments.py +0 -0
- {charisma_cli-0.5.5 → charisma_cli-0.6.1}/tests/test_read_client_integration.py +0 -0
- {charisma_cli-0.5.5 → charisma_cli-0.6.1}/tests/test_read_client_launches.py +0 -0
- {charisma_cli-0.5.5 → charisma_cli-0.6.1}/tests/test_read_client_pagination.py +0 -0
- {charisma_cli-0.5.5 → charisma_cli-0.6.1}/tests/test_read_client_results.py +0 -0
- {charisma_cli-0.5.5 → charisma_cli-0.6.1}/tests/test_read_client_single_result.py +0 -0
- {charisma_cli-0.5.5 → charisma_cli-0.6.1}/tests/test_retry.py +0 -0
- {charisma_cli-0.5.5 → charisma_cli-0.6.1}/tests/test_subprocess_mgr.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: charisma-cli
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.6.1
|
|
4
4
|
Summary: CLI tool that watches allure-results and streams test results + attachments to Charisma.
|
|
5
5
|
Author: Charisma Team
|
|
6
6
|
License-Expression: MIT
|
|
@@ -120,6 +120,23 @@ summary or a Teams message:
|
|
|
120
120
|
# The same value can feed a Teams-notification step:
|
|
121
121
|
# text: "Results: ${{ steps.charisma.outputs.launch_url }}"
|
|
122
122
|
```
|
|
123
|
+
## Rerun test plan
|
|
124
|
+
|
|
125
|
+
On a Charisma-triggered Bamboo rerun, fetch the plan of failed/broken variants
|
|
126
|
+
before the test task (service token required; CI tokens cannot read launches):
|
|
127
|
+
|
|
128
|
+
```bash
|
|
129
|
+
charismactl testplan get --project "$PROJECT_UUID" --launch "$LAUNCH_UUID" \
|
|
130
|
+
[--statuses FAILED,BROKEN] --output testplan.json [--format json|pytest-args]
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
- `json` (default): for `pytest-charisma` via `CHARISMA_TESTPLAN_PATH=testplan.json`.
|
|
134
|
+
- `pytest-args`: one node ID per line for `pytest @testplan.txt`. Exits 1 if the plan
|
|
135
|
+
is empty or has a test a node ID cannot express (an empty list runs the whole suite).
|
|
136
|
+
|
|
137
|
+
`--endpoint`/`--token` fall back to `CHARISMA_ENDPOINT`/`CHARISMA_TOKEN`. `watch`/`upload`
|
|
138
|
+
also forward Allure `titlePath`, which Charisma uses to store each result's node ID.
|
|
139
|
+
|
|
123
140
|
## Read API
|
|
124
141
|
|
|
125
142
|
Alongside the write path (`watch`/`upload`), the package ships an importable **read client** for
|
|
@@ -94,6 +94,23 @@ summary or a Teams message:
|
|
|
94
94
|
# The same value can feed a Teams-notification step:
|
|
95
95
|
# text: "Results: ${{ steps.charisma.outputs.launch_url }}"
|
|
96
96
|
```
|
|
97
|
+
## Rerun test plan
|
|
98
|
+
|
|
99
|
+
On a Charisma-triggered Bamboo rerun, fetch the plan of failed/broken variants
|
|
100
|
+
before the test task (service token required; CI tokens cannot read launches):
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
charismactl testplan get --project "$PROJECT_UUID" --launch "$LAUNCH_UUID" \
|
|
104
|
+
[--statuses FAILED,BROKEN] --output testplan.json [--format json|pytest-args]
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
- `json` (default): for `pytest-charisma` via `CHARISMA_TESTPLAN_PATH=testplan.json`.
|
|
108
|
+
- `pytest-args`: one node ID per line for `pytest @testplan.txt`. Exits 1 if the plan
|
|
109
|
+
is empty or has a test a node ID cannot express (an empty list runs the whole suite).
|
|
110
|
+
|
|
111
|
+
`--endpoint`/`--token` fall back to `CHARISMA_ENDPOINT`/`CHARISMA_TOKEN`. `watch`/`upload`
|
|
112
|
+
also forward Allure `titlePath`, which Charisma uses to store each result's node ID.
|
|
113
|
+
|
|
97
114
|
## Read API
|
|
98
115
|
|
|
99
116
|
Alongside the write path (`watch`/`upload`), the package ships an importable **read client** for
|
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
# is generated from pyproject.toml [project].version, so keeping this literal
|
|
5
5
|
# equal to pyproject guarantees `--version` reports the published version. The
|
|
6
6
|
# prepare-commit step owns the PATCH bump — do not hand-bump here.
|
|
7
|
-
__version__ = "0.
|
|
7
|
+
__version__ = "0.6.1"
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"""CLI entry point for charismactl."""
|
|
2
2
|
|
|
3
|
+
import json
|
|
3
4
|
import signal
|
|
4
5
|
import sys
|
|
5
6
|
from collections.abc import Callable
|
|
@@ -13,6 +14,7 @@ from charisma_cli.config import Config
|
|
|
13
14
|
from charisma_cli.launch_url import build_launch_url, emit_github_output
|
|
14
15
|
from charisma_cli.models import FileEvent
|
|
15
16
|
from charisma_cli.parser import parse_environment_properties
|
|
17
|
+
from charisma_cli.read_client import CharismaReadClient, CharismaReadError
|
|
16
18
|
from charisma_cli.subprocess_mgr import SubprocessManager
|
|
17
19
|
from charisma_cli.uploader import Uploader
|
|
18
20
|
from charisma_cli.watcher import ResultsWatcher, classify_file
|
|
@@ -136,9 +138,15 @@ def _warn_if_results_unsent(uploader: Uploader, config: Config) -> None:
|
|
|
136
138
|
)
|
|
137
139
|
|
|
138
140
|
|
|
139
|
-
def _print_summary(uploader: Uploader) -> None:
|
|
140
|
-
"""Print the upload summary to stdout."""
|
|
141
|
+
def _print_summary(uploader: Uploader, config: Config) -> None:
|
|
142
|
+
"""Print the upload summary to stdout; under --silent also flag skips on stderr."""
|
|
141
143
|
summary = uploader.summary
|
|
144
|
+
if config.silent and summary.attachments_skipped:
|
|
145
|
+
click.echo(
|
|
146
|
+
f"Warning: {summary.attachments_skipped} attachment(s) skipped; "
|
|
147
|
+
"rerun without --silent to see which.",
|
|
148
|
+
err=True,
|
|
149
|
+
)
|
|
142
150
|
click.echo(
|
|
143
151
|
f"Summary: results_sent={summary.results_sent}, "
|
|
144
152
|
f"results_failed={summary.results_failed}, "
|
|
@@ -305,7 +313,7 @@ def watch(
|
|
|
305
313
|
uploader._client = None
|
|
306
314
|
|
|
307
315
|
_warn_if_results_unsent(uploader, config)
|
|
308
|
-
_print_summary(uploader)
|
|
316
|
+
_print_summary(uploader, config)
|
|
309
317
|
|
|
310
318
|
if not fully_drained:
|
|
311
319
|
click.echo(
|
|
@@ -397,7 +405,7 @@ def upload(
|
|
|
397
405
|
uploader.close_launch(variables=_read_launch_variables(config))
|
|
398
406
|
uploader.stop()
|
|
399
407
|
|
|
400
|
-
_print_summary(uploader)
|
|
408
|
+
_print_summary(uploader, config)
|
|
401
409
|
|
|
402
410
|
if not fully_drained:
|
|
403
411
|
click.echo(
|
|
@@ -407,3 +415,53 @@ def upload(
|
|
|
407
415
|
err=True,
|
|
408
416
|
)
|
|
409
417
|
sys.exit(1)
|
|
418
|
+
|
|
419
|
+
|
|
420
|
+
@cli.group()
|
|
421
|
+
def testplan() -> None:
|
|
422
|
+
"""Fetch the rerun test plan of a launch (failed/broken variants)."""
|
|
423
|
+
|
|
424
|
+
|
|
425
|
+
@testplan.command("get")
|
|
426
|
+
@click.option("--endpoint", envvar="CHARISMA_ENDPOINT", required=True, help="Charisma API endpoint.")
|
|
427
|
+
@click.option("--token", envvar="CHARISMA_TOKEN", required=True, help="Service token for the project.")
|
|
428
|
+
@click.option("--project", required=True, help="Project UUID, not the alias (charisma_project_id).")
|
|
429
|
+
@click.option("--launch", "launch_id", required=True, help="Launch UUID to rerun (charisma_launch_id).")
|
|
430
|
+
@click.option("--statuses", default=None, help="Comma-separated statuses (default: FAILED,BROKEN).")
|
|
431
|
+
@click.option("--output", type=click.Path(dir_okay=False, path_type=Path), required=True, help="File to write.")
|
|
432
|
+
@click.option(
|
|
433
|
+
"--format",
|
|
434
|
+
"fmt",
|
|
435
|
+
type=click.Choice(["json", "pytest-args"]),
|
|
436
|
+
default="json",
|
|
437
|
+
help="json: plan for pytest-charisma (CHARISMA_TESTPLAN_PATH). pytest-args: node IDs for `pytest @file`.",
|
|
438
|
+
)
|
|
439
|
+
def testplan_get(
|
|
440
|
+
endpoint: str, token: str, project: str, launch_id: str, statuses: str | None, output: Path, fmt: str
|
|
441
|
+
) -> None:
|
|
442
|
+
"""Write the rerun test plan of LAUNCH to OUTPUT.
|
|
443
|
+
|
|
444
|
+
Usage: charismactl testplan get --project <uuid> --launch <uuid> --output testplan.json
|
|
445
|
+
"""
|
|
446
|
+
try:
|
|
447
|
+
with CharismaReadClient(endpoint, token, project) as client:
|
|
448
|
+
plan = client.get_test_plan(launch_id, statuses)
|
|
449
|
+
except CharismaReadError as exc:
|
|
450
|
+
click.echo(f"Error: could not fetch the test plan: {exc}", err=True)
|
|
451
|
+
sys.exit(1)
|
|
452
|
+
|
|
453
|
+
exact = sum(1 for entry in plan.tests if entry.is_node_id)
|
|
454
|
+
fallback = len(plan.tests) - exact
|
|
455
|
+
if fmt == "pytest-args":
|
|
456
|
+
# An empty @file makes pytest run the whole suite; a function node ID reruns every variant.
|
|
457
|
+
if not plan.tests or fallback:
|
|
458
|
+
click.echo(
|
|
459
|
+
f"Error: {len(plan.tests)} planned test(s), {fallback} not expressible as a pytest node ID. "
|
|
460
|
+
"Use --format json with pytest-charisma (CHARISMA_TESTPLAN_PATH) instead.",
|
|
461
|
+
err=True,
|
|
462
|
+
)
|
|
463
|
+
sys.exit(1)
|
|
464
|
+
output.write_text("".join(f"{entry.selector}\n" for entry in plan.tests), encoding="utf-8")
|
|
465
|
+
else:
|
|
466
|
+
output.write_text(json.dumps(plan.model_dump(by_alias=True), indent=2), encoding="utf-8")
|
|
467
|
+
click.echo(f"Test plan: {len(plan.tests)} test(s) ({exact} exact, {fallback} fallback) -> {output}", err=True)
|
|
@@ -105,6 +105,7 @@ class CharismaResult:
|
|
|
105
105
|
started_at: int | None = None # epoch ms
|
|
106
106
|
ended_at: int | None = None # epoch ms
|
|
107
107
|
uuid: str | None = None # Allure UUID (for attachment linkage)
|
|
108
|
+
title_path: list[str] = field(default_factory=list) # Allure titlePath (backend builds the node ID)
|
|
108
109
|
|
|
109
110
|
|
|
110
111
|
@dataclass
|
|
@@ -36,6 +36,7 @@ from charisma_cli.read_models import (
|
|
|
36
36
|
PaginatedLaunchList,
|
|
37
37
|
PaginatedTestResults,
|
|
38
38
|
TestCaseHistoryRecord,
|
|
39
|
+
TestPlan,
|
|
39
40
|
TestResultRecord,
|
|
40
41
|
)
|
|
41
42
|
from charisma_cli.retry import MAX_RETRIES, RETRYABLE_STATUS_CODES, exponential_backoff
|
|
@@ -532,6 +533,25 @@ class CharismaReadClient:
|
|
|
532
533
|
"""
|
|
533
534
|
return self._get_model(self._project_path(f"results/{result_id}"), TestResultRecord)
|
|
534
535
|
|
|
536
|
+
def get_test_plan(self, launch_id: str, statuses: str | None = None) -> TestPlan:
|
|
537
|
+
"""Fetch the rerun test plan for a launch.
|
|
538
|
+
|
|
539
|
+
Args:
|
|
540
|
+
launch_id: The launch UUID.
|
|
541
|
+
statuses: Comma-separated statuses to include; ``None`` uses the server
|
|
542
|
+
default (failed + broken).
|
|
543
|
+
|
|
544
|
+
Returns:
|
|
545
|
+
The plan as a ``TestPlan``.
|
|
546
|
+
|
|
547
|
+
Raises:
|
|
548
|
+
CharismaNotFoundError: If the launch is not in this project (HTTP 404).
|
|
549
|
+
CharismaAuthError: On an auth failure.
|
|
550
|
+
CharismaReadError: On a 400 (bad status) or a persistent server failure.
|
|
551
|
+
"""
|
|
552
|
+
params: dict[str, object] | None = {"statuses": statuses} if statuses else None
|
|
553
|
+
return self._get_model(self._project_path(f"launches/{launch_id}/test-plan"), TestPlan, params)
|
|
554
|
+
|
|
535
555
|
def get_result_execution(self, result_id: str) -> ExecutionRecord:
|
|
536
556
|
"""Fetch the execution tree for a test result (FR-4).
|
|
537
557
|
|
|
@@ -308,3 +308,35 @@ class TestCaseHistoryRecord(_SnakeModel):
|
|
|
308
308
|
executions: list[ExecutionEntryRecord]
|
|
309
309
|
stability: StabilityResultRecord
|
|
310
310
|
status_change_badge: str | None = None
|
|
311
|
+
|
|
312
|
+
|
|
313
|
+
# ===========================================================================
|
|
314
|
+
# Rerun test plan (camelCase wire)
|
|
315
|
+
# ===========================================================================
|
|
316
|
+
|
|
317
|
+
|
|
318
|
+
class TestPlanEntry(_CamelModel):
|
|
319
|
+
"""One planned test: exact node ID (``selector``) or a fallback identity."""
|
|
320
|
+
|
|
321
|
+
selector: str | None = None
|
|
322
|
+
full_name: str | None = None
|
|
323
|
+
name: str
|
|
324
|
+
parameters: dict[str, str] = {}
|
|
325
|
+
|
|
326
|
+
@property
|
|
327
|
+
def is_node_id(self) -> bool:
|
|
328
|
+
"""True when ``selector`` alone picks exactly this variant.
|
|
329
|
+
|
|
330
|
+
A ``@allure.title`` variant carries the function node ID plus parameters;
|
|
331
|
+
as a bare node ID it would rerun every variant of that function.
|
|
332
|
+
"""
|
|
333
|
+
if self.selector is None:
|
|
334
|
+
return False
|
|
335
|
+
return self.selector.endswith("]") or not self.parameters
|
|
336
|
+
|
|
337
|
+
|
|
338
|
+
class TestPlan(_CamelModel):
|
|
339
|
+
"""The rerun test plan served by ``GET .../launches/{launchId}/test-plan``."""
|
|
340
|
+
|
|
341
|
+
version: str
|
|
342
|
+
tests: list[TestPlanEntry]
|
|
@@ -564,6 +564,8 @@ class Uploader:
|
|
|
564
564
|
payload["name"] = result.name
|
|
565
565
|
if result.full_name:
|
|
566
566
|
payload["full_name"] = result.full_name
|
|
567
|
+
if result.title_path:
|
|
568
|
+
payload["title_path"] = result.title_path
|
|
567
569
|
if result.error_message:
|
|
568
570
|
payload["error_message"] = self._spill_oversized_field(
|
|
569
571
|
result.error_message,
|
|
@@ -54,11 +54,12 @@ def classify_file(filename: str) -> FileCategory | None:
|
|
|
54
54
|
FileCategory.RESULT for *-result.json,
|
|
55
55
|
FileCategory.CONTAINER for *-container.json,
|
|
56
56
|
FileCategory.ATTACHMENT for all other valid files,
|
|
57
|
-
None for excluded files (dot-prefix
|
|
57
|
+
None for excluded files (dot-prefix, .tmp suffix, or environment.properties,
|
|
58
|
+
which is read separately as launch variables and has no owning result).
|
|
58
59
|
"""
|
|
59
60
|
if filename.startswith("."):
|
|
60
61
|
return None
|
|
61
|
-
if filename.endswith(".tmp"):
|
|
62
|
+
if filename.endswith(".tmp") or filename == "environment.properties":
|
|
62
63
|
return None
|
|
63
64
|
if filename.endswith("-result.json"):
|
|
64
65
|
return FileCategory.RESULT
|
|
@@ -5,10 +5,11 @@ from pathlib import Path
|
|
|
5
5
|
from queue import PriorityQueue
|
|
6
6
|
|
|
7
7
|
import httpx
|
|
8
|
+
import pytest
|
|
8
9
|
import respx
|
|
9
10
|
|
|
10
11
|
from charisma_cli.config import Config
|
|
11
|
-
from charisma_cli.models import FileCategory, FileEvent
|
|
12
|
+
from charisma_cli.models import FileCategory, FileEvent, UploadSummary
|
|
12
13
|
from charisma_cli.uploader import Uploader
|
|
13
14
|
|
|
14
15
|
|
|
@@ -215,3 +216,17 @@ class TestLaunchLifecycle:
|
|
|
215
216
|
uploader.close_launch()
|
|
216
217
|
|
|
217
218
|
uploader._client.close()
|
|
219
|
+
|
|
220
|
+
|
|
221
|
+
@pytest.mark.parametrize(("silent", "skipped", "warns"), [(True, 2, True), (True, 0, False), (False, 2, False)])
|
|
222
|
+
def test_silent_summary_warns_on_stderr_only_for_skips(capsys, silent: bool, skipped: int, warns: bool) -> None:
|
|
223
|
+
"""--silent still flags skipped attachments on stderr."""
|
|
224
|
+
from types import SimpleNamespace
|
|
225
|
+
|
|
226
|
+
from charisma_cli.main import _print_summary
|
|
227
|
+
|
|
228
|
+
uploader = SimpleNamespace(
|
|
229
|
+
summary=UploadSummary(attachments_skipped=skipped)
|
|
230
|
+
)
|
|
231
|
+
_print_summary(uploader, _make_config(silent=silent))
|
|
232
|
+
assert ("skipped" in capsys.readouterr().err) is warns
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"""`charismactl testplan get`: fetch the rerun test plan to a file."""
|
|
2
|
+
|
|
3
|
+
import json
|
|
4
|
+
from pathlib import Path
|
|
5
|
+
|
|
6
|
+
import httpx
|
|
7
|
+
import pytest
|
|
8
|
+
import respx
|
|
9
|
+
from click.testing import CliRunner
|
|
10
|
+
|
|
11
|
+
from charisma_cli.main import cli
|
|
12
|
+
|
|
13
|
+
ENDPOINT = "https://charisma.test"
|
|
14
|
+
PROJECT = "123e4567-e89b-12d3-a456-426614174000"
|
|
15
|
+
LAUNCH = "9f8e7d6c-5b4a-3210-fedc-ba9876543210"
|
|
16
|
+
PLAN_URL = f"{ENDPOINT}/api/v1/projects/{PROJECT}/launches/{LAUNCH}/test-plan"
|
|
17
|
+
|
|
18
|
+
EXACT = {"selector": "tests/t.py::test_a[x]", "fullName": "tests.t#test_a", "name": "test_a[x]", "parameters": {}}
|
|
19
|
+
TITLED = {"selector": "tests/t.py::test_b", "fullName": "tests.t#test_b", "name": "B", "parameters": {"u": "'x'"}}
|
|
20
|
+
NO_SELECTOR = {"selector": None, "fullName": "tests.t#test_c", "name": "test_c", "parameters": {}}
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def _run(tmp_path: Path, tests: list[dict], fmt: str) -> tuple[int, Path, respx.Route]:
|
|
24
|
+
route = respx.get(PLAN_URL).mock(return_value=httpx.Response(200, json={"version": "1.0", "tests": tests}))
|
|
25
|
+
out = tmp_path / "plan.out"
|
|
26
|
+
args = ["testplan", "get", "--endpoint", ENDPOINT, "--token", "t", "--project", PROJECT,
|
|
27
|
+
"--launch", LAUNCH, "--statuses", "FAILED", "--output", str(out), "--format", fmt]
|
|
28
|
+
result = CliRunner().invoke(cli, args)
|
|
29
|
+
return result.exit_code, out, route
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
@respx.mock
|
|
33
|
+
def test_json_format_writes_plan_and_sends_statuses(tmp_path: Path) -> None:
|
|
34
|
+
code, out, route = _run(tmp_path, [EXACT, NO_SELECTOR], "json")
|
|
35
|
+
|
|
36
|
+
assert code == 0
|
|
37
|
+
assert route.calls.last.request.url.params["statuses"] == "FAILED"
|
|
38
|
+
assert json.loads(out.read_text())["tests"][1]["fullName"] == "tests.t#test_c"
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
@respx.mock
|
|
42
|
+
def test_pytest_args_writes_one_selector_per_line(tmp_path: Path) -> None:
|
|
43
|
+
code, out, _ = _run(tmp_path, [EXACT, {**EXACT, "selector": "tests/t.py::test_d"}], "pytest-args")
|
|
44
|
+
|
|
45
|
+
assert code == 0
|
|
46
|
+
assert out.read_text().splitlines() == ["tests/t.py::test_a[x]", "tests/t.py::test_d"]
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
# An empty @file runs the whole suite; a function ID reruns every variant.
|
|
50
|
+
@pytest.mark.parametrize("tests", [[], [EXACT, NO_SELECTOR], [EXACT, TITLED]])
|
|
51
|
+
@respx.mock
|
|
52
|
+
def test_pytest_args_refuses_unexpressible_plan(tmp_path: Path, tests: list[dict]) -> None:
|
|
53
|
+
code, out, _ = _run(tmp_path, tests, "pytest-args")
|
|
54
|
+
|
|
55
|
+
assert code == 1
|
|
56
|
+
assert not out.exists()
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"""Unit tests for charisma_cli.uploader: batching, drain, priority ordering, error handling."""
|
|
2
2
|
|
|
3
|
+
import json
|
|
3
4
|
import threading
|
|
4
5
|
import time
|
|
5
6
|
from pathlib import Path
|
|
@@ -1885,6 +1886,17 @@ class TestUploaderTagLabels:
|
|
|
1885
1886
|
assert payload.get("tags") == ["smilevid"]
|
|
1886
1887
|
assert "tag" not in (payload.get("labels") or {})
|
|
1887
1888
|
|
|
1889
|
+
@respx.mock
|
|
1890
|
+
def test_title_path_forwarded_for_rerun_selector(self, tmp_path: Path) -> None:
|
|
1891
|
+
"""Allure titlePath reaches the wire so the backend can build the pytest node ID."""
|
|
1892
|
+
result_file = self._result_with_labels(tmp_path, [])
|
|
1893
|
+
data = json.loads(result_file.read_text(encoding="utf-8"))
|
|
1894
|
+
data["titlePath"] = ["tests", "test_auth.py", "TestLogin"]
|
|
1895
|
+
self._write_json(result_file, data)
|
|
1896
|
+
payload = self._upload_and_capture(_make_config(), result_file)
|
|
1897
|
+
|
|
1898
|
+
assert payload.get("title_path") == ["tests", "test_auth.py", "TestLogin"]
|
|
1899
|
+
|
|
1888
1900
|
@respx.mock
|
|
1889
1901
|
def test_duplicate_tag_values_deduped_in_encounter_order(self, tmp_path: Path) -> None:
|
|
1890
1902
|
"""Repeated identical tag values are de-duplicated, preserving first-seen order.
|
|
@@ -45,6 +45,11 @@ class TestClassifyFileContainerPattern:
|
|
|
45
45
|
assert classify_file("session-scope-container.json") == FileCategory.CONTAINER
|
|
46
46
|
|
|
47
47
|
|
|
48
|
+
def test_environment_properties_is_not_an_attachment() -> None:
|
|
49
|
+
# Regression: it was queued as an ownerless attachment (attachments_skipped=1 on every run).
|
|
50
|
+
assert classify_file("environment.properties") is None
|
|
51
|
+
|
|
52
|
+
|
|
48
53
|
class TestClassifyFileAttachmentFallback:
|
|
49
54
|
"""All other files are classified as ATTACHMENT."""
|
|
50
55
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|