Skip to content

Commit df47b06

Browse files
committed
feat(*): add make test-style targets
This gives us an opporunity to run code checkers and linters as part of testing, as we used to on travis-ci.org. By default, unit tests will check code syntax and style first.
1 parent 1ff20cc commit df47b06

7 files changed

Lines changed: 47 additions & 11 deletions

File tree

client/Makefile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,10 @@ clean:
1313

1414
client:
1515
pyinstaller deis.spec
16+
17+
setup-venv:
18+
@if [ ! -d venv ]; then virtualenv venv; fi
19+
venv/bin/pip install -q flake8==2.2.2
20+
21+
test-style: setup-venv
22+
venv/bin/flake8

client/setup.cfg

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,7 @@
11
[sdist]
22
formats = zip,gztar
3+
4+
[flake8]
5+
max-line-length = 99
6+
exclude = build,dist,venv
7+
max-complexity = 12

controller/Makefile

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,16 @@ coverage:
4141
coverage run manage.py test --noinput api
4242
coverage html
4343

44-
flake8:
45-
flake8
46-
4744
test: test-unit test-functional
4845

49-
test-unit:
46+
setup-venv:
5047
@if [ ! -d venv ]; then virtualenv venv; fi
5148
venv/bin/pip install -q -r requirements.txt -r dev_requirements.txt
49+
50+
test-style: setup-venv
51+
venv/bin/flake8
52+
53+
test-unit: setup-venv test-style
5254
venv/bin/python manage.py test --noinput api
5355

5456
test-functional:

controller/dev_requirements.txt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,7 @@ coverage>=3.7.1
1919
docutils>=0.12
2020

2121
# Run "make flake8" to check python syntax and style
22-
flake8==2.1.0
23-
pep8==1.4.6
24-
pyflakes==0.7.3
22+
flake8==2.2.2
2523

2624
# Used for mocking endpoints
2725
mock==1.0.1

controller/setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
[flake8]
22
max-line-length = 99
3-
exclude = */api/migrations/*,*/api/south_migrations/*,*/build/*,*/venv/*,*/virtualenv/*,*/scheduler/*,*/templates/*
3+
exclude = api/migrations,api/south_migrations,templates,venv
44
max-complexity = 12

logger/Makefile

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,19 @@ full-clean: clean
2929

3030
test: test-unit test-functional
3131

32-
test-unit:
32+
setup-root-gotools:
33+
sudo GOPATH=/tmp/tmpGOPATH go get -u -v code.google.com/p/go.tools/cmd/cover
34+
sudo GOPATH=/tmp/tmpGOPATH go get -u -v code.google.com/p/go.tools/cmd/vet
35+
sudo rm -rf /tmp/tmpGOPATH
36+
37+
setup-gotools:
38+
go get -v github.com/golang/lint/golint
39+
40+
test-style:
41+
go vet -x ./...
42+
-golint .
43+
44+
test-unit: test-style
3345
go test -v -cover ./syslog
3446

3547
test-functional:

tests/Makefile

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
test: test-smoke
22

3-
test-smoke:
3+
test-smoke: test-style
44
GOPATH=$(CURDIR)/_vendor:$(GOPATH) \
55
go test -tags integration -short -v -run TestSmoke
66

7-
test-full:
7+
test-full: test-style
88
GOPATH=$(CURDIR)/_vendor:$(GOPATH) \
99
go test -tags integration -v -run TestGlobal
1010
GOPATH=$(CURDIR)/_vendor:$(GOPATH) \
@@ -26,6 +26,18 @@ test-full:
2626
GOPATH=$(CURDIR)/_vendor:$(GOPATH) \
2727
go test -tags integration -v -run TestReleases
2828

29+
setup-root-gotools:
30+
sudo GOPATH=/tmp/tmpGOPATH go get -u -v code.google.com/p/go.tools/cmd/cover
31+
sudo GOPATH=/tmp/tmpGOPATH go get -u -v code.google.com/p/go.tools/cmd/vet
32+
sudo rm -rf /tmp/tmpGOPATH
33+
34+
setup-gotools:
35+
go get -v github.com/golang/lint/golint
36+
37+
test-style:
38+
go vet -x ./...
39+
-golint *.go dockercli etcdutils mock utils
40+
2941
nuke_from_orbit:
3042
-docker kill `docker ps -q`
3143
-docker rm `docker ps -a -q`

0 commit comments

Comments
 (0)