tenzir-test 0.10.0__tar.gz → 0.12.0__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 (83) hide show
  1. {tenzir_test-0.10.0 → tenzir_test-0.12.0}/PKG-INFO +1 -1
  2. {tenzir_test-0.10.0 → tenzir_test-0.12.0}/pyproject.toml +1 -1
  3. {tenzir_test-0.10.0 → tenzir_test-0.12.0}/src/tenzir_test/__init__.py +6 -0
  4. {tenzir_test-0.10.0 → tenzir_test-0.12.0}/src/tenzir_test/cli.py +35 -24
  5. {tenzir_test-0.10.0 → tenzir_test-0.12.0}/src/tenzir_test/run.py +333 -71
  6. {tenzir_test-0.10.0 → tenzir_test-0.12.0}/src/tenzir_test/runners/custom_python_fixture_runner.py +5 -2
  7. {tenzir_test-0.10.0 → tenzir_test-0.12.0}/src/tenzir_test/runners/shell_runner.py +4 -2
  8. {tenzir_test-0.10.0 → tenzir_test-0.12.0}/tests/test_cli.py +61 -13
  9. {tenzir_test-0.10.0 → tenzir_test-0.12.0}/tests/test_run.py +130 -22
  10. {tenzir_test-0.10.0 → tenzir_test-0.12.0}/.gitignore +0 -0
  11. {tenzir_test-0.10.0 → tenzir_test-0.12.0}/LICENSE +0 -0
  12. {tenzir_test-0.10.0 → tenzir_test-0.12.0}/README.md +0 -0
  13. {tenzir_test-0.10.0 → tenzir_test-0.12.0}/example-project/README.md +0 -0
  14. {tenzir_test-0.10.0 → tenzir_test-0.12.0}/example-project/fixtures/README.md +0 -0
  15. {tenzir_test-0.10.0 → tenzir_test-0.12.0}/example-project/fixtures/__init__.py +0 -0
  16. {tenzir_test-0.10.0 → tenzir_test-0.12.0}/example-project/fixtures/http.py +0 -0
  17. {tenzir_test-0.10.0 → tenzir_test-0.12.0}/example-project/fixtures/server.py +0 -0
  18. {tenzir_test-0.10.0 → tenzir_test-0.12.0}/example-project/inputs/events.ndjson +0 -0
  19. {tenzir_test-0.10.0 → tenzir_test-0.12.0}/example-project/runners/__init__.py +0 -0
  20. {tenzir_test-0.10.0 → tenzir_test-0.12.0}/example-project/runners/xxd.py +0 -0
  21. {tenzir_test-0.10.0 → tenzir_test-0.12.0}/example-project/tests/context/01-context-create.tql +0 -0
  22. {tenzir_test-0.10.0 → tenzir_test-0.12.0}/example-project/tests/context/01-context-create.txt +0 -0
  23. {tenzir_test-0.10.0 → tenzir_test-0.12.0}/example-project/tests/context/02-context-update.tql +0 -0
  24. {tenzir_test-0.10.0 → tenzir_test-0.12.0}/example-project/tests/context/02-context-update.txt +0 -0
  25. {tenzir_test-0.10.0 → tenzir_test-0.12.0}/example-project/tests/context/03-context-inspect.tql +0 -0
  26. {tenzir_test-0.10.0 → tenzir_test-0.12.0}/example-project/tests/context/03-context-inspect.txt +0 -0
  27. {tenzir_test-0.10.0 → tenzir_test-0.12.0}/example-project/tests/context/test.yaml +0 -0
  28. {tenzir_test-0.10.0 → tenzir_test-0.12.0}/example-project/tests/fail.tql +0 -0
  29. {tenzir_test-0.10.0 → tenzir_test-0.12.0}/example-project/tests/fail.txt +0 -0
  30. {tenzir_test-0.10.0 → tenzir_test-0.12.0}/example-project/tests/hex/hello.txt +0 -0
  31. {tenzir_test-0.10.0 → tenzir_test-0.12.0}/example-project/tests/hex/hello.xxd +0 -0
  32. {tenzir_test-0.10.0 → tenzir_test-0.12.0}/example-project/tests/http-fixture.tql +0 -0
  33. {tenzir_test-0.10.0 → tenzir_test-0.12.0}/example-project/tests/http-fixture.txt +0 -0
  34. {tenzir_test-0.10.0 → tenzir_test-0.12.0}/example-project/tests/lazy.tql +0 -0
  35. {tenzir_test-0.10.0 → tenzir_test-0.12.0}/example-project/tests/lazy.txt +0 -0
  36. {tenzir_test-0.10.0 → tenzir_test-0.12.0}/example-project/tests/node-fixture.tql +0 -0
  37. {tenzir_test-0.10.0 → tenzir_test-0.12.0}/example-project/tests/node-fixture.txt +0 -0
  38. {tenzir_test-0.10.0 → tenzir_test-0.12.0}/example-project/tests/python/executor-only/sum.py +0 -0
  39. {tenzir_test-0.10.0 → tenzir_test-0.12.0}/example-project/tests/python/executor-only/sum.txt +0 -0
  40. {tenzir_test-0.10.0 → tenzir_test-0.12.0}/example-project/tests/python/executor-with-http-fixture/request.py +0 -0
  41. {tenzir_test-0.10.0 → tenzir_test-0.12.0}/example-project/tests/python/executor-with-http-fixture/request.txt +0 -0
  42. {tenzir_test-0.10.0 → tenzir_test-0.12.0}/example-project/tests/python/executor-with-http-fixture/test.yaml +0 -0
  43. {tenzir_test-0.10.0 → tenzir_test-0.12.0}/example-project/tests/python/executor-with-node-fixture/context-manager.py +0 -0
  44. {tenzir_test-0.10.0 → tenzir_test-0.12.0}/example-project/tests/python/executor-with-node-fixture/context-manager.txt +0 -0
  45. {tenzir_test-0.10.0 → tenzir_test-0.12.0}/example-project/tests/python/fixture-driving/manual_control.py +0 -0
  46. {tenzir_test-0.10.0 → tenzir_test-0.12.0}/example-project/tests/python/fixture-driving/manual_control.txt +0 -0
  47. {tenzir_test-0.10.0 → tenzir_test-0.12.0}/example-project/tests/python/pure-python/flaky_coin.py +0 -0
  48. {tenzir_test-0.10.0 → tenzir_test-0.12.0}/example-project/tests/python/pure-python/flaky_coin.txt +0 -0
  49. {tenzir_test-0.10.0 → tenzir_test-0.12.0}/example-project/tests/python/pure-python/hello_world.py +0 -0
  50. {tenzir_test-0.10.0 → tenzir_test-0.12.0}/example-project/tests/python/pure-python/hello_world.txt +0 -0
  51. {tenzir_test-0.10.0 → tenzir_test-0.12.0}/example-project/tests/read-inputs.tql +0 -0
  52. {tenzir_test-0.10.0 → tenzir_test-0.12.0}/example-project/tests/read-inputs.txt +0 -0
  53. {tenzir_test-0.10.0 → tenzir_test-0.12.0}/example-project/tests/shell/exit-code-test.sh +0 -0
  54. {tenzir_test-0.10.0 → tenzir_test-0.12.0}/example-project/tests/shell/exit-code-test.txt +0 -0
  55. {tenzir_test-0.10.0 → tenzir_test-0.12.0}/example-project/tests/shell/http-fixture-check.sh +0 -0
  56. {tenzir_test-0.10.0 → tenzir_test-0.12.0}/example-project/tests/shell/http-fixture-check.txt +0 -0
  57. {tenzir_test-0.10.0 → tenzir_test-0.12.0}/example-project/tests/shell/tmp-dir.sh +0 -0
  58. {tenzir_test-0.10.0 → tenzir_test-0.12.0}/example-project/tests/shell/tmp-dir.txt +0 -0
  59. {tenzir_test-0.10.0 → tenzir_test-0.12.0}/src/tenzir_test/_python_runner.py +0 -0
  60. {tenzir_test-0.10.0 → tenzir_test-0.12.0}/src/tenzir_test/checks.py +0 -0
  61. {tenzir_test-0.10.0 → tenzir_test-0.12.0}/src/tenzir_test/config.py +0 -0
  62. {tenzir_test-0.10.0 → tenzir_test-0.12.0}/src/tenzir_test/engine/__init__.py +0 -0
  63. {tenzir_test-0.10.0 → tenzir_test-0.12.0}/src/tenzir_test/engine/operations.py +0 -0
  64. {tenzir_test-0.10.0 → tenzir_test-0.12.0}/src/tenzir_test/engine/registry.py +0 -0
  65. {tenzir_test-0.10.0 → tenzir_test-0.12.0}/src/tenzir_test/engine/state.py +0 -0
  66. {tenzir_test-0.10.0 → tenzir_test-0.12.0}/src/tenzir_test/engine/worker.py +0 -0
  67. {tenzir_test-0.10.0 → tenzir_test-0.12.0}/src/tenzir_test/fixtures/__init__.py +0 -0
  68. {tenzir_test-0.10.0 → tenzir_test-0.12.0}/src/tenzir_test/fixtures/node.py +0 -0
  69. {tenzir_test-0.10.0 → tenzir_test-0.12.0}/src/tenzir_test/packages.py +0 -0
  70. {tenzir_test-0.10.0 → tenzir_test-0.12.0}/src/tenzir_test/py.typed +0 -0
  71. {tenzir_test-0.10.0 → tenzir_test-0.12.0}/src/tenzir_test/runners/__init__.py +0 -0
  72. {tenzir_test-0.10.0 → tenzir_test-0.12.0}/src/tenzir_test/runners/_utils.py +0 -0
  73. {tenzir_test-0.10.0 → tenzir_test-0.12.0}/src/tenzir_test/runners/diff_runner.py +0 -0
  74. {tenzir_test-0.10.0 → tenzir_test-0.12.0}/src/tenzir_test/runners/ext_runner.py +0 -0
  75. {tenzir_test-0.10.0 → tenzir_test-0.12.0}/src/tenzir_test/runners/runner.py +0 -0
  76. {tenzir_test-0.10.0 → tenzir_test-0.12.0}/src/tenzir_test/runners/tenzir_runner.py +0 -0
  77. {tenzir_test-0.10.0 → tenzir_test-0.12.0}/src/tenzir_test/runners/tql_runner.py +0 -0
  78. {tenzir_test-0.10.0 → tenzir_test-0.12.0}/tests/test_config.py +0 -0
  79. {tenzir_test-0.10.0 → tenzir_test-0.12.0}/tests/test_engine_operations.py +0 -0
  80. {tenzir_test-0.10.0 → tenzir_test-0.12.0}/tests/test_python_runner.py +0 -0
  81. {tenzir_test-0.10.0 → tenzir_test-0.12.0}/tests/test_run_config.py +0 -0
  82. {tenzir_test-0.10.0 → tenzir_test-0.12.0}/tests/test_runner_registry.py +0 -0
  83. {tenzir_test-0.10.0 → tenzir_test-0.12.0}/tests/test_shell_runner.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: tenzir-test
