Skip to main content

Create pytest parametrize decorators from external files.

Project description

pytest-param-files

A small package to create pytest parametrize decorators from external files.

Simply create a text file with the following (dot) format:

[name1] description
.
input content
.
expected output content
,

[name2] description
.
input content
.
expected output content
,

Then, use the with_parameters decorator to create a parametrized test:

from pathlib import Path
from pytest_param_files import with_parameters

import my_function

PATH = Path(__file__).parent.joinpath("test_file.txt")

@with_parameters(PATH, fmt="dot")
def test_function(line, title, description, content, expected):
    assert my_function(content) == expected

and the output will be:

$ pytest -v test_file.py
...
test_file.py::test_function[1-name1] PASSED
test_file.py::test_function[8-name2] PASSED

Other formats

TODO ...

Regenerating expected output on failures

TODO ...

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

pytest_param_files-0.1.0.tar.gz (4.9 kB view details)

Uploaded Source

Built Distribution

pytest_param_files-0.1.0-py3-none-any.whl (3.6 kB view details)

Uploaded Python 3

File details

Details for the file pytest_param_files-0.1.0.tar.gz.

File metadata

  • Download URL: pytest_param_files-0.1.0.tar.gz
  • Upload date:
  • Size: 4.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.26.0

File hashes

Hashes for pytest_param_files-0.1.0.tar.gz
Algorithm Hash digest
SHA256 a3bd8d5d43da16002581bcb93c1b914dd13e9157e14f146ddeb0c5d41598bc76
MD5 c0d1ffee68ae6976307d51a2b406f337
BLAKE2b-256 c3e2bf4c1f1f0f40c2c762a08f99a235058687bad2ff7827b837390ba76c43fc

See more details on using hashes here.

File details

Details for the file pytest_param_files-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for pytest_param_files-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d3eaf8121ece4d45f7686114f22e4872387d6253bd44a081c9cd5a37d875835a
MD5 4df7ad37d5df084529420ed682759134
BLAKE2b-256 92038cf39fec7d2c6cbd875dc0cb90ebb4127c706c382f5906d6410c33539c63

See more details on using hashes here.

Supported by

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