diff --git a/meta/check-py3k.sh b/meta/check.sh similarity index 78% rename from meta/check-py3k.sh rename to meta/check.sh index 3ac939ea15..f01653b57e 100755 --- a/meta/check-py3k.sh +++ b/meta/check.sh @@ -1,8 +1,12 @@ #!/bin/bash +set -e +cd $(dirname "$0") + +# Run unit tests. +python -m unittest discover # Check Python sources for Python 3 compatibility using pylint. # # Install pylint with 'pip install pylint'. -cd $(dirname "$0") pylint --py3k --reports=no -- *.py cretonne isa flake8 . diff --git a/meta/constant_hash.py b/meta/constant_hash.py index aa43694a50..38911278ed 100644 --- a/meta/constant_hash.py +++ b/meta/constant_hash.py @@ -74,7 +74,3 @@ def compute_quadratic(items, hash_function): table[h] = i return table - -if __name__ == "__main__": - import doctest - doctest.testmod() diff --git a/meta/srcgen.py b/meta/srcgen.py index 0b8a7a2973..962a881436 100644 --- a/meta/srcgen.py +++ b/meta/srcgen.py @@ -121,7 +121,3 @@ class Formatter(object): """Add a (multi-line) documentation comment.""" s = re.sub('^', self.indent + '/// ', s, flags=re.M) + '\n' self.lines.append(s) - -if __name__ == "__main__": - import doctest - doctest.testmod() diff --git a/meta/test_constant_hash.py b/meta/test_constant_hash.py new file mode 100644 index 0000000000..e76f09aed9 --- /dev/null +++ b/meta/test_constant_hash.py @@ -0,0 +1,8 @@ +from __future__ import absolute_import +import doctest +import constant_hash + + +def load_tests(loader, tests, ignore): + tests.addTests(doctest.DocTestSuite(constant_hash)) + return tests diff --git a/meta/test_srcgen.py b/meta/test_srcgen.py new file mode 100644 index 0000000000..2fb5e0fb61 --- /dev/null +++ b/meta/test_srcgen.py @@ -0,0 +1,8 @@ +from __future__ import absolute_import +import doctest +import srcgen + + +def load_tests(loader, tests, ignore): + tests.addTests(doctest.DocTestSuite(srcgen)) + return tests