~harlowja/cloud-init/tox-venvs

« back to all changes in this revision

Viewing changes to Makefile

  • Committer: Joshua Harlow
  • Date: 2014-01-26 01:00:38 UTC
  • Revision ID: harlowja@gmail.com-20140126010038-smsyr4lztcjrpk81
Use a venv for testing and for lint checking

Remove the pep8 & pylint tools and use a venv
with tox instead. Also create a venv that will
run for the given python version to perform the
cloud-init tests.

These help remove the need to install the same
dependencies in the root python environment env
to just run the standard set of tests.

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
PY_FILES=$(shell find cloudinit bin tests tools -name "*.py" -type f )
3
3
PY_FILES+="bin/cloud-init"
4
4
 
 
5
PY_ENV=$(shell python -c 'import sys; print("py%s%s" % (sys.version_info[0:2]))')
 
6
 
5
7
YAML_FILES=$(shell find cloudinit bin tests tools -name "*.yaml" -type f )
6
8
YAML_FILES+=$(shell find doc/examples -name "cloud-config*.txt" -type f )
7
9
 
8
10
CHANGELOG_VERSION=$(shell $(CWD)/tools/read-version)
9
11
CODE_VERSION=$(shell python -c "from cloudinit import version; print version.version_string()")
10
12
 
11
 
PIP_INSTALL := pip install
12
 
 
13
13
ifeq ($(distro),)
14
14
  distro = redhat
15
15
endif
16
16
 
17
17
all: test check_version
18
18
 
19
 
pep8:
20
 
        @$(CWD)/tools/run-pep8 $(PY_FILES)
21
 
 
22
 
pylint:
23
 
        @$(CWD)/tools/run-pylint $(PY_FILES)
24
 
 
25
 
pyflakes:
26
 
        pyflakes $(PY_FILES)
27
 
 
28
 
pip-requirements:
29
 
        @echo "Installing cloud-init dependencies..."
30
 
        $(PIP_INSTALL) -r "$@.txt" -q
31
 
 
32
 
pip-test-requirements:
33
 
        @echo "Installing cloud-init test dependencies..."
34
 
        $(PIP_INSTALL) -r "$@.txt" -q
35
 
 
36
 
test: clean_pyc
37
 
        @echo "Running tests..."
38
 
        @nosetests $(noseopts) tests/
 
19
flake8:
 
20
        @echo "Running flake8 using tox..."
 
21
        @tox -e flake8 $(PY_FILES)
 
22
 
 
23
test:
 
24
        @echo "Running tests for env=$(PY_ENV) using tox..."
 
25
        @tox -e $(PY_ENV)
39
26
 
40
27
check_version:
41
28
        @if [ "$(CHANGELOG_VERSION)" != "$(CODE_VERSION)" ]; then \
44
31
            else true; fi
45
32
 
46
33
clean_pyc:
47
 
        @find . -type f -name "*.pyc" -delete
 
34
        find . -type f -name "*.pyc" -delete
48
35
 
49
36
2to3:
50
37
        2to3 $(PY_FILES)
51
38
 
52
39
clean: clean_pyc
53
 
        rm -rf /var/log/cloud-init.log /var/lib/cloud/
 
40
        rm -rf /var/log/cloud-init.log /var/lib/cloud/ $(CWD)/*.egg-info $(CWD)/.tox
54
41
 
55
42
yaml:
56
43
        @$(CWD)/tools/validate-yaml.py $(YAML_FILES)
61
48
deb:
62
49
        ./packages/bddeb
63
50
 
64
 
.PHONY: test pylint pyflakes 2to3 clean pep8 rpm deb yaml check_version
65
 
.PHONY: pip-test-requirements pip-requirements clean_pyc
 
51
.PHONY: test flake8 2to3 clean rpm deb yaml check_version clean_pyc