Skip to content

Commit e2e6a44

Browse files
authored
fix: docs examples python version in tests (#2069)
1 parent 967b825 commit e2e6a44

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

tests/test_examples.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,11 +161,14 @@ def print(self, *args: Any, **kwargs: Any) -> None:
161161
dunder_name = prefix_settings.get('dunder_name', '__main__')
162162
requires = prefix_settings.get('requires')
163163

164+
ruff_target_version: str = 'py39'
164165
if python_version:
165166
python_version_info = tuple(int(v) for v in python_version.split('.'))
166167
if sys.version_info < python_version_info:
167168
pytest.skip(f'Python version {python_version} required') # pragma: lax no cover
168169

170+
ruff_target_version = f'py{python_version_info[0]}{python_version_info[1]}'
171+
169172
if opt_test.startswith('skip') and opt_lint.startswith('skip'):
170173
pytest.skip('both running code and lint skipped')
171174

@@ -188,7 +191,7 @@ def print(self, *args: Any, **kwargs: Any) -> None:
188191

189192
line_length = int(prefix_settings.get('line_length', '88'))
190193

191-
eval_example.set_config(ruff_ignore=ruff_ignore, target_version='py39', line_length=line_length)
194+
eval_example.set_config(ruff_ignore=ruff_ignore, target_version=ruff_target_version, line_length=line_length) # type: ignore[reportArgumentType]
192195
eval_example.print_callback = print_callback
193196
eval_example.include_print = custom_include_print
194197

0 commit comments

Comments
 (0)