summaryrefslogtreecommitdiff
path: root/Makefile
blob: 07b4e320269ae1d0191356b72cfd399eeb21cf43 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# Config
OSNAME			:= $(shell uname)

ifeq ($(OSNAME), Linux)
OPEN_COMMAND		:= gnome-open
else
OPEN_COMMAND		:= open
endif


all: check_dependencies unit functional

filename=httpretty-`python -c 'import httpretty;print httpretty.version'`.tar.gz

export HTTPRETTY_DEPENDENCIES:= nose sure
export PYTHONPATH:= ${PWD}

check_dependencies:
	@echo "Checking for dependencies to run tests ..."
	@for dependency in `echo $$HTTPRETTY_DEPENDENCIES`; do \
		python -c "import $$dependency" 2>/dev/null || (echo "You must install $$dependency in order to run httpretty's tests" && exit 3) ; \
		done

test: unit functional

lint:
	@echo "Checking code style ..."
	@flake8 --show-source --ignore=F821,E901 httpretty

unit: prepare
	@echo "Running unit tests ..."
	@nosetests --rednose -x --with-randomly --with-coverage --cover-package=httpretty -s tests/unit

functional: prepare
	@echo "Running functional tests ..."
	@nosetests --rednose -x --with-coverage --cover-package=httpretty -s tests/functional

pyopenssl: prepare
	@echo "Running PyOpenSSL mocking tests ..."
	@pip install --quiet pyOpenSSL==16.1.0
	@pip install --quiet ndg-httpsclient==0.4.2
	@nosetests --rednose -x --with-coverage --cover-package=httpretty -s tests/pyopenssl

clean:
	@printf "Cleaning up files that are already in .gitignore... "
	@for pattern in `cat .gitignore`; do rm -rf $$pattern; done
	@echo "OK!"

release: clean unit functional
	@echo "Releasing httpretty..."
	@./.release
	@python setup.py sdist bdist_wheel register upload

docs:
	@cd docs && make html
	$(OPEN_COMMAND) docs/build/html/index.html

deploy-docs:
	@git co master && \
		(git br -D gh-pages || printf "") && \
		git checkout --orphan gh-pages && \
		markment -o . -t ./theme --sitemap-for="http://falcao.it/HTTPretty" docs && \
		git add . && \
		git commit -am 'documentation' && \
		git push --force origin gh-pages && \
		git checkout master

prepare:
	@reset


.PHONY: docs