Skip to content

Commit 0bf94e5

Browse files
committed
get rid of dedicated doctest run
1 parent d2aac75 commit 0bf94e5

File tree

7 files changed

+27
-24
lines changed

7 files changed

+27
-24
lines changed

HOWTO.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
>>> b = {'one': 1, 'two': 42}
1010
>>>
1111
>>> diff(a, b, O=False, U=False, trimR=True)
12-
{'D': {'three': {'R': None}, 'two': {'N': 42}}}
12+
{'D': {'two': {'N': 42}, 'three': {'R': None}}}
1313
>>>
1414
```
1515

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,11 @@ nested_patch a.json patch.json
5757
>>>
5858
>>> full_diff = diff(a, b)
5959
>>> full_diff
60-
{'D': {'three': {'R': 3}, 'two': {'N': 42, 'O': 2}, 'one': {'U': 1}}}
60+
{'D': {'two': {'N': 42, 'O': 2}, 'three': {'R': 3}, 'one': {'U': 1}}}
6161
>>>
6262
>>> short_diff = diff(a, b, O=False, U=False) # omit old and unchanged items
6363
>>> short_diff
64-
{'D': {'three': {'R': 3}, 'two': {'N': 42}}}
64+
{'D': {'two': {'N': 42}, 'three': {'R': 3}}}
6565
>>>
6666
>>>
6767
>>> a = patch(a, short_diff)

nested_diff/handlers.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ def diff(self, differ, a, b):
210210
>>> b = {'one': 1, 'two': 42}
211211
>>>
212212
>>> Differ(handlers=[DictHandler()], O=False, U=False).diff(a, b)
213-
(False, {'D': {'three': {'R': 3}, 'two': {'N': 42}}})
213+
(False, {'D': {'two': {'N': 42}, 'three': {'R': 3}}})
214214
>>>
215215
216216
"""

pyproject.toml

+15-10
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ lint = [
5555
test = [
5656
'pytest',
5757
'pytest-cov',
58+
'pytest-pythonhashseed',
5859
'pytest-ruff',
5960
'ruff==0.8.0',
6061
]
@@ -68,17 +69,21 @@ Homepage = 'https://github.com/mr-mixas/Nested-Diff.py'
6869
Repository = 'https://github.com/mr-mixas/Nested-Diff.py.git'
6970

7071
[tool.pytest.ini_options]
71-
addopts = """
72-
--cov=nested_diff \
73-
--cov-fail-under=99 \
74-
--cov-report term-missing \
75-
--no-cov-on-fail \
76-
--ruff \
77-
--ruff-format \
78-
--verbosity=2 \
79-
"""
72+
addopts = [
73+
'--cov=nested_diff',
74+
'--cov-fail-under=99',
75+
'--cov-report', 'term-missing',
76+
'--no-cov-on-fail',
77+
'--doctest-modules',
78+
'--doctest-glob=*.md',
79+
'--pythonhashseed', '0',
80+
'--ruff',
81+
'--ruff-format',
82+
'--verbosity=2',
83+
]
84+
8085
doctest_optionflags = 'NORMALIZE_WHITESPACE'
81-
testpaths = 'nested_diff tests'
86+
testpaths = 'nested_diff tests *.md'
8287

8388
[tool.ruff]
8489
extend-exclude = [

tests/data/gen_standard.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ def format_test(**kwargs):
1515
}},""".format(**kwargs)
1616

1717

18-
def generate_tests(source_dir=sys.argv[1]):
18+
def generate_tests(source_dir):
1919
tests = []
2020
for file_name in sorted(os.listdir(source_dir)):
2121
with open(os.path.join(source_dir, file_name)) as f:
@@ -66,4 +66,4 @@ def get_tests():
6666

6767

6868
if __name__ == '__main__':
69-
generate_tests()
69+
generate_tests(sys.argv[1])

tests/test_misc.py

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import os
2+
3+
4+
def test_pythonhashseed():
5+
assert os.environ['PYTHONHASHSEED'] == '0'

tox.ini

+1-8
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,15 @@ extras =
1010
cli
1111
test
1212

13-
setenv =
14-
PYTHONHASHSEED = 1
15-
1613
[testenv:extended]
1714
commands =
18-
pytest --doctest-modules
19-
python -m doctest HOWTO.md README.md
15+
pytest
2016
darglint nested_diff
2117

2218
extras =
2319
{[testenv:essential]extras}
2420
lint
2521

26-
setenv =
27-
PYTHONHASHSEED = 1
28-
2922
# pyproject.toml not support yet
3023
[darglint]
3124
docstring_style=google

0 commit comments

Comments
 (0)