Skip to content

Commit

Permalink
Merge pull request #5261 from hypothesis/run-make-dev-in-tox
Browse files Browse the repository at this point in the history
Run `make dev` and `make lint` in tox
  • Loading branch information
seanh committed Oct 2, 2018
2 parents 63face9 + dd9aa53 commit c4ed735
Show file tree
Hide file tree
Showing 7 changed files with 65 additions and 81 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ mail/
.eggs/
*.egg
*.egg-info
.pydeps
.pytest_cache

# development TLS cert/key
Expand Down
7 changes: 4 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ matrix:
postgresql: "9.4"
before_install:
- ./scripts/elasticsearch.sh
install: pip install tox
install: pip install tox==3.3.0 tox-pip-extensions
before_script: createdb htest
script: tox
after_success:
Expand All @@ -24,7 +24,7 @@ matrix:
postgresql: '9.4'
before_install:
- ./scripts/elasticsearch.sh
install: pip install tox
install: pip install tox==3.3.0 tox-pip-extensions
before_script: createdb htest
script:
make test-py3
Expand All @@ -50,14 +50,15 @@ matrix:
- env: ACTION=backend-lint
language: python
python: '3.6'
install: pip install tox==3.3.0 tox-pip-extensions
script:
make lint

# Check the docs build for warnings or errors.
- env: ACTION=check-docs
language: python
python: '3.6'
install: pip install tox
install: pip install tox==3.3.0 tox-pip-extensions
script:
make checkdocs

