Skip to content

Commit

Permalink
Switch to tox-based flow
Browse files Browse the repository at this point in the history
PR #263
  • Loading branch information
webknjaz committed Jul 19, 2018
2 parents b51bb59 + 3cb6212 commit 25da978
Show file tree
Hide file tree
Showing 7 changed files with 152 additions and 104 deletions.
17 changes: 10 additions & 7 deletions .appveyor.yml
Expand Up @@ -16,17 +16,17 @@ environment:
- PYTHON: "C:\\Python37-x64"

install:
- "tools/build.cmd %PYTHON%\\python.exe -m pip install -U setuptools wheel codecov"
- tools/build.cmd %PYTHON%\\python.exe -m pip install -r requirements/ci.txt
- "tools/build.cmd %PYTHON%\\python.exe -m pip install -U tox"
- "tools/build.cmd %PYTHON%\\python.exe -m tox --notest" # Pre-populate a virtualenv with dependencies

build_script:
- "tools/build.cmd %PYTHON%\\python.exe setup.py sdist bdist_wheel"
- "tools/build.cmd %PYTHON%\\python.exe -m tox -e build-dists"

test_script:
- "tools/build.cmd %PYTHON%\\python.exe -m pytest tests --junitxml=junit-test-results.xml --cov-report term-missing:skip-covered --cov-report xml"
- "tools/build.cmd %PYTHON%\\python.exe -m tox"

after_test:
- "tools/build.cmd %PYTHON%\\python.exe -m codecov -f coverage.xml -X gcov"
- "tools/build.cmd %PYTHON%\\python.exe -m tox -e codecov"
- ps: |
$wc = New-Object 'System.Net.WebClient'
$wc.UploadFile("https://ci.appveyor.com/api/testresults/junit/$($env:APPVEYOR_JOB_ID)", (Resolve-Path .\junit-test-results.xml))
Expand All @@ -35,12 +35,15 @@ artifacts:
- path: dist\*

before_deploy:
- "tools/build.cmd %PYTHON%\\python.exe -m pip install twine"
- ps: >-
if($env:appveyor_repo_tag -eq 'True') {
Invoke-Expression "tools/build.cmd $env:PYTHON\\python.exe -m tox -e upload-dists --notest"
}
deploy_script:
- ps: >-
if($env:appveyor_repo_tag -eq 'True') {
Invoke-Expression "$env:PYTHON\\python.exe -m twine upload dist/* --username $env:PYPI_USERNAME --password $env:PYPI_PASSWORD"
Invoke-Expression "tools/build.cmd $env:PYTHON\\python.exe -m tox -e upload-dists"
}
#notifications:
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Expand Up @@ -75,4 +75,5 @@ multidict/_istr.html
# test results in junit format for Appveyor
/junit-test-results.xml

.pytest_cache
.pytest_cache
.testmondata
43 changes: 16 additions & 27 deletions .travis.yml
Expand Up @@ -13,15 +13,15 @@ python:
- 3.6-dev
- nightly

install:
- &upgrade_python_toolset pip install --upgrade pip wheel setuptools
- pip install -r requirements/ci.txt
install: &default_install
- python -m pip install -U tox
- python -m tox --notest # Pre-populate a virtualenv with dependencies

script:
- make test
script: &default_script
- python -m tox

after_success:
- codecov
- python -m tox -e codecov

env:
matrix:
Expand All @@ -43,14 +43,11 @@ _helpers:
stage: &doc_stage_name docs, linting and pre-test checks
<<: *_mainstream_python_base
<<: *_reset_steps
install:
- *upgrade_python_toolset
- pip install -U -r requirements/dev.txt
install: *default_install
script: *default_script
- &_doc_base
<<: *_lint_base
install:
- *upgrade_python_toolset
- pip install -U -r requirements/doc.txt -r requirements/dev.txt
install: *default_install
after_failure: cat docs/_build/spelling/output.txt
addons:
apt:
Expand Down Expand Up @@ -159,29 +156,22 @@ jobs:
- <<: *_doc_base
env:
- docs <- <- <- <- <- <- <- <- <- <- <- <- <- <- <- <- <- <- <- <- <- <- <- <- <- <- <- <- <- <- <- <- <- =
script:
- make doc-spelling
- TOXENV=doc-spelling

- <<: *_lint_base
env:
- flake8 <- <- <- <- <- <- <- <- <- <- <- <- <- <- <- <- <- <- <- <- <- <- <- <- <- <- <- <- <- <- <- <- <=
script:
- flake8 multidict tests
- TOXENV=flake8

- <<: *_lint_base
env:
- mypy <- <- <- <- <- <- <- <- <- <- <- <- <- <- <- <- <- <- <- <- <- <- <- <- <- <- <- <- <- <- <- <- <- =
script:
- make mypy
- TOXENV=mypy

- <<: *_lint_base
env:
- dist setup check <- <- <- <- <- <- <- <- <- <- <- <- <- <- <- <- <- <- <- <- <- <- <- <- <- <- <- <- <- =
install:
- *upgrade_python_toolset
- pip install docutils
script:
- python setup.py check --metadata --restructuredtext --strict --verbose
- TOXENV=setup-check

