Skip to content

Commit f494509

Browse files
authored
Fix Tests failing on fresh install #130 (#137)
1 parent 4c39520 commit f494509

File tree

2 files changed

+32
-21
lines changed

2 files changed

+32
-21
lines changed

Makefile

+29-20
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,39 @@
1-
.PHONY: docs test clean pypi
1+
.PHONY: docs test clean pypi env
22

3-
test:
4-
python -m pytest src --doctest-modules -vvv
5-
PYTHONPATH="./src/" python -m pytest --cov=./src --cov-report html:htmlcov ./tests -vvv
6-
python -m pycodestyle tests
7-
python -m pycodestyle src
3+
PYTHON:=$(shell test -e env/bin/activate && echo "env/bin/python" || echo "python3")
84

9-
testcoverage:
10-
PYTHONPATH="./src/" python -m pytest --cov=./src tests/
5+
env:
6+
echo "Using $(shell exec $(PYTHON) --version): $(PYTHON)"
7+
$(PYTHON) -m ensurepip
118

12-
docs:
13-
cd docs/ && make clean html
9+
test: env lint
10+
$(PYTHON) -m pytest src --doctest-modules -vvv
11+
PYTHONPATH="./src/" $(PYTHON) -m pytest --cov=./src --cov-report html:htmlcov ./tests -vvv
1412

15-
setupdocs: setuptools
16-
python -m pip install -r docs/requirements.txt
13+
lint:
14+
$(PYTHON) -m pycodestyle tests
15+
$(PYTHON) -m pycodestyle src
1716

18-
dev: setuptools
19-
python -m pip install '.[test]'
17+
testcoverage: env
18+
PYTHONPATH="./src/" $(PYTHON) -m pytest --cov=./src tests/
19+
20+
docs: setupdocs clean
21+
cd docs/ && make html
22+
23+
setupdocs: env
24+
$(PYTHON) -m pip install -r docs/requirements.txt
25+
26+
dev: env setuptools
27+
$(PYTHON) -m pip install -e '.[test]'
2028

2129
clean:
2230
cd docs/ && make clean
2331

24-
setuptools:
25-
python -m pip install --upgrade setuptools wheel
32+
setuptools: env
33+
$(PYTHON) -m pip install --upgrade setuptools wheel
34+
35+
pypi: env setuptools test
36+
$(PYTHON) setup.py sdist bdist_wheel
37+
$(PYTHON) -m pip install --user --upgrade twine
38+
$(PYTHON) -m twine upload dist/*
2639

27-
pypi: setuptools test
28-
python setup.py sdist bdist_wheel
29-
python -m pip install --user --upgrade twine
30-
python -m twine upload dist/*

docs/Makefile

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
# Minimal makefile for Sphinx documentation
22
#
33

4+
PYTHON := $(shell test -e ../env/bin/activate && echo "../env/bin/python" || echo "python3")
5+
46
# You can set these variables from the command line.
57
SPHINXOPTS =
6-
SPHINXBUILD = sphinx-build
8+
SPHINXBUILD = $(PYTHON) -msphinx
79
SOURCEDIR = .
810
BUILDDIR = build
911

0 commit comments

Comments
 (0)