charisma-cli 0.6.3__tar.gz → 0.6.5__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.
Files changed (39) hide show
  1. {charisma_cli-0.6.3 → charisma_cli-0.6.5}/.gitignore +7 -0
  2. {charisma_cli-0.6.3 → charisma_cli-0.6.5}/PKG-INFO +1 -1
  3. {charisma_cli-0.6.3 → charisma_cli-0.6.5}/pyproject.toml +1 -1
  4. {charisma_cli-0.6.3 → charisma_cli-0.6.5}/src/charisma_cli/__init__.py +1 -1
  5. {charisma_cli-0.6.3 → charisma_cli-0.6.5}/src/charisma_cli/config.py +9 -0
  6. {charisma_cli-0.6.3 → charisma_cli-0.6.5}/src/charisma_cli/read_models.py +6 -3
  7. {charisma_cli-0.6.3 → charisma_cli-0.6.5}/src/charisma_cli/uploader.py +7 -1
  8. {charisma_cli-0.6.3 → charisma_cli-0.6.5}/tests/test_read_client_pagination.py +11 -6
  9. {charisma_cli-0.6.3 → charisma_cli-0.6.5}/tests/test_uploader.py +13 -0
  10. {charisma_cli-0.6.3 → charisma_cli-0.6.5}/README.md +0 -0
  11. {charisma_cli-0.6.3 → charisma_cli-0.6.5}/src/charisma_cli/launch_url.py +0 -0
  12. {charisma_cli-0.6.3 → charisma_cli-0.6.5}/src/charisma_cli/main.py +0 -0
  13. {charisma_cli-0.6.3 → charisma_cli-0.6.5}/src/charisma_cli/models.py +0 -0
  14. {charisma_cli-0.6.3 → charisma_cli-0.6.5}/src/charisma_cli/parser.py +0 -0
  15. {charisma_cli-0.6.3 → charisma_cli-0.6.5}/src/charisma_cli/read_client.py +0 -0
  16. {charisma_cli-0.6.3 → charisma_cli-0.6.5}/src/charisma_cli/retry.py +0 -0
  17. {charisma_cli-0.6.3 → charisma_cli-0.6.5}/src/charisma_cli/subprocess_mgr.py +0 -0
  18. {charisma_cli-0.6.3 → charisma_cli-0.6.5}/src/charisma_cli/watcher.py +0 -0
  19. {charisma_cli-0.6.3 → charisma_cli-0.6.5}/tests/__init__.py +0 -0
  20. {charisma_cli-0.6.3 → charisma_cli-0.6.5}/tests/conftest.py +0 -0
  21. {charisma_cli-0.6.3 → charisma_cli-0.6.5}/tests/test_bamboo_labels.py +0 -0
  22. {charisma_cli-0.6.3 → charisma_cli-0.6.5}/tests/test_cli.py +0 -0
  23. {charisma_cli-0.6.3 → charisma_cli-0.6.5}/tests/test_config.py +0 -0
  24. {charisma_cli-0.6.3 → charisma_cli-0.6.5}/tests/test_integration.py +0 -0
  25. {charisma_cli-0.6.3 → charisma_cli-0.6.5}/tests/test_launch_url.py +0 -0
  26. {charisma_cli-0.6.3 → charisma_cli-0.6.5}/tests/test_models.py +0 -0
  27. {charisma_cli-0.6.3 → charisma_cli-0.6.5}/tests/test_open_launch_payload.py +0 -0
  28. {charisma_cli-0.6.3 → charisma_cli-0.6.5}/tests/test_parser.py +0 -0
  29. {charisma_cli-0.6.3 → charisma_cli-0.6.5}/tests/test_read_client.py +0 -0
  30. {charisma_cli-0.6.3 → charisma_cli-0.6.5}/tests/test_read_client_attachments.py +0 -0
  31. {charisma_cli-0.6.3 → charisma_cli-0.6.5}/tests/test_read_client_integration.py +0 -0
  32. {charisma_cli-0.6.3 → charisma_cli-0.6.5}/tests/test_read_client_launches.py +0 -0
  33. {charisma_cli-0.6.3 → charisma_cli-0.6.5}/tests/test_read_client_results.py +0 -0
  34. {charisma_cli-0.6.3 → charisma_cli-0.6.5}/tests/test_read_client_single_result.py +0 -0
  35. {charisma_cli-0.6.3 → charisma_cli-0.6.5}/tests/test_retry.py +0 -0
  36. {charisma_cli-0.6.3 → charisma_cli-0.6.5}/tests/test_silent_mode.py +0 -0
  37. {charisma_cli-0.6.3 → charisma_cli-0.6.5}/tests/test_subprocess_mgr.py +0 -0
  38. {charisma_cli-0.6.3 → charisma_cli-0.6.5}/tests/test_testplan_cmd.py +0 -0
  39. {charisma_cli-0.6.3 → charisma_cli-0.6.5}/tests/test_watcher.py +0 -0
