Skip to content

Commit bfd4b83

Browse files
committed
parallel test coverage
1 parent aa295b1 commit bfd4b83

File tree

5 files changed

+36
-37
lines changed

5 files changed

+36
-37
lines changed

.coveragerc

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
[run]
22
branch = True
33
source = schema_salad
4+
omit = schema_salad/tests/*
45

56
[report]
67
exclude_lines =

Makefile

+21-20
Original file line numberDiff line numberDiff line change
@@ -26,20 +26,18 @@ PACKAGE=schema-salad
2626
# `SHELL=bash` doesn't work for some, so don't use BASH-isms like
2727
# `[[` conditional expressions.
2828
PYSOURCES=$(wildcard ${MODULE}/**.py ${MODULE}/avro/*.py ${MODULE}/tests/*.py) setup.py
29-
DEVPKGS=diff_cover black pylint coverage pep257 pydocstyle flake8 tox\
29+
DEVPKGS=diff_cover black pylint pep257 pydocstyle flake8 tox tox-pyenv \
3030
isort wheel autoflake flake8-bugbear pyupgrade bandit \
3131
-rtest-requirements.txt -rmypy_requirements.txt
32-
COVBASE=coverage run --branch --append --source=${MODULE} \
33-
--omit=schema_salad/tests/*
32+
COVBASE=coverage run --append
3433

3534
# Updating the Major & Minor version below?
3635
# Don't forget to update setup.py as well
3736
VERSION=7.1.$(shell date +%Y%m%d%H%M%S --utc --date=`git log --first-parent \
3837
--max-count=1 --format=format:%cI`)
3938

4039
## all : default task
41-
all:
42-
pip install -e .
40+
all: dev
4341

4442
## help : print this help message and exit
4543
help: Makefile
@@ -48,7 +46,7 @@ help: Makefile
4846
## install-dep : install most of the development dependencies via pip
4947
install-dep: install-dependencies
5048

51-
install-dependencies:
49+
install-dependencies: FORCE
5250
pip install --upgrade $(DEVPKGS)
5351
pip install -r requirements.txt
5452

@@ -58,7 +56,7 @@ install: FORCE
5856

5957
## dev : install the ${MODULE} module in dev mode
6058
dev: install-dep
61-
pip install -e
59+
pip install -e .
6260

6361
## dist : create a module package for distribution
6462
dist: dist/${MODULE}-$(VERSION).tar.gz
@@ -108,16 +106,15 @@ pylint: $(PYSOURCES)
108106
pylint --msg-template="{path}:{line}: [{msg_id}({symbol}), {obj}] {msg}" \
109107
$^ -j0|| true
110108

111-
pylint_report.txt: ${PYSOURCES}
109+
pylint_report.txt: $(PYSOURCES)
112110
pylint --msg-template="{path}:{line}: [{msg_id}({symbol}), {obj}] {msg}" \
113111
$^ -j0> $@ || true
114112

115113
diff_pylint_report: pylint_report.txt
116114
diff-quality --violations=pylint pylint_report.txt
117115

118-
.coverage: $(PYSOURCES) all
119-
rm -f .coverage
120-
$(COVBASE) setup.py test
116+
.coverage: testcov
117+
python setup.py test --addopts "--cov --cov-config=.coveragerc --cov-report= -n auto"
121118
$(COVBASE) -m schema_salad.main \
122119
--print-jsonld-context schema_salad/metaschema/metaschema.yml \
123120
> /dev/null
@@ -162,34 +159,38 @@ diff-cover.html: coverage.xml
162159
diff-cover $^ --html-report $@
163160

164161
## test : run the ${MODULE} test suite
165-
test: FORCE
166-
python setup.py test --addopts "-n auto"
162+
test: $(PYSOURCES)
163+
python setup.py test
164+
165+
## testcov : run the ${MODULE} test suite and collect coverage
166+
testcov: $(PYSOURCES)
167+
python setup.py test --addopts "--cov"
167168

168-
sloccount.sc: ${PYSOURCES} Makefile
169+
sloccount.sc: $(PYSOURCES) Makefile
169170
sloccount --duplicates --wide --details $^ > $@
170171

171172
## sloccount : count lines of code
172-
sloccount: ${PYSOURCES} Makefile
173+
sloccount: $(PYSOURCES) Makefile
173174
sloccount $^
174175

175176
list-author-emails:
176177
@echo 'name, E-Mail Address'
177178
@git log --format='%aN,%aE' | sort -u | grep -v 'root'
178179

179180
mypy3: mypy
180-
mypy: ${PYSOURCES}
181+
mypy: $(filter-out setup.py gittagger.py,$(PYSOURCES))
181182
if ! test -f $(shell python3 -c 'import ruamel.yaml; import os.path; print(os.path.dirname(ruamel.yaml.__file__))')/py.typed ; \
182183
then \
183184
rm -Rf typeshed/ruamel/yaml ; \
184185
ln -s $(shell python3 -c 'import ruamel.yaml; import os.path; print(os.path.dirname(ruamel.yaml.__file__))') \
185186
typeshed/ruamel/ ; \
186187
fi # if minimally required ruamel.yaml version is 0.15.99 or greater, than the above can be removed
187-
MYPYPATH=$$MYPYPATH:typeshed mypy schema_salad
188+
MYPYPATH=$$MYPYPATH:typeshed mypy $^
188189

189-
mypyc: ${PYSOURCES}
190+
mypyc: $(PYSOURCES)
190191
MYPYPATH=typeshed SCHEMA_SALAD_USE_MYPYC=1 python setup.py test
191192

192-
pyupgrade: $(filter-out schema_salad/metaschema.py,${PYSOURCES})
193+
pyupgrade: $(filter-out schema_salad/metaschema.py,$(PYSOURCES))
193194
pyupgrade --exit-zero-even-if-changed --py36-plus $^
194195

195196
release-test: FORCE
@@ -204,7 +205,7 @@ release: release-test
204205
twine upload testenv2/src/${PACKAGE}/dist/* && \
205206
git tag ${VERSION} && git push --tags
206207

207-
flake8: ${PYSOURCES}
208+
flake8: $(PYSOURCES)
208209
flake8 $^
209210

210211
FORCE:

appveyor.yml

+8-5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
version: .{build}-{branch}
2+
image: Visual Studio 2019
23

34
cache:
45
- '%LOCALAPPDATA%\pip\Cache'
@@ -20,20 +21,22 @@ environment:
2021
PYTHON_VERSION: "3.8.x"
2122
PYTHON_ARCH: "64"
2223

24+
- PYTHON: "C:\\Python39-x64"
25+
PYTHON_VERSION: "3.9.x"
26+
PYTHON_ARCH: "64"
27+
2328
install:
2429
- "set PATH=%PYTHON%\\Scripts;%PATH%"
2530
- "%PYTHON%\\python.exe -m pip install -U pip setuptools^>=20.3 wheel"
26-
- "%PYTHON%\\python.exe -m pip install -U pytest^<7 codecov pytest-xdist pytest-cov galaxy-lib"
27-
# Note the use of a `^` to escape the `>`
31+
- "%PYTHON%\\python.exe -m pip install -U -rtest-requirements.txt codecov"
32+
- "%PYTHON%\\python.exe -m pip install -rrequirements.txt"
2833

2934
build_script:
30-
- "%PYTHON%\\python.exe -m pip install -rrequirements.txt"
3135
- "%PYTHON%\\python.exe -m pip install -e ."
3236

3337
test_script:
3438
- |
35-
%PYTHON%\\python.exe -m coverage run --parallel-mode -m pytest --strict -p no:cacheprovider -p no:stepwise --junit-xml=tests.xml
36-
- "%PYTHON%\\python.exe -m coverage combine"
39+
%PYTHON%\\python.exe -m pytest --cov --cov-config=.coveragerc --cov-report= -n auto --strict-markers -p no:cacheprovider -p no:stepwise --junit-xml=tests.xml
3740
- "%PYTHON%\\python.exe -m coverage report"
3841
- "%PYTHON%\\python.exe -m coverage xml"
3942
- "%PYTHON%\\python.exe -m codecov --file coverage.xml"

setup.cfg

-3
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@ extend-ignore = E203, W503
66
[aliases]
77
test=pytest
88

9-
[tool:pytest]
10-
addopts=--pyargs schema_salad
11-
129
[tool:isort]
1310
multi_line_output = 3
1411
include_trailing_comma = True

tox.ini

+6-9
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ envlist =
1010
skipsdist = True
1111
skip_missing_interpreters = True
1212

13+
[pytest]
14+
addopts=-n auto --pyargs schema_salad
15+
1316
[gh-actions]
1417
python =
1518
3.6: py36
@@ -30,24 +33,18 @@ passenv =
3033
GITHUB_*
3134
deps =
3235
py{36,37,38,39}-{unit,lint,bandit,mypy}: -rrequirements.txt
33-
py{36,37,38,39}-unit: codecov
3436
py{36,37,38,39}-{unit,mypy}: -rtest-requirements.txt
3537
py{36,37,38,39}-lint: flake8-bugbear
3638
py{36,37,38,39}-lint: black
3739
py{36,37,38,39}-bandit: bandit
3840
py{36,37,38,39}-mypy: -rmypy_requirements.txt
3941

4042
setenv =
41-
py{36,37,38,39}-unit: LC_ALL = C
43+
py{36,37,38,39}-unit: LC_ALL = C.UTF-8
4244

4345
commands =
4446
py{36,37,38,39}-unit: python -m pip install -U pip setuptools wheel
45-
py{36,37,38,39}-unit: python -m pip install -e .
46-
py{36,37,38,39}-unit: coverage run --parallel-mode -m pytest -n auto --strict-markers {posargs}
47-
py{36,37,38,39}-unit: coverage combine
48-
py{36,37,38,39}-unit: coverage report
49-
py{36,37,38,39}-unit: coverage xml
50-
py{36,37,38,39}-unit: codecov --file coverage.xml
47+
py{36,37,38,39}-unit: make coverage-report coverage.xml
5148
py{36,37,38,39}-bandit: bandit --recursive --exclude schema_salad/tests/ schema_salad
5249
py{36,37,38,39}-lint: make flake8
5350
py{36,37,38,39}-lint: make format-check
@@ -57,7 +54,7 @@ commands =
5754
whitelist_externals =
5855
py{36,37,38,39}-lint: flake8
5956
py{36,37,38,39}-lint: black
60-
py{36,37,38,39}-{mypy,shellcheck,lint}: make
57+
py{36,37,38,39}-{mypy,shellcheck,lint,unit}: make
6158

6259
[testenv:py39-pydocstyle]
6360
whitelist_externals = make

0 commit comments

Comments
 (0)