diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..4fa3bc9 --- /dev/null +++ b/Makefile @@ -0,0 +1,19 @@ +.PHONY: test install install-test test-tox clean + +test: + pytest + +install: + pip install -e . + +install-test: + pip install -e '.[test]' + +# test-tox runs the suite on every supported interpreter (2.7 and 3.7); Jenkins CI invokes this target. +test-tox: + tox + +clean: + rm -rf .pytest_cache .tox build dist *.egg-info + find . -name '*.py[co]' -delete + find . -name __pycache__ -type d -prune -exec rm -rf {} + diff --git a/README.rst b/README.rst index f4105b4..9f63ced 100644 --- a/README.rst +++ b/README.rst @@ -13,7 +13,7 @@ Requirements * pylibmc * Django 1.5+. -It was written and tested on Python 2.7 and 3.4. +It was written and tested on Python 2.7 and 3.7. Installation ------------ @@ -169,3 +169,9 @@ Install the test dependencies and run the tests like this:: pip install -e '.[test]' pytest + +To run the suite across the supported Python versions (2.7 and 3.7), use tox:: + + tox + +These steps are also wrapped in the Makefile as ``make install-test``, ``make test``, and ``make test-tox``. diff --git a/setup.py b/setup.py index bd05f78..cba0528 100644 --- a/setup.py +++ b/setup.py @@ -23,6 +23,8 @@ "pytest>=4.6; python_version >= '3.0'", "mock; python_version < '3.0'", ], + # Orchestration tooling for the outer env. tox builds and runs the per-version test envs. + "dev": ["tox"], }, classifiers=[ 'Development Status :: 4 - Beta', diff --git a/tox.ini b/tox.ini new file mode 100644 index 0000000..7773174 --- /dev/null +++ b/tox.ini @@ -0,0 +1,14 @@ +[tox] +envlist = py27, py37 +skip_missing_interpreters = False + +[testenv] +# Pin Django to the 1.11 series this package targets, the last release that runs on both 2.7 and 3.7 +# and still ships smart_text and PyLibMCCache that the backend imports. +deps = Django>=1.11,<2.0 +setenv = + PYTHONPATH = {toxinidir} +commands = + pip install -U pip + pip install -e .[test] + pytest --basetemp={envtmpdir}