Skip to main content

Write language-agnostic unit tests in Markdown. Run them in pytest.

Project description

testmark-pytest

Python adapter for TestMark - write language-agnostic tests in Markdown, run them with pytest.

Installation

pip install testmark-pytest

Requirements

  • Python 3.8+
  • Node.js and the global testmark CLI from npm (npm i -g testmark)

Usage

Write your tests in Markdown with <input> and <output> tags (see the README for details):

# Slugify Tests

## Spaces to Dashes
<input>Hello World</input>
<output>hello-world</output>

## Handle Errors
<input></input>
<error>Input cannot be empty</error>

Generate pytest tests from your Markdown:

from testmark import testmark
from my_module import slugify

# Generates test_spaces_to_dashes, test_remove_special_characters, etc.
testmark('tests/slugify.test.md', slugify)

Run with pytest as normal:

pytest

How it works

The Python adapter calls the Node.js testmark CLI to parse the Markdown file, then dynamically generates pytest test functions. Each heading with <input>/<output> tags becomes a separate pytest test that can pass or fail independently.

Project details


Download files

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

Source Distribution

testmark_pytest-0.0.2.tar.gz (2.9 kB view details)

Uploaded Source

Built Distribution

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

testmark_pytest-0.0.2-py3-none-any.whl (5.9 kB view details)

Uploaded Python 3

File details

Details for the file testmark_pytest-0.0.2.tar.gz.

File metadata

  • Download URL: testmark_pytest-0.0.2.tar.gz
  • Upload date:
  • Size: 2.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.13

File hashes

Hashes for testmark_pytest-0.0.2.tar.gz
Algorithm Hash digest
SHA256 442c2a228aa7e0224e2f2f7312ea78d138b92fed4ef31c4f1b0a31f310031432
MD5 516e25fb8255c35d1a119731babdb1c1
BLAKE2b-256 6319a15c8247090234a469013365e7b8c57a8d67989b9bfd469935f4aa269046

See more details on using hashes here.

File details

Details for the file testmark_pytest-0.0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for testmark_pytest-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 810184ebc3bf2b1fcb1c16c949f4e28c7508f8b3a255de23b14b9239e7e08cdd
MD5 b1d436c9f40d649da15de8a38edb6417
BLAKE2b-256 857b5430eb6e04172a62278e9ce63a4acafd75deab64665f1ea577930df99f58

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