tenzir-test 0.9.4__tar.gz → 0.9.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 (81) hide show
  1. {tenzir_test-0.9.4 → tenzir_test-0.9.5}/PKG-INFO +1 -31
  2. {tenzir_test-0.9.4 → tenzir_test-0.9.5}/README.md +0 -30
  3. {tenzir_test-0.9.4 → tenzir_test-0.9.5}/pyproject.toml +1 -1
  4. {tenzir_test-0.9.4 → tenzir_test-0.9.5}/src/tenzir_test/run.py +23 -11
  5. {tenzir_test-0.9.4 → tenzir_test-0.9.5}/.gitignore +0 -0
  6. {tenzir_test-0.9.4 → tenzir_test-0.9.5}/LICENSE +0 -0
  7. {tenzir_test-0.9.4 → tenzir_test-0.9.5}/example-project/README.md +0 -0
  8. {tenzir_test-0.9.4 → tenzir_test-0.9.5}/example-project/fixtures/README.md +0 -0
  9. {tenzir_test-0.9.4 → tenzir_test-0.9.5}/example-project/fixtures/__init__.py +0 -0
  10. {tenzir_test-0.9.4 → tenzir_test-0.9.5}/example-project/fixtures/http.py +0 -0
  11. {tenzir_test-0.9.4 → tenzir_test-0.9.5}/example-project/fixtures/server.py +0 -0
  12. {tenzir_test-0.9.4 → tenzir_test-0.9.5}/example-project/inputs/events.ndjson +0 -0
  13. {tenzir_test-0.9.4 → tenzir_test-0.9.5}/example-project/runners/__init__.py +0 -0
  14. {tenzir_test-0.9.4 → tenzir_test-0.9.5}/example-project/runners/xxd.py +0 -0
  15. {tenzir_test-0.9.4 → tenzir_test-0.9.5}/example-project/tests/context/01-context-create.tql +0 -0
  16. {tenzir_test-0.9.4 → tenzir_test-0.9.5}/example-project/tests/context/01-context-create.txt +0 -0
  17. {tenzir_test-0.9.4 → tenzir_test-0.9.5}/example-project/tests/context/02-context-update.tql +0 -0
  18. {tenzir_test-0.9.4 → tenzir_test-0.9.5}/example-project/tests/context/02-context-update.txt +0 -0
  19. {tenzir_test-0.9.4 → tenzir_test-0.9.5}/example-project/tests/context/03-context-inspect.tql +0 -0
  20. {tenzir_test-0.9.4 → tenzir_test-0.9.5}/example-project/tests/context/03-context-inspect.txt +0 -0
  21. {tenzir_test-0.9.4 → tenzir_test-0.9.5}/example-project/tests/context/test.yaml +0 -0
  22. {tenzir_test-0.9.4 → tenzir_test-0.9.5}/example-project/tests/fail.tql +0 -0
  23. {tenzir_test-0.9.4 → tenzir_test-0.9.5}/example-project/tests/fail.txt +0 -0
  24. {tenzir_test-0.9.4 → tenzir_test-0.9.5}/example-project/tests/hex/hello.txt +0 -0
  25. {tenzir_test-0.9.4 → tenzir_test-0.9.5}/example-project/tests/hex/hello.xxd +0 -0
  26. {tenzir_test-0.9.4 → tenzir_test-0.9.5}/example-project/tests/http-fixture.tql +0 -0
  27. {tenzir_test-0.9.4 → tenzir_test-0.9.5}/example-project/tests/http-fixture.txt +0 -0
  28. {tenzir_test-0.9.4 → tenzir_test-0.9.5}/example-project/tests/lazy.tql +0 -0
  29. {tenzir_test-0.9.4 → tenzir_test-0.9.5}/example-project/tests/lazy.txt +0 -0
  30. {tenzir_test-0.9.4 → tenzir_test-0.9.5}/example-project/tests/node-fixture.tql +0 -0
  31. {tenzir_test-0.9.4 → tenzir_test-0.9.5}/example-project/tests/node-fixture.txt +0 -0
  32. {tenzir_test-0.9.4 → tenzir_test-0.9.5}/example-project/tests/python/executor-only/sum.py +0 -0
  33. {tenzir_test-0.9.4 → tenzir_test-0.9.5}/example-project/tests/python/executor-only/sum.txt +0 -0
  34. {tenzir_test-0.9.4 → tenzir_test-0.9.5}/example-project/tests/python/executor-with-http-fixture/request.py +0 -0
  35. {tenzir_test-0.9.4 → tenzir_test-0.9.5}/example-project/tests/python/executor-with-http-fixture/request.txt +0 -0
  36. {tenzir_test-0.9.4 → tenzir_test-0.9.5}/example-project/tests/python/executor-with-http-fixture/test.yaml +0 -0
  37. {tenzir_test-0.9.4 → tenzir_test-0.9.5}/example-project/tests/python/executor-with-node-fixture/context-manager.py +0 -0
  38. {tenzir_test-0.9.4 → tenzir_test-0.9.5}/example-project/tests/python/executor-with-node-fixture/context-manager.txt +0 -0
  39. {tenzir_test-0.9.4 → tenzir_test-0.9.5}/example-project/tests/python/fixture-driving/manual_control.py +0 -0
  40. {tenzir_test-0.9.4 → tenzir_test-0.9.5}/example-project/tests/python/fixture-driving/manual_control.txt +0 -0
  41. {tenzir_test-0.9.4 → tenzir_test-0.9.5}/example-project/tests/python/pure-python/flaky_coin.py +0 -0
  42. {tenzir_test-0.9.4 → tenzir_test-0.9.5}/example-project/tests/python/pure-python/flaky_coin.txt +0 -0
  43. {tenzir_test-0.9.4 → tenzir_test-0.9.5}/example-project/tests/python/pure-python/hello_world.py +0 -0
  44. {tenzir_test-0.9.4 → tenzir_test-0.9.5}/example-project/tests/python/pure-python/hello_world.txt +0 -0
  45. {tenzir_test-0.9.4 → tenzir_test-0.9.5}/example-project/tests/read-inputs.tql +0 -0
  46. {tenzir_test-0.9.4 → tenzir_test-0.9.5}/example-project/tests/read-inputs.txt +0 -0
  47. {tenzir_test-0.9.4 → tenzir_test-0.9.5}/example-project/tests/shell/http-fixture-check.sh +0 -0
  48. {tenzir_test-0.9.4 → tenzir_test-0.9.5}/example-project/tests/shell/http-fixture-check.txt +0 -0
  49. {tenzir_test-0.9.4 → tenzir_test-0.9.5}/example-project/tests/shell/tmp-dir.sh +0 -0
  50. {tenzir_test-0.9.4 → tenzir_test-0.9.5}/example-project/tests/shell/tmp-dir.txt +0 -0
  51. {tenzir_test-0.9.4 → tenzir_test-0.9.5}/src/tenzir_test/__init__.py +0 -0
  52. {tenzir_test-0.9.4 → tenzir_test-0.9.5}/src/tenzir_test/_python_runner.py +0 -0
  53. {tenzir_test-0.9.4 → tenzir_test-0.9.5}/src/tenzir_test/checks.py +0 -0
  54. {tenzir_test-0.9.4 → tenzir_test-0.9.5}/src/tenzir_test/cli.py +0 -0
  55. {tenzir_test-0.9.4 → tenzir_test-0.9.5}/src/tenzir_test/config.py +0 -0
  56. {tenzir_test-0.9.4 → tenzir_test-0.9.5}/src/tenzir_test/engine/__init__.py +0 -0
  57. {tenzir_test-0.9.4 → tenzir_test-0.9.5}/src/tenzir_test/engine/operations.py +0 -0
  58. {tenzir_test-0.9.4 → tenzir_test-0.9.5}/src/tenzir_test/engine/registry.py +0 -0
  59. {tenzir_test-0.9.4 → tenzir_test-0.9.5}/src/tenzir_test/engine/state.py +0 -0
  60. {tenzir_test-0.9.4 → tenzir_test-0.9.5}/src/tenzir_test/engine/worker.py +0 -0
  61. {tenzir_test-0.9.4 → tenzir_test-0.9.5}/src/tenzir_test/fixtures/__init__.py +0 -0
  62. {tenzir_test-0.9.4 → tenzir_test-0.9.5}/src/tenzir_test/fixtures/node.py +0 -0
  63. {tenzir_test-0.9.4 → tenzir_test-0.9.5}/src/tenzir_test/packages.py +0 -0
  64. {tenzir_test-0.9.4 → tenzir_test-0.9.5}/src/tenzir_test/py.typed +0 -0
  65. {tenzir_test-0.9.4 → tenzir_test-0.9.5}/src/tenzir_test/runners/__init__.py +0 -0
  66. {tenzir_test-0.9.4 → tenzir_test-0.9.5}/src/tenzir_test/runners/_utils.py +0 -0
  67. {tenzir_test-0.9.4 → tenzir_test-0.9.5}/src/tenzir_test/runners/custom_python_fixture_runner.py +0 -0
  68. {tenzir_test-0.9.4 → tenzir_test-0.9.5}/src/tenzir_test/runners/diff_runner.py +0 -0
  69. {tenzir_test-0.9.4 → tenzir_test-0.9.5}/src/tenzir_test/runners/ext_runner.py +0 -0
  70. {tenzir_test-0.9.4 → tenzir_test-0.9.5}/src/tenzir_test/runners/runner.py +0 -0
  71. {tenzir_test-0.9.4 → tenzir_test-0.9.5}/src/tenzir_test/runners/shell_runner.py +0 -0
  72. {tenzir_test-0.9.4 → tenzir_test-0.9.5}/src/tenzir_test/runners/tenzir_runner.py +0 -0
  73. {tenzir_test-0.9.4 → tenzir_test-0.9.5}/src/tenzir_test/runners/tql_runner.py +0 -0
  74. {tenzir_test-0.9.4 → tenzir_test-0.9.5}/tests/test_cli.py +0 -0
  75. {tenzir_test-0.9.4 → tenzir_test-0.9.5}/tests/test_config.py +0 -0
  76. {tenzir_test-0.9.4 → tenzir_test-0.9.5}/tests/test_engine_operations.py +0 -0
  77. {tenzir_test-0.9.4 → tenzir_test-0.9.5}/tests/test_python_runner.py +0 -0
  78. {tenzir_test-0.9.4 → tenzir_test-0.9.5}/tests/test_run.py +0 -0
  79. {tenzir_test-0.9.4 → tenzir_test-0.9.5}/tests/test_run_config.py +0 -0
  80. {tenzir_test-0.9.4 → tenzir_test-0.9.5}/tests/test_runner_registry.py +0 -0
  81. {tenzir_test-0.9.4 → tenzir_test-0.9.5}/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.9.4
