From 07120db2f6781a8287ee13fcc53c7c28ac6dd7f4 Mon Sep 17 00:00:00 2001 From: Michael Samoglyadov Date: Fri, 21 Jun 2024 22:04:30 +0300 Subject: [PATCH] get rid of dedicated doctest run --- pyproject.toml | 25 +++++++++++++++---------- tests/data/gen_standard.py | 4 ++-- tox.ini | 9 +-------- 3 files changed, 18 insertions(+), 20 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 68e81f9..4b7fed9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -67,6 +67,7 @@ lint = [ test = [ 'pytest', 'pytest-cov', + 'pytest-pythonhashseed', 'pytest-ruff', 'ruff==0.3.0', # pin for reproducible results ] @@ -80,17 +81,21 @@ Homepage = 'https://github.com/mr-mixas/Nested-Diff.py' Repository = 'https://github.com/mr-mixas/Nested-Diff.py.git' [tool.pytest.ini_options] -addopts = """ - --cov=nested_diff \ - --cov-fail-under=99 \ - --cov-report term-missing \ - --no-cov-on-fail \ - --ruff \ - --ruff-format \ - --verbosity=2 \ - """ +addopts = [ + '--cov=nested_diff', + '--cov-fail-under=99', + '--cov-report', 'term-missing', + '--no-cov-on-fail', + '--doctest-modules', + '--doctest-glob=*.md', + '--pythonhashseed=1', + '--ruff', + '--ruff-format', + '--verbosity=2', +] + doctest_optionflags = 'NORMALIZE_WHITESPACE' -testpaths = 'nested_diff tests' +testpaths = 'nested_diff tests *.md' [tool.ruff] extend-exclude = [ diff --git a/tests/data/gen_standard.py b/tests/data/gen_standard.py index 4f80719..58f6a9a 100755 --- a/tests/data/gen_standard.py +++ b/tests/data/gen_standard.py @@ -15,7 +15,7 @@ def format_test(**kwargs): }},""".format(**kwargs) -def generate_tests(source_dir=sys.argv[1]): +def generate_tests(source_dir): tests = [] for file_name in sorted(os.listdir(source_dir)): with open(os.path.join(source_dir, file_name)) as f: @@ -66,4 +66,4 @@ def get_tests(): if __name__ == '__main__': - generate_tests() + generate_tests(sys.argv[1]) diff --git a/tox.ini b/tox.ini index b1b09f2..1b21cfe 100644 --- a/tox.ini +++ b/tox.ini @@ -10,21 +10,14 @@ extras = cli test -setenv = - PYTHONHASHSEED = 1 - [testenv:extended] commands = - pytest --doctest-modules --flake8 - python -m doctest HOWTO.md README.md + pytest --flake8 extras = {[testenv:essential]extras} lint -setenv = - PYTHONHASHSEED = 1 - # pyproject.toml not support yet [darglint] docstring_style=google