Skip to content

Commit 1336faa

Browse files
authored
✨ Add yaml format (#4)
1 parent 9704198 commit 1336faa

10 files changed

Lines changed: 266 additions & 76 deletions

File tree

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
22
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
33

4-
name: Python package
4+
name: Tests
55

66
on:
77
push:
@@ -16,7 +16,7 @@ jobs:
1616
strategy:
1717
fail-fast: false
1818
matrix:
19-
python-version: ["3.8", "3.9", "3.10"]
19+
python-version: ["3.8", "3.9", "3.10", "3.11"]
2020

2121
steps:
2222
- uses: actions/checkout@v3

.pre-commit-config.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,25 @@
22
# See https://pre-commit.com/hooks.html for more hooks
33
repos:
44
- repo: https://github.com/pre-commit/pre-commit-hooks
5-
rev: v4.1.0
5+
rev: v4.4.0
66
hooks:
77
- id: trailing-whitespace
88
- id: end-of-file-fixer
99
- id: check-yaml
1010
- id: check-added-large-files
1111

1212
- repo: https://github.com/PyCQA/isort
13-
rev: 5.10.1
13+
rev: 5.12.0
1414
hooks:
1515
- id: isort
1616

1717
- repo: https://github.com/psf/black
18-
rev: 21.12b0
18+
rev: 23.7.0
1919
hooks:
2020
- id: black
2121

2222
- repo: https://github.com/PyCQA/flake8
23-
rev: 4.0.1
23+
rev: 6.0.0
2424
hooks:
2525
- id: flake8
2626
additional_dependencies:

README.md

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,39 @@
44

55
A small package to generate parametrized [pytests](https://docs.pytest.org) from external files.
66

7-
Simply create a text file with the following (`dot`) format:
7+
Simply create a text file with an available format:
88

9+
`dot` format (default):
910
```
1011
[name1] description
1112
.
1213
input content
1314
.
1415
expected output content
15-
,
16+
.
1617
1718
[name2] description
1819
.
1920
input content
2021
.
2122
expected output content
22-
,
23+
.
24+
```
25+
26+
`yaml` format:
27+
```yaml
28+
- title: name1
29+
description: description
30+
input: |-
31+
input content
32+
expected: |-
33+
expected output content
34+
- title: name2
35+
description: description
36+
input: |-
37+
input content
38+
expected: |-
39+
expected output content
2340
```
2441
2542
Then, use the `param_file` pytest marker to create a parametrized test:
@@ -85,10 +102,10 @@ $ pip install -e .
85102

86103
## Regenerating expected output on failures
87104

88-
**EXPERIMENTAL**
89-
90105
Running pytest with the `--regen-file-failure` option will regenerate the parameter file with actual output, if any test fails.
91106

107+
Note, currently regeneration of YAML files may not provide the same formatting as the original file, and will not preserve comments.
108+
92109
## Other formats
93110

94111
TODO ...

pyproject.toml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@ license = {file = "LICENSE"}
1111
classifiers = [
1212
"License :: OSI Approved :: MIT License",
1313
"Programming Language :: Python :: 3",
14-
"Programming Language :: Python :: 3.7",
1514
"Programming Language :: Python :: 3.8",
1615
"Programming Language :: Python :: 3.9",
16+
"Programming Language :: Python :: 3.10",
17+
"Programming Language :: Python :: 3.11",
1718
"Framework :: Pytest"
18-
1919
]
2020
keywords = ["pytest", "parameterized"]
21-
requires-python = ">=3.7"
22-
dependencies = ["pytest"]
21+
requires-python = ">=3.8"
22+
dependencies = ["pytest", "pyyaml"]
2323

2424
[project.urls]
2525
Home = "https://github.com/chrisjsewell/pytest-param-files"
@@ -28,7 +28,7 @@ Home = "https://github.com/chrisjsewell/pytest-param-files"
2828
pytest_param_files = "pytest_param_files.main"
2929

3030
[project.optional-dependencies]
31-
develop = ["black"]
31+
codecov = ["pytest-cov"]
3232

3333
[tool.isort]
3434
profile = "black"

pytest_param_files/__init__.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Create pytest parametrize decorators from external files."""
2-
from .main import ParamTestData # noqa: F401
2+
from .main import ParamTestData
33

4-
__version__ = "0.3.5"
4+
__version__ = "0.4.0"
5+
__all__ = ("ParamTestData",)

0 commit comments

Comments
 (0)