@@ -152,3 +152,10 @@ allure-results-live/
152
152
 
153
153
  # sql files for locally run DB queries
154
154
  /*.sql
155
+
156
+ # testmon local selection cache (per machine, rebuilt from the working tree)
157
+ .testmondata
158
+ backend/.testmondata
159
+
160
+ # Local MCP server config (contains credentials)
161
+ .mcp.json
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: charisma-cli
3
- Version: 0.6.3
3
+ Version: 0.6.5
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
@@ -5,7 +5,7 @@ build-backend = "hatchling.build"
5
5
 
6
6
  [project]
7
7
  name = "charisma-cli"
8
- version = "0.6.3"
8
+ version = "0.6.5"
9
9
  description = "CLI tool that watches allure-results and streams test results + attachments to Charisma."
10
10
  readme = "README.md"
11
11
  license = "MIT"
@@ -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.6.3"
7
+ __version__ = "0.6.5"
@@ -50,6 +50,8 @@ class Config:
50
50
  name: str | None = None
51
51
  tags: list[str] | None = None
52
52
  run_key: str | None = None
53
+ # Charisma rerun job run this build reports for (sent on close).
54
+ job_run_id: str | None = None
53
55
 
54
56
  @classmethod
55
57
  def from_env(
@@ -117,6 +119,12 @@ class Config:
117
119
  resolved_project = (project or os.getenv("CHARISMA_PROJECT_ID", "")).strip()
118
120
  resolved_results = results or os.getenv("CHARISMA_RESULTS", "allure-results")
119
121
  resolved_run_key = (run_key or os.getenv("CHARISMA_RUN_KEY", "")).strip() or None
122
+ # A Charisma-triggered rerun passes charisma_job_run_id as a Bamboo build
123
+ # variable, which Bamboo exposes to every task as bamboo_charisma_job_run_id,
124
+ # so no plan change is needed to report the close into that job run.
125
+ resolved_job_run_id = (
126
+ os.getenv("CHARISMA_JOB_RUN_ID") or os.getenv("bamboo_charisma_job_run_id") or ""
127
+ ).strip() or None
120
128
  resolved_component = (component or _resolve_env("COMPONENT") or "").strip() or None
121
129
  resolved_source_url = (source_url or _resolve_env("SOURCE_URL") or "").strip() or None
122
130
  resolved_build_plan_key = (build_plan_key or _resolve_env("BUILD_PLAN_KEY") or "").strip() or None
@@ -185,4 +193,5 @@ class Config:
185
193
  name=resolved_name,
186
194
  tags=resolved_tags,
187
195
  run_key=resolved_run_key,
196
+ job_run_id=resolved_job_run_id,
188
197
  )
@@ -53,9 +53,7 @@ class _CamelModel(BaseModel):
53
53
  new server fields. Dump the wire form with ``model_dump(by_alias=True)``.
54
54
  """
55
55
 
56
- model_config = ConfigDict(
57
- alias_generator=to_camel, populate_by_name=True, extra="allow"
58
- )
56
+ model_config = ConfigDict(alias_generator=to_camel, populate_by_name=True, extra="allow")
59
57
 
60
58
 
61
59
  class _SnakeModel(BaseModel):
@@ -157,6 +155,8 @@ class TestResultRecord(_CamelModel):
157
155
  populated; from the single-result path they are always empty lists.
158
156
  """
159
157
 
158
+ __test__ = False
159
+
160
160
  id: str
161
161
  launch_id: str
162
162
  launch_created_at: datetime | None = None
@@ -303,6 +303,7 @@ class StabilityResultRecord(_SnakeModel):
303
303
  class TestCaseHistoryRecord(_SnakeModel):
304
304
  """Composite cross-run history: executions + stability + badge."""
305
305
 
306
+ __test__ = False
306
307
  history_id: str
307
308
  name: str
308
309
  executions: list[ExecutionEntryRecord]
@@ -318,6 +319,7 @@ class TestCaseHistoryRecord(_SnakeModel):
318
319
  class TestPlanEntry(_CamelModel):
319
320
  """One planned test: exact node ID (``selector``) or a fallback identity."""
320
321
 
322
+ __test__ = False
321
323
  selector: str | None = None
322
324
  full_name: str | None = None
323
325
  name: str
@@ -338,5 +340,6 @@ class TestPlanEntry(_CamelModel):
338
340
  class TestPlan(_CamelModel):
339
341
  """The rerun test plan served by ``GET .../launches/{launchId}/test-plan``."""
340
342
 
343
+ __test__ = False
341
344
  version: str
342
345
  tests: list[TestPlanEntry]
@@ -460,7 +460,13 @@ class Uploader:
460
460
  if self._launch_id is None:
461
461
  return
462
462
 
463
- body = {"variables": variables} if variables else None
463
+ payload: dict[str, object] = {}
464
+ if variables:
465
+ payload["variables"] = variables
466
+ if self._config.job_run_id:
467
+ # A rerun reports into its job run, so Charisma keeps the launch's own variables.
468
+ payload["jobRunId"] = self._config.job_run_id
469
+ body = payload or None
464
470
 
465
471
  for attempt in range(MAX_RETRIES + 1):
466
472
  try:
@@ -45,6 +45,14 @@ def _make_client() -> CharismaReadClient:
45
45
  return CharismaReadClient(ENDPOINT, TOKEN, PROJECT_UUID)
46
46
 
47
47
 
48
+ # Built once: client construction is slow (~0.5s) and would exceed Hypothesis' per-example deadline.
49
+ _PROPERTY_CLIENT = _make_client()
50
+
51
+
52
+ # Built once: client construction is slow (~0.5s) and would exceed Hypothesis' per-example deadline.
53
+ _PROPERTY_CLIENT = _make_client()
54
+
55
+
48
56
  class _FakePagedEndpoint:
49
57
  """In-memory ``fetch`` callable emulating the server's offset/limit paging.
50
58
 
@@ -94,9 +102,8 @@ class TestIterPagesProperty:
94
102
  """
95
103
  items = list(range(n_items))
96
104
  fetch = _FakePagedEndpoint(items)
97
- client = _make_client()
98
105
 
99
- collected = list(client.iter_pages(fetch, page_size=page_size))
106
+ collected = list(_PROPERTY_CLIENT.iter_pages(fetch, page_size=page_size))
100
107
 
101
108
  assert collected == items
102
109
 
@@ -118,9 +125,8 @@ class TestIterPagesProperty:
118
125
  """
119
126
  items = list(range(n_items))
120
127
  fetch = _FakePagedEndpoint(items)
121
- client = _make_client()
122
128
 
123
- list(client.iter_pages(fetch, page_size=page_size))
129
+ list(_PROPERTY_CLIENT.iter_pages(fetch, page_size=page_size))
124
130
 
125
131
  full_pages = n_items // page_size
126
132
  has_remainder = n_items % page_size != 0
@@ -143,9 +149,8 @@ class TestIterPagesProperty:
143
149
  """
144
150
  items = list(range(n_items))
145
151
  fetch = _FakePagedEndpoint(items)
146
- client = _make_client()
147
152
 
148
- list(client.iter_pages(fetch, page_size=page_size))
153
+ list(_PROPERTY_CLIENT.iter_pages(fetch, page_size=page_size))
149
154
 
150
155
  offsets = [offset for offset, _, _ in fetch.calls]
151
156
  expected_offsets = [i * page_size for i in range(len(offsets))]
@@ -2339,3 +2339,16 @@ class TestAttachmentUploadPreservation:
2339
2339
  uploader._upload_attachment(path, "rid-1")
2340
2340
 
2341
2341
  assert calls[0][1]["display_name"] == filename
2342
+
2343
+
2344
+ @respx.mock
2345
+ def test_close_reports_the_bamboo_job_run_id(monkeypatch) -> None:
2346
+ """Regression: a rerun's close carried no job-run id, so Charisma treated it as a new producer."""
2347
+ for k, v in {"CHARISMA_ENDPOINT": "https://charisma.test", "CHARISMA_TOKEN": "t",
2348
+ "CHARISMA_PROJECT_ID": "p", "bamboo_charisma_job_run_id": "jr-1"}.items():
2349
+ monkeypatch.setenv(k, v)
2350
+ route = respx.post("https://charisma.test/api/v1/launches/l-1/close").mock(return_value=httpx.Response(200))
2351
+ uploader = Uploader(Config.from_env(), PriorityQueue())
2352
+ uploader._launch_id = "l-1"
2353
+ uploader.close_launch(variables={"a": "b"})
2354
+ assert json.loads(route.calls[0].request.content) == {"variables": {"a": "b"}, "jobRunId": "jr-1"}
File without changes