File: module.mk

package info (click to toggle)
reportbug 4.12.6%2Bdeb6u1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze-lts
  • size: 804 kB
  • ctags: 708
  • sloc: python: 7,789; makefile: 78; sh: 32; lisp: 31
file content (83 lines) | stat: -rw-r--r-- 1,889 bytes parent folder | download | duplicates (3)
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
73
74
75
76
77
78
79
80
81
82
83
# :vim: filetype=make : -*- makefile; coding: utf-8; -*-

# test/module.mk
# Part of reportbug, a Debian bug reporting tool.
#
# Copyright © 2008 Ben Finney <ben+debian@benfinney.id.au>
# This is free software; you may copy, modify and/or distribute this work
# under the terms of the GNU General Public License, version 2 or later.
# No warranty expressed or implied. See the file LICENSE for details.

# Makefile module for test suite

MODULE_DIR := ${TEST_DIR}

NOSETESTS = nosetests
NOSETESTS_OPTS = --exclude='^(?!test_)'
PYFLAKES = pyflakes
PYLINT = pylint
COVERAGE = python-coverage
DATE = date
DATE_FORMAT = '%Y-%m-%d %H:%M:%S'
INWAIT = inotifywait
inwait_event_opts += -e create
inwait_event_opts += -e modify
inwait_event_opts += -e delete
INWAIT_OPTS = -q -r -t 0 ${inwait_event_opts}
TEST_INWAIT_FILES = ${CODE_PACKAGE_DIR} ${CODE_PROGRAMS} ${TEST_DIR}

NOSETESTS_FILES = ${TEST_DIR}
nosetests_cmd = $(NOSETESTS) ${NOSETESTS_OPTS} ${NOSETESTS_FILES}

coverage_files += ${CODE_MODULES}
# Not until python-coverage is updated with upstream fixes (2008-05-04)
#coverage_files += ${CODE_PROGRAMS}

GENERATED_FILES += .coverage


# usage: $(call test-output-banner,message)
define test-output-banner
	@ echo -n ${1} ; \
	$(DATE) +${DATE_FORMAT}
endef


.PHONY: nosetests
nosetests:
	$(call test-output-banner, "Test run: " )
	$(nosetests_cmd)

test: nosetests

# usage: $(call test-wait)
define test-wait
	$(INWAIT) ${INWAIT_OPTS} ${TEST_INWAIT_FILES}
endef

.PHONY: test-continuous
test-continuous:
	while true ; do \
		clear ; \
		$(MAKE) test ; \
		$(call test-wait) ; \
	done


.PHONY: pyflakes
pyflakes:
	$(PYFLAKES) .

.PHONY: pylint
pylint:
	$(PYLINT) ${CODE_PACKAGE_DIR}
	$(PYLINT) ${CODE_PROGRAMS}
	$(PYLINT) ${TEST_DIR}

.PHONY: coverage
coverage: NOSETEST_OPTS += --with-coverage
coverage:
	$(nosetests_cmd)
	$(COVERAGE) -r -m ${coverage_files}

qa: pyflakes coverage