Skip to content

Commit

Permalink
get rid of dedicated doctest run
Browse files Browse the repository at this point in the history
  • Loading branch information
mr-mixas committed Jun 21, 2024
1 parent 4374fa7 commit 293c4c9
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 20 deletions.
25 changes: 15 additions & 10 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ lint = [
test = [
'pytest',
'pytest-cov',
'pytest-pythonhashseed',
'pytest-ruff',
'ruff==0.4.10',
]
Expand All @@ -67,17 +68,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 = [
Expand Down
4 changes: 2 additions & 2 deletions tests/data/gen_standard.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -66,4 +66,4 @@ def get_tests():


if __name__ == '__main__':
generate_tests()
generate_tests(sys.argv[1])
5 changes: 5 additions & 0 deletions tests/test_misc.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import os


def test_pythonhashseed():
assert os.environ['PYTHONHASHSEED'] == '1'
9 changes: 1 addition & 8 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,15 @@ extras =
cli
test

setenv =
PYTHONHASHSEED = 1

[testenv:extended]
commands =
pytest --doctest-modules
python -m doctest HOWTO.md README.md
pytest
darglint nested_diff

extras =
{[testenv:essential]extras}
lint

setenv =
PYTHONHASHSEED = 1

# pyproject.toml not support yet
[darglint]
docstring_style=google
Expand Down

0 comments on commit 293c4c9

Please sign in to comment.