3
- Version: 0.10.0
3
+ Version: 0.12.0
4
4
  Summary: Reusable test execution framework extracted from the Tenzir repository.
5
5
  Project-URL: Homepage, https://github.com/tenzir/test
6
6
  Project-URL: Repository, https://github.com/tenzir/test
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "tenzir-test"
3
- version = "0.10.0"
3
+ version = "0.12.0"
4
4
  description = "Reusable test execution framework extracted from the Tenzir repository."
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.12"
@@ -3,6 +3,7 @@
3
3
  from importlib.metadata import PackageNotFoundError, version
4
4
 
5
5
  from . import run
6
+ from .run import ExecutionResult, HarnessError, ProjectResult, ensure_settings, execute
6
7
  from .config import Settings, discover_settings
7
8
  from .fixtures import (
8
9
  Executor,
@@ -32,9 +33,14 @@ __all__ = [
32
33
  "fixtures",
33
34
  "Settings",
34
35
  "discover_settings",
36
+ "ensure_settings",
37
+ "execute",
35
38
  "has",
36
39
  "register",
37
40
  "require",
41
+ "ExecutionResult",
42
+ "ProjectResult",
43
+ "HarnessError",
38
44
  "run",
39
45
  ]
40
46
 
@@ -152,41 +152,49 @@ def cli(
152
152
  jobs: int,
153
153
  passthrough: bool,
154
154
  all_projects: bool,
155
- ) -> None:
155
+ ) -> int:
156
156
  """Execute tenzir-test scenarios."""
