Skip to main content

Tryke - A Python testing tool

Project description

tryke-small

Tryke

ruff PyPI license python CI docs

Getting started

For more information, see the documentation.

Write a test.

import tryke as t


# Fixtures with `per="scope"` are cached for their scope:
# - Module-level for globally defined fixtures
# - Per `describe` block for fixtures defined within a `describe` block
@t.fixture(per="scope")
def database():
    db = {}
    yield db
    db.clear()


with t.describe("users"):
    # By default, fixtures run per-test
    # Fixtures can be composed by requesting other fixtures
    @t.fixture
    def users(database: dict[str, dict[str, str]] = t.Depends(database)):
        database["users"] = {}
        return database["users"]

    with t.describe("get"):
        # Define display labels for tests
        # Async tests are supported
        @t.test("returns a stored user")
        async def test_get(users: dict[str, str] = t.Depends(users)):
            users["alice"] = "alice@example.com"
            t.expect(users["alice"]).to_equal("alice@example.com")

    with t.describe("set"):

        @t.test("stores a new user")
        async def test_set(users: dict[str, str] = t.Depends(users)):
            users["bob"] = "bob@example.com"
            t.expect(users["bob"]).to_equal("bob@example.com")

Run your tests — tryke watch for an always-on loop, tryke test --changed for just what your working tree touched, or plain:

uvx tryke test
tryke test v0.0.18

example.py:
  users
    get
      ✓ returns a stored user [0.00ms]
        ✓ expect(users["alice"]).to_equal("alice@example.com")
    set
      ✓ stores a new user [0.00ms]
        ✓ expect(users["bob"]).to_equal("bob@example.com")

 Test Files  1 passed (1)
      Tests  2 passed (2)
   Start at  08:58:39
   Duration  46.01ms (discover 6.08ms, tests 39.93ms)

  PASS

Coming from pytest?

The migration guide has a side-by-side cheat sheet and — faster — a copy-paste LLM prompt that walks an AI coding assistant through a phased, gated pytest → Tryke migration with discovery- and results-parity checks built in.

License

This repository is licensed under the MIT License.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

tryke-0.0.23-py3-none-win_amd64.whl (4.2 MB view details)

Uploaded Python 3Windows x86-64

tryke-0.0.23-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.9 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ x86-64

tryke-0.0.23-py3-none-macosx_11_0_arm64.whl (4.5 MB view details)

Uploaded Python 3macOS 11.0+ ARM64

File details

Details for the file tryke-0.0.23-py3-none-win_amd64.whl.

File metadata

  • Download URL: tryke-0.0.23-py3-none-win_amd64.whl
  • Upload date:
  • Size: 4.2 MB
  • Tags: Python 3, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for tryke-0.0.23-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 b6a38bb1687a83576f7b5c255923e55ed13759807b498d15a1119874dac75236
MD5 966fdc440418625f03a17a3e5842dc45
BLAKE2b-256 961959898e55206d7cae9f5d172575dd812c1514a8a7c4c31d7097040046e610

See more details on using hashes here.

File details

Details for the file tryke-0.0.23-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

  • Download URL: tryke-0.0.23-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
  • Upload date:
  • Size: 4.9 MB
  • Tags: Python 3, manylinux: glibc 2.17+ x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for tryke-0.0.23-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 a4687230ce9d7016e060095956cf785d2243bb6c8782c5a3d30bb08bbac1be57
MD5 36e0451e4424e3c0f397519807120559
BLAKE2b-256 56f513ead76128e683a9c9498c9b0f22314bb94b8b7e297e323a061eb3f66566

See more details on using hashes here.

File details

Details for the file tryke-0.0.23-py3-none-macosx_11_0_arm64.whl.

File metadata

  • Download URL: tryke-0.0.23-py3-none-macosx_11_0_arm64.whl
  • Upload date:
  • Size: 4.5 MB
  • Tags: Python 3, macOS 11.0+ ARM64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for tryke-0.0.23-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 004e2504982e6195a6e6aab2945859b3804406b02ee74a07c998271b063ceac6
MD5 46c1b9d1b3ee3f35d6af509ec51d4120
BLAKE2b-256 4dfcd9e245e0694507f1a5b0ee094b6e02a0cdc756b564fdde836df65696ef96

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page