pytest-csv-params 2.2.0__tar.gz → 2.2.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pytest_csv_params-2.2.0 → pytest_csv_params-2.2.3}/PKG-INFO +21 -9
- {pytest_csv_params-2.2.0 → pytest_csv_params-2.2.3}/README.md +20 -8
- {pytest_csv_params-2.2.0 → pytest_csv_params-2.2.3}/_ptcsvp/parametrize.py +19 -33
- {pytest_csv_params-2.2.0 → pytest_csv_params-2.2.3}/_ptcsvp/varname.py +1 -4
- {pytest_csv_params-2.2.0 → pytest_csv_params-2.2.3}/_ptcsvp/version.py +6 -10
- {pytest_csv_params-2.2.0 → pytest_csv_params-2.2.3}/pyproject.toml +60 -7
- {pytest_csv_params-2.2.0 → pytest_csv_params-2.2.3}/pytest_csv_params/types.py +11 -10
- {pytest_csv_params-2.2.0 → pytest_csv_params-2.2.3}/.gitignore +0 -0
- {pytest_csv_params-2.2.0 → pytest_csv_params-2.2.3}/LICENSE.txt +0 -0
- {pytest_csv_params-2.2.0 → pytest_csv_params-2.2.3}/_ptcsvp/__init__.py +0 -0
- {pytest_csv_params-2.2.0 → pytest_csv_params-2.2.3}/_ptcsvp/cmdline.py +0 -0
- {pytest_csv_params-2.2.0 → pytest_csv_params-2.2.3}/_ptcsvp/configure.py +0 -0
- {pytest_csv_params-2.2.0 → pytest_csv_params-2.2.3}/_ptcsvp/exception.py +0 -0
- {pytest_csv_params-2.2.0 → pytest_csv_params-2.2.3}/_ptcsvp/plugin.py +0 -0
- {pytest_csv_params-2.2.0 → pytest_csv_params-2.2.3}/pytest_csv_params/__init__.py +0 -0
- {pytest_csv_params-2.2.0 → pytest_csv_params-2.2.3}/pytest_csv_params/decorator.py +0 -0
- {pytest_csv_params-2.2.0 → pytest_csv_params-2.2.3}/pytest_csv_params/dialect.py +0 -0
- {pytest_csv_params-2.2.0 → pytest_csv_params-2.2.3}/pytest_csv_params/exception.py +0 -0
- {pytest_csv_params-2.2.0 → pytest_csv_params-2.2.3}/pytest_csv_params/plugin.py +0 -0
- {pytest_csv_params-2.2.0 → pytest_csv_params-2.2.3}/pytest_csv_params/shortcut.py +0 -0
- {pytest_csv_params-2.2.0 → pytest_csv_params-2.2.3}/pytest_csv_params/warning.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: pytest-csv-params
|
|
3
|
-
Version: 2.2.
|
|
3
|
+
Version: 2.2.3
|
|
4
4
|
Summary: Pytest plugin for Test Case Parametrization with CSV files
|
|
5
5
|
Project-URL: repository, https://git.codebau.dev/pytest-plugins/pytest-csv-params
|
|
6
6
|
Project-URL: homepage, https://git.codebau.dev/pytest-plugins/pytest-csv-params
|
|
@@ -34,13 +34,14 @@ Requires-Python: <3.16,>=3.10
|
|
|
34
34
|
Requires-Dist: pytest<10,>=8.3
|
|
35
35
|
Description-Content-Type: text/markdown
|
|
36
36
|
|
|
37
|
-
|
|
37
|
+

|
|
38
38
|
|
|
39
39
|
# pytest-csv-params
|
|
40
40
|
|
|
41
41
|
A pytest plugin to parametrize data-driven tests by CSV files.
|
|
42
42
|
|
|
43
|
-

|
|
43
|
+

|
|
44
|
+

