Skip to content

Commit bbbdbca

Browse files
committed
Use pytest and parametrize the tests to the public SPARQL endpoints. Instead of having ~10 files of 1k3+ lines each, we now have 1 file with 774 lines, with the same test suite.
This makes the tests much more readable and maintainable. It is clearer which tests are run and skipped for each endpoint Time to run the full test suite is ~9/15min depending on public endpoints responses time (worst are dbpedia and wikidata, some 60s+ calls) Fixes #215
1 parent e8ab958 commit bbbdbca

17 files changed

+875
-15620
lines changed

.github/workflows/test.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@ jobs:
3030
- name: Test [wrapper]
3131
if: ${{ always() }}
3232
run: |
33-
python -m unittest test/test_wrapper.py -v
33+
pytest test/test_wrapper.py
3434
- name: Test [all]
3535
run: |
36-
python -m unittest -v |& tee log.txt
36+
pytest |& tee log.txt
3737
grep '^FAIL:' log.txt > fails.txt
3838
# if all failures is not raised in `test.test_wrapper`:
3939
if [ "$(grep 'test.test_wrapper' fails.txt | wc -l)" -ne "$(wc -l < fails.txt)" ]; then

pyproject.toml

+16-1
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,20 @@ build-backend = "setuptools.build_meta"
66
addopts = [
77
"--cov=SPARQLWrapper",
88
"--cov-report=term-missing",
9-
"--durations=10", # Show 10 slowest tests durations
9+
"--durations=3", # Show slowest tests durations
1010
]
11+
12+
[tool.mypy]
13+
files = ["SPARQLWrapper"]
14+
exclude = ["test"]
15+
python_version = "3.7"
16+
show_error_codes = true
17+
strict = true
18+
pretty = true
19+
warn_unused_configs = true
20+
warn_unused_ignores = true
21+
warn_unreachable = true
22+
23+
# [[tool.mypy.overrides]]
24+
# module = "tests.*"
25+
# disallow_untyped_defs = false

setup.cfg

-10
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,3 @@ docs =
6363
[options.entry_points]
6464
console_scripts =
6565
rqw = SPARQLWrapper.main:main
66-
67-
[mypy]
68-
files = SPARQLWrapper
69-
python_version = 3.7
70-
show_error_codes = True
71-
strict = True
72-
pretty = True
73-
warn_unused_configs = True
74-
warn_unused_ignores = True
75-
warn_unreachable = True

0 commit comments

Comments
 (0)