Expand Down
2 changes: 1 addition & 1 deletion Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ node {
// Test dependencies
sh 'apk add --no-cache build-base libffi-dev postgresql-dev python-dev'
sh 'apk add --no-cache python3 python3-dev'
sh 'pip install -q tox'
sh 'pip install -q tox==3.3.0 tox-pip-extensions'

// Unit tests
sh 'cd /var/lib/hypothesis && tox'
Expand Down
31 changes: 5 additions & 26 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,6 @@ DOCKER_TAG = dev

GULP := node_modules/.bin/gulp

# Unless the user has specified otherwise in their environment, it's probably a
# good idea to refuse to install unless we're in an activated virtualenv.
ifndef PIP_REQUIRE_VIRTUALENV
PIP_REQUIRE_VIRTUALENV = 1
endif
export PIP_REQUIRE_VIRTUALENV

.PHONY: default
default: test

Expand All @@ -20,14 +13,13 @@ build/manifest.json: node_modules/.uptodate
clean:
find . -type f -name "*.py[co]" -delete
find . -type d -name "__pycache__" -delete
rm -f node_modules/.uptodate .pydeps
rm -f node_modules/.uptodate
rm -rf build

## Run the development H server locally
.PHONY: dev
dev: build/manifest.json .pydeps
@bin/hypothesis --dev init
@bin/hypothesis devserver
dev: build/manifest.json
tox -e py27-dev

## Build hypothesis/hypothesis docker image
.PHONY: docker
Expand Down Expand Up @@ -57,7 +49,6 @@ run-docker:
## Run test suite
.PHONY: test
test: node_modules/.uptodate
@pip install -q tox
tox
$(GULP) test

Expand All @@ -66,39 +57,27 @@ test-py3: node_modules/.uptodate
tox -e py36 -- tests/h/

.PHONY: lint
lint: .pydeps
flake8 h
flake8 tests
flake8 --select FI14 --exclude 'h/cli/*,tests/h/cli/*,h/util/uri.py,h/migrations/versions/*' h tests
lint:
tox -e lint

.PHONY: docs
docs:
@pip install -q tox
tox -e docs

.PHONY: checkdocs
checkdocs:
@pip install -q tox
tox -e checkdocs

.PHONY: docstrings
docstrings:
@pip install -q tox
tox -e docstrings

.PHONY: checkdocstrings
checkdocstrings:
@pip install -q tox
tox -e checkdocstrings

################################################################################

# Fake targets to aid with deps installation
.pydeps: requirements.txt requirements-dev.in
@echo installing python dependencies
@pip install -r requirements-dev.in tox
@touch $@

node_modules/.uptodate: package.json
@echo installing javascript dependencies
@node_modules/.bin/check-dependencies 2>/dev/null || npm install
Expand Down
46 changes: 6 additions & 40 deletions docs/developing/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -39,22 +39,20 @@ Install the following packages:
libpq-dev \
libssl-dev \
python-dev \
python-pip \
python-virtualenv
python-pip
Install node by following the
`instructions on nodejs.org <https://nodejs.org/en/download/package-manager/>`_
(the version of the nodejs package in the standard Ubuntu repositories is too
old).

Upgrade pip, virtualenv and npm:
Upgrade pip and npm, and install tox and tox-pip-extensions:

.. code-block:: bash
sudo pip install -U pip virtualenv
sudo pip install -U pip tox tox-pip-extensions
sudo npm install -g npm
Installing the system dependencies on macOS
-------------------------------------------

Expand All @@ -78,11 +76,12 @@ Install the following packages:
.. note:: Unfortunately you need to install the ``postgresql`` package, because
Homebrew does not currently provide a standalone ``libpq`` package.

Upgrade pip and virtualenv:
Upgrade pip and install tox and tox-pip-extensions:

.. code-block:: bash
pip install -U pip virtualenv
pip install -U pip tox tox-pip-extensions
Getting the h source code from GitHub
-------------------------------------
Expand Down Expand Up @@ -186,39 +185,6 @@ Install ``gulp-cli`` to get the ``gulp`` command:
sudo npm install -g gulp-cli
Creating a Python virtual environment
-------------------------------------

Create a Python virtual environment to install and run the h Python code and
Python dependencies in:

.. code-block:: bash
virtualenv .venv
.. _activating_your_virtual_environment:

Activating your virtual environment
-----------------------------------

Activate the virtual environment that you've created:

.. code-block:: bash
source .venv/bin/activate
.. tip::

You'll need to re-activate this virtualenv with the
``source .venv/bin/activate`` command each time you open a new terminal,
before running h.
See the `Virtual Environments`_ section in the Hitchhiker's guide to
Python for an introduction to Python virtual environments.

.. _Virtual Environments: http://docs.python-guide.org/en/latest/dev/virtualenvs/


Running h
---------

Expand Down
4 changes: 0 additions & 4 deletions requirements-dev.in
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
-r requirements.txt

flake8
flake8-future-import
honcho
pep257
prospector[with_pyroma]
pyramid_debugtoolbar
55 changes: 49 additions & 6 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
[tox]
envlist = py27
skipsdist = true
requires =
tox-pip-extensions
tox_pip_extensions_ext_venv_update = true

[pytest]
minversion = 2.8
Expand All @@ -25,6 +28,43 @@ passenv =
commands =
coverage run --parallel --source h,tests/h -m pytest -Werror {posargs:tests/h/}

[dev]
deps = -rrequirements-dev.in
passenv =
ALLOWED_ORIGINS
AUTHORITY
BOUNCER_URL
CLIENT_OAUTH_ID
CLIENT_RPC_ALLOWED_ORIGINS
CLIENT_URL
CONFIG_URI
MODEL_CREATE_ALL
SEARCH_AUTOCONFIG
USE_HTTPS
WEBSOCKET_URL
whitelist_externals = sh
commands =
sh bin/hypothesis --dev init
{posargs:sh bin/hypothesis devserver}

[testenv:py27-dev]
deps = {[dev]deps}
passenv = {[dev]passenv}
whitelist_externals = {[dev]whitelist_externals}
commands = {[dev]commands}

[testenv:py36-dev]
deps = {[dev]deps}
passenv = {[dev]passenv}
whitelist_externals = {[dev]whitelist_externals}
commands = {[dev]commands}

[testenv:py37-dev]
deps = {[dev]deps}
passenv = {[dev]passenv}
whitelist_externals = {[dev]whitelist_externals}
commands = {[dev]commands}

[functional]
deps =
pytest
Expand Down Expand Up @@ -67,42 +107,45 @@ passenv = CI TRAVIS*
commands = codecov

[docs]
basepython = python3.6
changedir = docs
deps =
sphinx
sphinx_rtd_theme
sphinx-autobuild

[testenv:docs]
basepython = {[docs]basepython}
changedir = {[docs]changedir}
deps = {[docs]deps}
commands = sphinx-autobuild -BqT -b dirhtml -d {envtmpdir}/doctrees . {envtmpdir}/html

[testenv:checkdocs]
basepython = {[docs]basepython}
changedir = {[docs]changedir}
deps = {[docs]deps}
commands = sphinx-build -qTWn -b dirhtml -d {envtmpdir}/doctrees . {envtmpdir}/html

[docstrings]
basepython = {[docs]basepython}
commands = sphinx-apidoc -ePMF -a -H "Dooccsstrinngs!!" --ext-intersphinx --ext-todo --ext-viewcode -o {envtmpdir}/rst .
deps =
{[docs]deps}
{[testenv]deps}

[testenv:docstrings]
basepython = {[docstrings]basepython}
deps = {[docstrings]deps}
commands =
{[docstrings]commands}
sphinx-autobuild -BqT -z h -z tests -b dirhtml {envtmpdir}/rst {envtmpdir}/dirhtml

[testenv:checkdocstrings]
basepython = {[docstrings]basepython}
deps = {[docstrings]deps}
commands =
{[docstrings]commands}
sphinx-build -qTn -b dirhtml {envtmpdir}/rst {envtmpdir}/dirhtml

[testenv:lint]
deps =
flake8
flake8-future-import
commands =
flake8 h
flake8 tests
flake8 --select FI14 --exclude 'h/cli/*,tests/h/cli/*,h/util/uri.py,h/migrations/versions/*' h tests

0 comments on commit c4ed735

Please sign in to comment.