|
|
44
45
|
[](https://pypi.org/project/pytest-csv-params/)
|
|
45
46
|
[](https://pypi.org/project/pytest-csv-params/)
|
|
46
47
|
[](https://pypi.org/project/pytest-csv-params/)
|
|
@@ -53,6 +54,11 @@ A pytest plugin to parametrize data-driven tests by CSV files.
|
|
|
53
54
|
|
|
54
55
|
There's no operating system dependent code in this plugin, so it should run anywhere where pytest runs.
|
|
55
56
|
|
|
57
|
+
**Attention!**
|
|
58
|
+
|
|
59
|
+
- One of the next versions will **drop Pytest 8.x support**
|
|
60
|
+
- One of the next versions will **drop Python 3.10 support**
|
|
61
|
+
|
|
56
62
|
## Installation
|
|
57
63
|
|
|
58
64
|
Simply install it with pip...
|
|
@@ -119,6 +125,7 @@ This example uses the CSV example from above.
|
|
|
119
125
|
```python
|
|
120
126
|
from pytest_csv_params.decorator import csv_params
|
|
121
127
|
|
|
128
|
+
|
|
122
129
|
@csv_params(
|
|
123
130
|
data_file="/data/test-lib/cases/addition.csv",
|
|
124
131
|
id_col="ID#",
|
|
@@ -137,6 +144,7 @@ Shorthand example (no ID col, only string values):
|
|
|
137
144
|
```python
|
|
138
145
|
from pytest_csv_params.decorator import csv_params
|
|
139
146
|
|
|
147
|
+
|
|
140
148
|
@csv_params("/data/test-lib/cases/texts.csv")
|
|
141
149
|
def test_texts(text_a, text_b, text_c):
|
|
142
150
|
assert f"{text_a}:{text_b}" == text_c
|
|
@@ -147,12 +155,13 @@ Use a dictionary instead of multiple arguments:
|
|
|
147
155
|
```python
|
|
148
156
|
from pytest_csv_params.decorator import csv_params
|
|
149
157
|
|
|
158
|
+
|
|
150
159
|
@csv_params(
|
|
151
|
-
|
|
152
|
-
|
|
160
|
+
data_file="/data/test-lib/cases/texts.csv",
|
|
161
|
+
parameters_as_dictionary="test_data",
|
|
153
162
|
)
|
|
154
163
|
def test_texts(test_data: dict):
|
|
155
|
-
assert f"{test_data['text_a']}:{test_data['text_b']}" == test_data[
|
|
164
|
+
assert f"{test_data['text_a']}:{test_data['text_b']}" == test_data["text_c"]
|
|
156
165
|
```
|
|
157
166
|
|
|
158
167
|
### More complex example
|
|
@@ -222,9 +231,12 @@ If you decide not to rename the columns, the test would look like this:
|
|
|
222
231
|
},
|
|
223
232
|
)
|
|
224
233
|
def test_container_size_is_big_enough(
|
|
225
|
-
Bananas_Shipped: int,
|
|
226
|
-
|
|
227
|
-
|
|
234
|
+
Bananas_Shipped: int,
|
|
235
|
+
Single_Banana_Weight: float,
|
|
236
|
+
Apples_Shipped: int,
|
|
237
|
+
Single_Apple_Weight: float,
|
|
238
|
+
Container_Size: int,
|
|
239
|
+
) -> None: ...
|
|
228
240
|
```
|
|
229
241
|
|
|
230
242
|
## Changelog
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+

|
|
2
2
|
|
|
3
3
|
# pytest-csv-params
|
|
4
4
|
|
|
5
5
|
A pytest plugin to parametrize data-driven tests by CSV files.
|
|
6
6
|
|
|
7
|
-

|
|
7
|
+

|
|
8
|
+

|
|
8
9
|
[](https://pypi.org/project/pytest-csv-params/)
|
|
9
10
|
[](https://pypi.org/project/pytest-csv-params/)
|
|
10
11
|
[](https://pypi.org/project/pytest-csv-params/)
|
|
@@ -17,6 +18,11 @@ A pytest plugin to parametrize data-driven tests by CSV files.
|
|
|
17
18
|
|
|
18
19
|
There's no operating system dependent code in this plugin, so it should run anywhere where pytest runs.
|
|
19
20
|
|
|
21
|
+
**Attention!**
|
|
22
|
+
|
|
23
|
+
- One of the next versions will **drop Pytest 8.x support**
|
|
24
|
+
- One of the next versions will **drop Python 3.10 support**
|
|
25
|
+
|
|
20
26
|
## Installation
|
|
21
27
|
|
|
22
28
|
Simply install it with pip...
|
|
@@ -83,6 +89,7 @@ This example uses the CSV example from above.
|
|
|
83
89
|
```python
|
|
84
90
|
from pytest_csv_params.decorator import csv_params
|
|
85
91
|
|
|
92
|
+
|
|
86
93
|
@csv_params(
|
|
87
94
|
data_file="/data/test-lib/cases/addition.csv",
|
|
88
95
|
id_col="ID#",
|
|
@@ -101,6 +108,7 @@ Shorthand example (no ID col, only string values):
|
|
|
101
108
|
```python
|
|
102
109
|
from pytest_csv_params.decorator import csv_params
|
|
103
110
|
|
|
111
|
+
|
|
104
112
|
@csv_params("/data/test-lib/cases/texts.csv")
|
|
105
113
|
def test_texts(text_a, text_b, text_c):
|
|
106
114
|
assert f"{text_a}:{text_b}" == text_c
|
|
@@ -111,12 +119,13 @@ Use a dictionary instead of multiple arguments:
|
|
|
111
119
|
```python
|
|
112
120
|
from pytest_csv_params.decorator import csv_params
|
|
113
121
|
|
|
122
|
+
|
|
114
123
|
@csv_params(
|
|
115
|
-
|
|
116
|
-
|
|
124
|
+
data_file="/data/test-lib/cases/texts.csv",
|
|
125
|
+
parameters_as_dictionary="test_data",
|
|
117
126
|
)
|
|
118
127
|
def test_texts(test_data: dict):
|
|
119
|
-
assert f"{test_data['text_a']}:{test_data['text_b']}" == test_data[
|
|
128
|
+
assert f"{test_data['text_a']}:{test_data['text_b']}" == test_data["text_c"]
|
|
120
129
|
```
|
|
121
130
|
|
|
122
131
|
### More complex example
|
|
@@ -186,9 +195,12 @@ If you decide not to rename the columns, the test would look like this:
|
|
|
186
195
|
},
|
|
187
196
|
)
|
|
188
197
|
def test_container_size_is_big_enough(
|
|
189
|
-
Bananas_Shipped: int,
|
|
190
|
-
|
|
191
|
-
|
|
198
|
+
Bananas_Shipped: int,
|
|
199
|
+
Single_Banana_Weight: float,
|
|
200
|
+
Apples_Shipped: int,
|
|
201
|
+
Single_Apple_Weight: float,
|
|
202
|
+
Container_Size: int,
|
|
203
|
+
) -> None: ...
|
|
192
204
|
```
|
|
193
205
|
|
|
194
206
|
## Changelog
|
|
@@ -4,13 +4,13 @@ Parametrize a test function by CSV file
|
|
|
4
4
|
|
|
5
5
|
import csv
|
|
6
6
|
from pathlib import Path
|
|
7
|
-
from typing import Any,
|
|
7
|
+
from typing import Any, TypedDict
|
|
8
8
|
from warnings import warn
|
|
9
9
|
|
|
10
10
|
import pytest
|
|
11
11
|
from _pytest.mark import MarkDecorator
|
|
12
12
|
|
|
13
|
-
from _ptcsvp.plugin import BASE_DIR_KEY,
|
|
13
|
+
from _ptcsvp.plugin import BASE_DIR_KEY, SKIP_EMPTY_KEY, SKIP_MISSING_KEY, Plugin
|
|
14
14
|
from _ptcsvp.varname import make_name_valid
|
|
15
15
|
from pytest_csv_params.dialect import CsvParamsDefaultDialect
|
|
16
16
|
from pytest_csv_params.exception import (
|
|
@@ -24,10 +24,10 @@ from pytest_csv_params.types import (
|
|
|
24
24
|
CsvDialect,
|
|
25
25
|
DataCasts,
|
|
26
26
|
DataFile,
|
|
27
|
+
DictionaryName,
|
|
27
28
|
HeaderRenames,
|
|
28
29
|
IdColName,
|
|
29
30
|
SkipConfig,
|
|
30
|
-
DictionaryName,
|
|
31
31
|
)
|
|
32
32
|
from pytest_csv_params.warning import CsvParamsOnlyOneColumnIsUsedAsIdAndDataWarning
|
|
33
33
|
|
|
@@ -37,13 +37,11 @@ class TestCaseParameters(TypedDict):
|
|
|
37
37
|
Type for a single test case. Contains the optional :attr:`test_id` and the test :attr:`data`.
|
|
38
38
|
"""
|
|
39
39
|
|
|
40
|
-
test_id:
|
|
41
|
-
data:
|
|
40
|
+
test_id: str | None
|
|
41
|
+
data: list[Any]
|
|
42
42
|
|
|
43
43
|
|
|
44
|
-
def read_csv(
|
|
45
|
-
base_dir: BaseDir, data_file: DataFile, dialect: CsvDialect
|
|
46
|
-
) -> List[List[str]]:
|
|
44
|
+
def read_csv(base_dir: BaseDir, data_file: DataFile, dialect: CsvDialect) -> list[list[str]]:
|
|
47
45
|
"""
|
|
48
46
|
Get Data from CSV
|
|
49
47
|
|
|
@@ -58,27 +56,23 @@ def read_csv(
|
|
|
58
56
|
if data_file is None:
|
|
59
57
|
raise CsvParamsDataFileInvalid("Data file is None") from None
|
|
60
58
|
csv_file = Path(data_file)
|
|
61
|
-
if not csv_file.is_absolute():
|
|
62
|
-
|
|
63
|
-
csv_file = Path(base_dir) / csv_file
|
|
59
|
+
if not csv_file.is_absolute() and base_dir is not None:
|
|
60
|
+
csv_file = Path(base_dir) / csv_file
|
|
64
61
|
if not csv_file.exists() or not csv_file.is_file():
|
|
65
|
-
raise CsvParamsDataFileNotFound(f"Cannot find file: {
|
|
62
|
+
raise CsvParamsDataFileNotFound(f"Cannot find file: {csv_file!s}") from None
|
|
66
63
|
csv_lines = []
|
|
67
64
|
try:
|
|
68
65
|
with open(csv_file, newline="", encoding="utf-8") as csv_file_handle:
|
|
69
66
|
csv_reader = csv.reader(csv_file_handle, dialect=dialect)
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
raise CsvParamsDataFileInaccessible(
|
|
74
|
-
f"Unable to read file: {str(csv_file)}"
|
|
75
|
-
) from err
|
|
67
|
+
csv_lines.extend(csv_reader)
|
|
68
|
+
except OSError as err: # pragma: no cover
|
|
69
|
+
raise CsvParamsDataFileInaccessible(f"Unable to read file: {csv_file!s}") from err
|
|
76
70
|
except csv.Error as err:
|
|
77
71
|
raise CsvParamsDataFileInvalid("Invalid data") from err
|
|
78
72
|
return csv_lines
|
|
79
73
|
|
|
80
74
|
|
|
81
|
-
def clean_headers(current_headers:
|
|
75
|
+
def clean_headers(current_headers: list[str], replacing: HeaderRenames) -> list[str]:
|
|
82
76
|
"""
|
|
83
77
|
Clean the CSV file headers
|
|
84
78
|
|
|
@@ -141,18 +135,12 @@ def add_parametrization( # pylint: disable=too-many-arguments
|
|
|
141
135
|
csv_lines = read_csv(base_dir, data_file, dialect)
|
|
142
136
|
except (CsvParamsDataFileNotFound, CsvParamsDataFileInaccessible):
|
|
143
137
|
if skip_when_missing_csv_file:
|
|
144
|
-
return pytest.mark.skip(
|
|
145
|
-
reason=f"CSV file '{data_file}' not found, test needs to be skipped"
|
|
146
|
-
)
|
|
138
|
+
return pytest.mark.skip(reason=f"CSV file '{data_file}' not found, test needs to be skipped")
|
|
147
139
|
raise
|
|
148
140
|
if len(csv_lines) < 2:
|
|
149
141
|
if skip_when_empty_csv_file:
|
|
150
|
-
return pytest.mark.skip(
|
|
151
|
-
|
|
152
|
-
)
|
|
153
|
-
raise CsvParamsDataFileInvalid(
|
|
154
|
-
"File does not contain a single data row"
|
|
155
|
-
) from None
|
|
142
|
+
return pytest.mark.skip(reason=f"CSV file '{data_file}' has no test data in it, test needs to be skipped")
|
|
143
|
+
raise CsvParamsDataFileInvalid("File does not contain a single data row") from None
|
|
156
144
|
id_index = -1
|
|
157
145
|
headers = csv_lines.pop(0)
|
|
158
146
|
if id_col is not None:
|
|
@@ -171,7 +159,7 @@ def add_parametrization( # pylint: disable=too-many-arguments
|
|
|
171
159
|
CsvParamsOnlyOneColumnIsUsedAsIdAndDataWarning,
|
|
172
160
|
)
|
|
173
161
|
headers = clean_headers(headers, header_renames)
|
|
174
|
-
data:
|
|
162
|
+
data: list[TestCaseParameters] = []
|
|
175
163
|
for data_line in csv_lines:
|
|
176
164
|
line = list(map(str, data_line))
|
|
177
165
|
if len(line) == 0:
|
|
@@ -200,7 +188,7 @@ def add_parametrization( # pylint: disable=too-many-arguments
|
|
|
200
188
|
id_data = [tc_data["test_id"] for tc_data in data]
|
|
201
189
|
if parameters_as_dictionary is not None:
|
|
202
190
|
param_header_name = make_name_valid(parameters_as_dictionary)
|
|
203
|
-
list_of_dicts:
|
|
191
|
+
list_of_dicts: list[dict[str, Any]] = []
|
|
204
192
|
for tc_element in [tc_data["data"] for tc_data in data]:
|
|
205
193
|
list_of_dicts.append(dict(zip(headers, tc_element)))
|
|
206
194
|
return pytest.mark.parametrize(
|
|
@@ -208,6 +196,4 @@ def add_parametrization( # pylint: disable=too-many-arguments
|
|
|
208
196
|
[pytest.param(d) for d in list_of_dicts],
|
|
209
197
|
ids=id_data,
|
|
210
198
|
)
|
|
211
|
-
return pytest.mark.parametrize(
|
|
212
|
-
headers, [tc_data["data"] for tc_data in data], ids=id_data
|
|
213
|
-
)
|
|
199
|
+
return pytest.mark.parametrize(headers, [tc_data["data"] for tc_data in data], ids=id_data)
|
|
@@ -29,10 +29,7 @@ def is_valid_name(name: str) -> bool:
|
|
|
29
29
|
"""
|
|
30
30
|
if (
|
|
31
31
|
keyword.iskeyword(name)
|
|
32
|
-
or (
|
|
33
|
-
hasattr(keyword, "issoftkeyword")
|
|
34
|
-
and getattr(keyword, "issoftkeyword")(name)
|
|
35
|
-
)
|
|
32
|
+
or (hasattr(keyword, "issoftkeyword") and keyword.issoftkeyword(name))
|
|
36
33
|
or getattr(builtins, name, None) is not None
|
|
37
34
|
):
|
|
38
35
|
return False
|
|
@@ -6,13 +6,13 @@ During the setup phase of the plugin (see :mod:`pytest_csv_params.plugin`) these
|
|
|
6
6
|
"""
|
|
7
7
|
|
|
8
8
|
import sys
|
|
9
|
-
from typing import Tuple
|
|
10
9
|
|
|
11
|
-
from .exception import PythonVersionTooOldException, PytestVersionTooOldException
|
|
12
10
|
from packaging.version import parse
|
|
13
11
|
|
|
12
|
+
from .exception import PytestVersionTooOldException, PythonVersionTooOldException
|
|
14
13
|
|
|
15
|
-
|
|
14
|
+
|
|
15
|
+
def check_python_version(min_version: tuple[int, int] = (3, 10)) -> None:
|
|
16
16
|
"""
|
|
17
17
|
Check if the current version is at least 3.10
|
|
18
18
|
|
|
@@ -21,12 +21,10 @@ def check_python_version(min_version: Tuple[int, int] = (3, 10)) -> None:
|
|
|
21
21
|
"""
|
|
22
22
|
|
|
23
23
|
if sys.version_info < min_version:
|
|
24
|
-
raise PythonVersionTooOldException(
|
|
25
|
-
f"At least Python {'.'.join(map(str, min_version))} required"
|
|
26
|
-
)
|
|
24
|
+
raise PythonVersionTooOldException(f"At least Python {'.'.join(map(str, min_version))} required")
|
|
27
25
|
|
|
28
26
|
|
|
29
|
-
def check_pytest_version(min_version:
|
|
27
|
+
def check_pytest_version(min_version: tuple[int, int] = (8, 3)) -> None:
|
|
30
28
|
"""
|
|
31
29
|
Check if the current version is at least 8.3
|
|
32
30
|
|
|
@@ -40,6 +38,4 @@ def check_pytest_version(min_version: Tuple[int, int] = (8, 3)) -> None:
|
|
|
40
38
|
parsed_min_version = parse(pytest_min_version)
|
|
41
39
|
parsed_actual_version = parse(pytest_version)
|
|
42
40
|
if parsed_actual_version < parsed_min_version:
|
|
43
|
-
raise PytestVersionTooOldException(
|
|
44
|
-
f"At least Pytest {pytest_min_version} required"
|
|
45
|
-
)
|
|
41
|
+
raise PytestVersionTooOldException(f"At least Pytest {pytest_min_version} required")
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "pytest-csv-params"
|
|
3
|
-
version = "2.2.
|
|
3
|
+
version = "2.2.3"
|
|
4
4
|
description = "Pytest plugin for Test Case Parametrization with CSV files"
|
|
5
5
|
authors = [
|
|
6
6
|
{ name = "Juergen Edelbluth", email = "csv_params@jued.de" },
|
|
@@ -43,6 +43,7 @@ dev = [
|
|
|
43
43
|
"pytest-mock (>=3.16.0,<4.0.0)",
|
|
44
44
|
"pytest-clarity>=1.0.1",
|
|
45
45
|
"pytest-order>=1.0.1",
|
|
46
|
+
"ruff>=0.16.10",
|
|
46
47
|
]
|
|
47
48
|
|
|
48
49
|
docs = [
|
|
@@ -82,12 +83,6 @@ junit_log_passing_tests = true
|
|
|
82
83
|
junit_duration_report = "call"
|
|
83
84
|
junit_suite_name = "pytest-csv-params"
|
|
84
85
|
|
|
85
|
-
bandit_targets = [
|
|
86
|
-
"pytest_csv_params",
|
|
87
|
-
"_ptcsvp",
|
|
88
|
-
]
|
|
89
|
-
bandit_recurse = "True"
|
|
90
|
-
|
|
91
86
|
[tool.coverage]
|
|
92
87
|
|
|
93
88
|
[tool.coverage.run]
|
|
@@ -156,3 +151,61 @@ only-include = [
|
|
|
156
151
|
"_ptcsvp",
|
|
157
152
|
"pytest_csv_params",
|
|
158
153
|
]
|
|
154
|
+
[tool.ruff]
|
|
155
|
+
# Exclude a variety of commonly ignored directories.
|
|
156
|
+
extend-exclude = [
|
|
157
|
+
".ci",
|
|
158
|
+
".junie",
|
|
159
|
+
".venv",
|
|
160
|
+
"dist",
|
|
161
|
+
"docs",
|
|
162
|
+
"*.egg-info",
|
|
163
|
+
"test-reports",
|
|
164
|
+
".coverage",
|
|
165
|
+
".*_cacne",
|
|
166
|
+
]
|
|
167
|
+
|
|
168
|
+
# Same as Black.
|
|
169
|
+
line-length = 120
|
|
170
|
+
indent-width = 4
|
|
171
|
+
|
|
172
|
+
# Assume Python 3.10
|
|
173
|
+
target-version = "py310"
|
|
174
|
+
|
|
175
|
+
[tool.ruff.lint]
|
|
176
|
+
# select = [...] # See the Default Rules page for the full listing.
|
|
177
|
+
ignore = []
|
|
178
|
+
|
|
179
|
+
# Allow fix for all enabled rules (when `--fix`) is provided.
|
|
180
|
+
fixable = ["ALL"]
|
|
181
|
+
unfixable = []
|
|
182
|
+
|
|
183
|
+
# Allow unused variables when underscore-prefixed.
|
|
184
|
+
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
|
|
185
|
+
|
|
186
|
+
[tool.ruff.format]
|
|
187
|
+
# Like Black, use double quotes for strings.
|
|
188
|
+
quote-style = "double"
|
|
189
|
+
|
|
190
|
+
# Like Black, indent with spaces, rather than tabs.
|
|
191
|
+
indent-style = "space"
|
|
192
|
+
|
|
193
|
+
# Like Black, respect magic trailing commas.
|
|
194
|
+
skip-magic-trailing-comma = false
|
|
195
|
+
|
|
196
|
+
# Like Black, automatically detect the appropriate line ending.
|
|
197
|
+
line-ending = "auto"
|
|
198
|
+
|
|
199
|
+
# Enable auto-formatting of code examples in docstrings. Markdown,
|
|
200
|
+
# reStructuredText code/literal blocks and doctests are all supported.
|
|
201
|
+
#
|
|
202
|
+
# This is currently disabled by default, but it is planned for this
|
|
203
|
+
# to be opt-out in the future.
|
|
204
|
+
docstring-code-format = true
|
|
205
|
+
|
|
206
|
+
# Set the line length limit used when formatting code snippets in
|
|
207
|
+
# docstrings.
|
|
208
|
+
#
|
|
209
|
+
# This only has an effect when the `docstring-code-format` setting is
|
|
210
|
+
# enabled.
|
|
211
|
+
docstring-code-line-length = "dynamic"
|
|
@@ -5,7 +5,8 @@ Some types are somewhat complex, and it is easier to use a single word/reference
|
|
|
5
5
|
"""
|
|
6
6
|
|
|
7
7
|
import csv
|
|
8
|
-
from
|
|
8
|
+
from collections.abc import Callable
|
|
9
|
+
from typing import Any
|
|
9
10
|
|
|
10
11
|
DataCast = Callable[[str], Any]
|
|
11
12
|
"""
|
|
@@ -13,26 +14,26 @@ A :class:`DataCast` describes how a data casting callable must be implemented. I
|
|
|
13
14
|
:class:`str` and can return anything that is required.
|
|
14
15
|
"""
|
|
15
16
|
|
|
16
|
-
DataCastDict =
|
|
17
|
+
DataCastDict = dict[str, DataCast]
|
|
17
18
|
"""
|
|
18
19
|
A :class:`DataCastDict` describes how a dictionary of data casting callables must look like. The key is a :class:`str`
|
|
19
20
|
describing the column name, the value is a :class:`DataCast`.
|
|
20
21
|
"""
|
|
21
22
|
|
|
22
|
-
DataCasts =
|
|
23
|
+
DataCasts = DataCastDict | None
|
|
23
24
|
"""
|
|
24
25
|
The :class:`DataCasts` type describes the type of the `data_casts` parameter of the
|
|
25
26
|
:meth:`~pytest_csv_params.decorator.csv_params` decorator. An optional :class:`DataCastDict`.
|
|
26
27
|
"""
|
|
27
28
|
|
|
28
|
-
BaseDir =
|
|
29
|
+
BaseDir = str | None
|
|
29
30
|
"""
|
|
30
31
|
The :class:`BaseDir` describes the type of the `base_dir` parameter of the
|
|
31
32
|
:meth:`~pytest_csv_params.decorator.csv_params` decorator to search for non-absolute CSV files. It is simply an optional
|
|
32
33
|
:class:`str`.
|
|
33
34
|
"""
|
|
34
35
|
|
|
35
|
-
IdColName =
|
|
36
|
+
IdColName = str | None
|
|
36
37
|
"""
|
|
37
38
|
The :class:`IdColName` describes the type of the `id_col` parameter of the
|
|
38
39
|
:meth:`~pytest_csv_params.decorator.csv_params` decorator to name the ID column from a CSV file. It is simply an
|
|
@@ -46,32 +47,32 @@ The :class:`DataFile` describes the type if the `data_file` parameter of the
|
|
|
46
47
|
:class:`str`.
|
|
47
48
|
"""
|
|
48
49
|
|
|
49
|
-
CsvDialect =
|
|
50
|
+
CsvDialect = type[csv.Dialect]
|
|
50
51
|
"""
|
|
51
52
|
The :class:`CsvDialect` describes the type of the `dialect` parameter of the
|
|
52
53
|
:meth:`~pytest_csv_params.decorator.csv_params` decorator. It is required, but it has an default value in
|
|
53
54
|
:class:`pytest_csv_params.dialect.CsvParamsDefaultDialect`.
|
|
54
55
|
"""
|
|
55
56
|
|
|
56
|
-
HeaderRenamesDict =
|
|
57
|
+
HeaderRenamesDict = dict[str, str]
|
|
57
58
|
"""
|
|
58
59
|
The :class:`HeaderRenamesDict` describes how a dictionary of header renames must look. Keys and values must both be of
|
|
59
60
|
type :class:`str`.
|
|
60
61
|
"""
|
|
61
62
|
|
|
62
|
-
HeaderRenames =
|
|
63
|
+
HeaderRenames = HeaderRenamesDict | None
|
|
63
64
|
"""
|
|
64
65
|
The :class:`HeaderRenames` describes the type of the `header_renames` parameter of the
|
|
65
66
|
:meth:`~pytest_csv_params.decorator.csv_params` decorator. It is just an optional :class:`HeaderRenamesDict`.
|
|
66
67
|
"""
|
|
67
68
|
|
|
68
|
-
SkipConfig =
|
|
69
|
+
SkipConfig = bool | None
|
|
69
70
|
"""
|
|
70
71
|
The :class:`SkipWhenMissingCSVFile` describes the type of the `skip_when_*_csv_files` parameter of the
|
|
71
72
|
:meth:`~pytest_csv_params.decorator.csv_params` decorator. It is just an optional :class:`bool`.
|
|
72
73
|
"""
|
|
73
74
|
|
|
74
|
-
DictionaryName =
|
|
75
|
+
DictionaryName = str | None
|
|
75
76
|
"""
|
|
76
77
|
The :class:`DictionaryName` describes the type of the `parameters_as_dictionary` parameter of the
|
|
77
78
|
:meth:`~pytest_csv_params.decorator.csv_params` decorator. It is just an optional :class:`str`.
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|