forked from mozilla-releng/balrog
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
43 lines (37 loc) · 1.43 KB
/
Makefile
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
VIRTUALENV ?= /usr/bin/virtualenv
# The Python binary to use when running the virtualenv script. Also used for
# running the tests when TEST_PYTHON isn't provided.
PYTHON ?= python
NOSE ?= nosetests
VIRTUALENV_DIR ?= $(error VIRTUALENV_DIR must be set when running virtualenv or ci-tests targets)
# The Python binary to use when running tests.
TEST_PYTHON ?= $(PYTHON)
PYTHONPATH ?= vendor/lib/python
# A pip requirements file describing the dependencies that should be installed
# into the virtualenv.
REQUIREMENTS=requirements/dev.txt
COMPILED_REQUIREMENTS=requirements/compiled.txt
ifdef VERBOSE
NOSE_ARGS=-v
TEST_ARGS=-v
endif
ALL_PY_FILES := $(shell find . -iname "*.py")
# Used to run the tests. Useful for both CI-driven tests and manual ones.
test: test.done
test.done: $(ALL_PY_FILES)
@echo Running unit tests
PYTHONPATH=$(PYTHONPATH) $(NOSE) $(NOSE_ARGS)
@echo Running rules tests
$(TEST_PYTHON) test-rules.py $(TEST_ARGS)
touch $@
# Creates a virtualenv containing all the requirements needed to run tests.
virtualenv:
$(PYTHON) $(VIRTUALENV) --no-site-packages $(VIRTUALENV_DIR)
$(VIRTUALENV_DIR)/bin/pip -q install -r $(REQUIREMENTS)
$(VIRTUALENV_DIR)/bin/pip -q install -r $(COMPILED_REQUIREMENTS)
clobber-test:
$(RM) test.done
# Run the tests, installing any necessary libraries into a virtualenv.
ci-tests: NOSE=$(VIRTUALENV_DIR)/bin/nosetests
ci-tests: TEST_PYTHON=$(VIRTUALENV_DIR)/bin/python
ci-tests: clobber-test virtualenv test