3
+ Version: 0.9.5
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
@@ -55,36 +55,6 @@ uvx tenzir-test --help
55
55
  `uvx` downloads the newest compatible release, runs it in an isolated
56
56
  environment, and caches subsequent invocations for fast reuse.
57
57
 
58
- ## 🚀 Quick Start
59
-
60
- Create a project skeleton that mirrors the layout the harness expects:
61
-
62
- ```text
63
- project-root/
64
- ├── fixtures/
65
- │ └── http.py
66
- ├── inputs/
67
- │ └── sample.ndjson
68
- ├── runners/
69
- │ └── __init__.py
70
- └── tests/
71
- ├── alerts/
72
- │ ├── sample.py
73
- │ └── sample.txt
74
- └── regression/
75
- ├── dummy.tql
76
- └── dummy.txt
77
- ```
78
-
79
- 1. Author fixtures in `fixtures/` and register them at import time.
80
- 2. Store reusable datasets in `inputs/`—the harness exposes the path via
81
- `TENZIR_INPUTS` and provides a per-test scratch directory through
82
- `TENZIR_TMP_DIR` when tests execute.
83
- Use `--keep` (or `-k`) to preserve those temporary directories for debugging.
84
- 3. Create tests in `tests/` and pair them with reference artifacts (for example
85
- `.txt`) that the harness compares against.
86
- 4. Run `uvx tenzir-test` from the project root to execute the full suite.
87
-
88
58
  ## 📚 Documentation