157
157
 
158
158
  jobs_source = ctx.get_parameter_source("jobs")
159
159
  jobs_overridden = jobs_source is not click.core.ParameterSource.DEFAULT
160
160
 
161
- runtime.run_cli(
162
- root=root,
163
- tenzir_binary=tenzir_binary,
164
- tenzir_node_binary=tenzir_node_binary,
165
- tests=list(tests),
166
- update=update,
167
- debug=debug,
168
- purge=purge,
169
- coverage=coverage,
170
- coverage_source_dir=coverage_source_dir,
171
- runner_summary=runner_summary,
172
- fixture_summary=fixture_summary,
173
- show_summary=show_summary,
174
- show_diff_output=show_diff_output,
175
- show_diff_stat=show_diff_stat,
176
- keep_tmp_dirs=keep_tmp_dirs,
177
- jobs=jobs,
178
- passthrough=passthrough,
179
- jobs_overridden=jobs_overridden,
180
- all_projects=all_projects,
181
- )
161
+ try:
162
+ result = runtime.run_cli(
163
+ root=root,
164
+ tenzir_binary=tenzir_binary,
165
+ tenzir_node_binary=tenzir_node_binary,
166
+ tests=list(tests),
167
+ update=update,
168
+ debug=debug,
169
+ purge=purge,
170
+ coverage=coverage,
171
+ coverage_source_dir=coverage_source_dir,
172
+ runner_summary=runner_summary,
173
+ fixture_summary=fixture_summary,
174
+ show_summary=show_summary,
175
+ show_diff_output=show_diff_output,
176
+ show_diff_stat=show_diff_stat,
177
+ keep_tmp_dirs=keep_tmp_dirs,
178
+ jobs=jobs,
179
+ passthrough=passthrough,
180
+ jobs_overridden=jobs_overridden,
181
+ all_projects=all_projects,
182
+ )
183
+ except runtime.HarnessError as exc:
184
+ if exc.show_message and exc.args:
185
+ raise click.ClickException(str(exc)) from exc
186
+ return exc.exit_code
187
+ return result.exit_code
182
188
 
183
189
 
184
190
  def main(argv: Sequence[str] | None = None) -> int:
185
191
  """Run the Click command and translate Click exits to integer codes."""
186
192
 
187
193
  command_main = getattr(cli, "main")
194
+ previous_color_mode = runtime.get_color_mode()
195
+ runtime.set_color_mode(runtime.ColorMode.AUTO)
188
196
  try:
189
- command_main(
197
+ result = command_main(
190
198
  args=list(argv) if argv is not None else None,
191
199
  standalone_mode=False,
192
200
  )
@@ -198,7 +206,10 @@ def main(argv: Sequence[str] | None = None) -> int:
198
206
  return _normalize_exit_code(exit_code)
199
207
  except SystemExit as exc: # pragma: no cover - propagate runner exits
200
208
  return _normalize_exit_code(exc.code)
201
- return 0
209
+ else:
210
+ return _normalize_exit_code(result)
211
+ finally:
212
+ runtime.set_color_mode(previous_color_mode)
202
213
 
203
214
 
204
215
  if __name__ == "__main__":