- <<: *osx_python_base
python: 3.4
Expand Down Expand Up @@ -212,14 +202,13 @@ jobs:
# Build and deploy manylinux1 binary wheels and source distribution
- <<: *generic_deploy_base
<<: *_reset_steps
env: Build and deploy to PYPI of manylinux1 binary wheels for all supported Pythons and source distribution=
env:
- Build and deploy to PYPI of manylinux1 binary wheels for all supported Pythons and source distribution=
- TOXENV=manylinux1
dist: trusty
group: edge
services:
- docker
script:
- ./tools/run_docker.sh "multidict"
- pip install -r requirements/ci.txt # to compile *.c files by Cython

# Build and deploy MacOS binary wheels for each OSX+Python combo possible
# OS X 10.10, Python 3.4
Expand Down
72 changes: 25 additions & 47 deletions Makefile
Expand Up @@ -2,59 +2,41 @@

all: test

.install-deps: $(shell find requirements -type f)
pip install -U -r requirements/dev.txt
touch .install-deps

flake: .install-deps
# python setup.py check -rms
flake8 multidict
if python -c "import sys; sys.exit(sys.version_info < (3,5))"; then \
flake8 tests; \
fi
flake:
tox -e flake8


.develop: .install-deps $(shell find multidict -type f)
rm -f multidict/*.so
rm -f multidict/_multidict.c
pip install -e .
touch .develop

rmcache:
rm -rf tests/__pycache__


mypy: .develop
if python -c "import sys; sys.exit(sys.implementation.name != 'cpython')"; then \
mypy multidict tests; \
fi
mypy:
tox -e mypy


test: flake .develop rmcache mypy
pytest -q ./tests/
test:
tox

vtest: flake .develop rmcache mypy
pytest -s -v ./tests/

cov cover coverage:
tox
vtest:
tox -- -vv

profile-dev-base: .install-deps
rm -f .develop
rm -f multidict/*.so
rm -f multidict/_multidict.c
PROFILE_BUILD=x pip install -e .
touch .develop

qtest:
tox -- -q


cov-dev: profile-dev-base rmcache mypy
pytest --cov=multidict --cov-report=term --cov-report=html tests
@echo "open file://`pwd`/htmlcov/index.html"
cov-dev: mypy
tox -e profile-dev -- --cov-report=html
@which xdg-open 2>/dev/null 1>&2 && export opener=xdg-open || export opener=open && \
$${opener} "file://`pwd`/htmlcov/index.html"

cov-dev-full: profile-dev-base rmcache mypy
AIOHTTPMULTIDICT_NO_EXTENSIONS=1 pytest --cov=multidict --cov-append tests
pytest --cov=multidict --cov-report=term --cov-report=html tests
@echo "open file://`pwd`/htmlcov/index.html"
cov-dev-full: mypy
MULTIDICT_NO_EXTENSIONS=1 tox -e profile-dev -- --cov-report=html
tox -e profile-dev -- --cov-report=html
@which xdg-open 2>/dev/null 1>&2 && export opener=xdg-open || export opener=open && \
$${opener} "file://`pwd`/htmlcov/index.html"

clean:
rm -rf `find . -name __pycache__`
Expand Down Expand Up @@ -83,22 +65,18 @@ clean:
rm -f multidict/_multidict_iter.*.so
rm -f multidict/_multidict_iter.*.pyd
rm -rf .tox
rm -f .install-deps
rm -f .develop

doc:
make -C docs html
@echo "open file://`pwd`/docs/_build/html/index.html"
tox -e doc-html
@which xdg-open 2>/dev/null 1>&2 && export opener=xdg-open || export opener=open && \
$${opener} "file://`pwd`/docs/_build/html/index.html"

doc-spelling:
make -C docs spelling
tox -e doc-spelling

install:
pip install -U tox
pip install -U pip
pip install -Ur requirements/dev.txt

wheel_x64:
docker pull quay.io/pypa/manylinux1_x86_64
docker run --rm -v `pwd`:/io quay.io/pypa/manylinux1_x86_64 /io/build-wheels.sh

.PHONY: all build venv flake test vtest testloop cov clean doc
7 changes: 4 additions & 3 deletions pytest.ini
@@ -1,4 +1,5 @@
[pytest]
norecursedirs=dist build .tox docs requirements tools
addopts=--doctest-modules --cov=multidict
doctest_optionflags=ALLOW_UNICODE ELLIPSIS
testpaths = tests
norecursedirs = dist build .tox docs requirements tools
addopts = --doctest-modules --cov=multidict --cov-report term-missing:skip-covered --cov-report xml --junitxml=junit-test-results.xml -v
doctest_optionflags = ALLOW_UNICODE ELLIPSIS
5 changes: 2 additions & 3 deletions shippable.yml
Expand Up @@ -11,6 +11,5 @@ env:

build:
ci:
- pip install --upgrade pip wheel setuptools
- pip install -r requirements/ci.txt
- make test
- pip install -U tox
- python -m tox

0 comments on commit 25da978

Please sign in to comment.