diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 7ccf9a5..0fac246 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -6,13 +6,13 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-latest] - python-version: [3.6, 3.7, 3.8] + os: [ubuntu-22.04] + python-version: ['3.8', '3.10', '3.11', '3.14.6'] runs-on: ${{ matrix.os }} steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - name: Test diff --git a/README.md b/README.md index 1df2030..9d8b2d5 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,51 @@ def example_tests(): test.assert_equals(add(1, 1), 2, 'Optional Message on Failure') ``` +### Assertion control flow and timeouts + +Assertions report a failure and continue by default. With `allow_raise=True`, +the assertion stops the current decorated block and reports its failure once. +The enclosing `it` or `describe` still closes normally, and its `after` hook +runs. At top level, the framework's assertion exception still propagates. + +`@test.timeout(seconds)` executes immediately in a child process. On the +Codewars Linux runtime it uses a local `fork` context so existing nested test +functions work on Python 3.14 without changing the process-wide start method. +Normal completion retains the existing additional passing assertion. An expired +timeout, abnormal exit or exit before the wrapper completes reports a failure; +timed-out children are terminated and joined, including children that ignore +`SIGTERM`. Previously printed assertions remain visible. + +The fork context preserves the existing Linux execution model. Tests that start +threads or import libraries with background threads still require validation in +the full runner image. This compatibility change does not make fork safe for +arbitrary multithreaded programs. + +### Development tests + +Failed comparisons retain the author's message and emit escaped `Expected`, +`Actual` and `Location` details. Values are limited to 2,000 characters per +field, with `[truncated]` marking omitted text. A failing bare `assert` gets a +nonempty message and user-code location; passing bare assertions and empty +groups do not add implicit successful assertions. + +An `after` hook runs even when `before` fails, and runs before the group closes. +A failed `before` skips the body. Hook errors remain visible alongside any +original body failure, and later sibling tests can still run. Cleanup hooks +should therefore tolerate partially initialized state. + +Run the output fixtures and compatibility tests with the interpreter under test: + +```bash +python -m unittest discover -v +``` + +The timeout regression tests run on Linux and check success/failure counts, +nested functions, unchanged global start-method selection, early exits, signals, +startup errors, child cleanup and `allow_raise` behavior. Other platforms skip +these Linux-specific checks. Set `CW10_RESULTS` to a writable JSON file path to +capture their raw outputs for integration checks with the Exo result parser. +