89
59
 
90
60
  Consult our [user guide](https://docs.tenzir.com/guides/testing/write-tests)
@@ -26,36 +26,6 @@ uvx tenzir-test --help
26
26
  `uvx` downloads the newest compatible release, runs it in an isolated
27
27
  environment, and caches subsequent invocations for fast reuse.
28
28
 
29
- ## 🚀 Quick Start
30
-
31
- Create a project skeleton that mirrors the layout the harness expects:
32
-
33
- ```text
34
- project-root/
35
- ├── fixtures/
36
- │ └── http.py
37
- ├── inputs/
38
- │ └── sample.ndjson
39
- ├── runners/
40
- │ └── __init__.py
41
- └── tests/
42
- ├── alerts/
43
- │ ├── sample.py
44
- │ └── sample.txt
45
- └── regression/
46
- ├── dummy.tql
47
- └── dummy.txt
48
- ```
49
-
50
- 1. Author fixtures in `fixtures/` and register them at import time.
51
- 2. Store reusable datasets in `inputs/`—the harness exposes the path via
52
- `TENZIR_INPUTS` and provides a per-test scratch directory through
53
- `TENZIR_TMP_DIR` when tests execute.
54
- Use `--keep` (or `-k`) to preserve those temporary directories for debugging.
55
- 3. Create tests in `tests/` and pair them with reference artifacts (for example
56
- `.txt`) that the harness compares against.
57
- 4. Run `uvx tenzir-test` from the project root to execute the full suite.
58
-
59
29
  ## 📚 Documentation
60
30
 
61
31
  Consult our [user guide](https://docs.tenzir.com/guides/testing/write-tests)
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "tenzir-test"
3
- version = "0.9.4"
3
+ version = "0.9.5"
4
4
  description = "Reusable test execution framework extracted from the Tenzir repository."
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.12"
@@ -349,6 +349,7 @@ _TMP_ROOT_NAME = ".tenzir-test"
349
349
  _TMP_SUBDIR_NAME = "tmp"
350
350
  _TMP_BASE_DIRS: set[Path] = set()
351
351
  _ACTIVE_TMP_DIRS: set[Path] = set()
352
+ _TMP_DIR_LOCK = threading.Lock()
352
353
  KEEP_TMP_DIRS = bool(os.environ.get(_TMP_KEEP_ENV_VAR))
353
354
 
354
355
  SHOW_DIFF_OUTPUT = True
@@ -506,10 +507,13 @@ def _tmp_prefix_for(test: Path) -> str:
506
507
 
507
508
 
508
509
  def _create_test_tmp_dir(test: Path) -> Path:
509
- base = _resolve_tmp_base()
510
510
  prefix = f"{_tmp_prefix_for(test)}-"
511
- path = Path(tempfile.mkdtemp(prefix=prefix, dir=str(base)))
512
- _ACTIVE_TMP_DIRS.add(path)
511
+ with _TMP_DIR_LOCK:
512
+ base = _resolve_tmp_base()
513
+ if not base.exists():
514
+ base.mkdir(parents=True, exist_ok=True)
515
+ path = Path(tempfile.mkdtemp(prefix=prefix, dir=str(base)))
516
+ _ACTIVE_TMP_DIRS.add(path)
513
517
  return path
514
518
 
515
519
 
@@ -522,22 +526,27 @@ def cleanup_test_tmp_dir(path: str | os.PathLike[str] | None) -> None:
522
526
  if not path:
523
527
  return
524
528
  tmp_path = Path(path)
525
- _ACTIVE_TMP_DIRS.discard(tmp_path)
529
+ with _TMP_DIR_LOCK:
530
+ _ACTIVE_TMP_DIRS.discard(tmp_path)
526
531
  try:
527
532
  fixtures_impl.invoke_tmp_dir_cleanup(tmp_path)
528
533
  except Exception: # pragma: no cover - defensive logging
529
534
  pass
530
535
  if KEEP_TMP_DIRS:
531
536
  return
532
- if tmp_path.exists():
533
- shutil.rmtree(tmp_path, ignore_errors=True)
534
- _cleanup_tmp_base_dirs()
537
+ with _TMP_DIR_LOCK:
538
+ if tmp_path.exists():
539
+ shutil.rmtree(tmp_path, ignore_errors=True)
540
+ _cleanup_tmp_base_dirs()
535
541
 
536
542
 
537
543
  def _cleanup_remaining_tmp_dirs() -> None:
538
- for tmp_path in list(_ACTIVE_TMP_DIRS):
544
+ with _TMP_DIR_LOCK:
545
+ remaining = list(_ACTIVE_TMP_DIRS)
546
+ for tmp_path in remaining:
539
547
  cleanup_test_tmp_dir(tmp_path)
540
- _cleanup_tmp_base_dirs()
548
+ with _TMP_DIR_LOCK:
549
+ _cleanup_tmp_base_dirs()
541
550
 
542
551
 
543
552
  def _cleanup_all_tmp_dirs() -> None:
@@ -545,9 +554,12 @@ def _cleanup_all_tmp_dirs() -> None:
545
554
 
546
555
  if KEEP_TMP_DIRS:
547
556
  return
548
- for tmp_path in list(_ACTIVE_TMP_DIRS):
557
+ with _TMP_DIR_LOCK:
558
+ remaining = list(_ACTIVE_TMP_DIRS)
559
+ for tmp_path in remaining:
549
560
  cleanup_test_tmp_dir(tmp_path)
550
- _cleanup_tmp_base_dirs()
561
+ with _TMP_DIR_LOCK:
562
+ _cleanup_tmp_base_dirs()
551
563
 
552
564
 
553
565
  def _cleanup_tmp_base_dirs() -> None:
File without changes
File without changes