aboutsummaryrefslogtreecommitdiff
blob: bb7dcb4167656dcae4e072e4e5e6f2286169f94d (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
import os
import os.path as osp
import unittest
import py_compile

"""Does a basic syntax check by compiling all modules. From Portage."""

pym_dirs = os.walk(osp.dirname(osp.dirname(osp.dirname(__file__))))
blacklist_dirs = frozenset(('.svn', 'test'))

class TestForSyntaxErrors(unittest.TestCase):

	def test_compileability(self):
		compileables = []
		for thisdir, subdirs, files in pym_dirs:
			if os.path.basename(thisdir) in blacklist_dirs:
				continue
			compileables.extend([
				osp.join(thisdir, f)
				for f in files
				if osp.splitext(f)[1] == '.py'
			])

		for c in compileables:
			py_compile.compile(c, doraise=True)


def test_main():
	test_support.run_unittest(TestGentoolkitHelpers2)


if __name__ == '__main__':
	test_main()