]> git.phdru.name Git - cookiecutter.git/commitdiff
Use pytest for testing
authorOleg Broytman <phd@phdru.name>
Sun, 11 Sep 2016 19:20:28 +0000 (22:20 +0300)
committerOleg Broytman <phd@phdru.name>
Sun, 11 Sep 2016 19:20:28 +0000 (22:20 +0300)
project_template/tests/Makefile
project_template/tests/__init__.py [deleted file]
project_template/tests/run_all.py [deleted file]
project_template/tests/test_test.py

index b990065cfd8bab40e800e4f3987644c570fca99e..0c6125e273addd4339eff70c6d6648d8395c5a25 100644 (file)
@@ -1,4 +1,4 @@
 
 .PHONY: all
 all:
 
 .PHONY: all
 all:
-       ./run_all.py
+       pytest
diff --git a/project_template/tests/__init__.py b/project_template/tests/__init__.py
deleted file mode 100644 (file)
index 3c09ede..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-
-import unittest
-
-__all__ = ['TestCase', 'main']
-
-
-class TestCase(unittest.TestCase):
-    def setUp(self):
-        pass
-
-    def tearDown(self):
-        pass
-
-
-def main():
-    try:
-        unittest.main(testRunner=unittest.TextTestRunner())
-    except SystemExit, msg:
-        result = msg.args[0]
-    else:
-        result = 0
-    raise SystemExit(result)
diff --git a/project_template/tests/run_all.py b/project_template/tests/run_all.py
deleted file mode 100755 (executable)
index 2e217bf..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-#! /usr/bin/env python
-
-
-import os
-import sys
-import subprocess
-
-
-def isexecutable(filename):
-    infile = open(filename, 'r')
-    magic = infile.read(2)
-    infile.close()
-    return magic == "#!"
-
-
-def collect_tests():
-    tests = []
-    for dirpath, dirs, files in os.walk("tests"):
-        tests.extend(
-            [os.path.join(dirpath, filename) for filename in files
-             if filename.startswith("test") and filename.endswith(".py")
-             ])
-    return [test[:-3].replace(os.sep, '.') for test in tests
-            if isexecutable(test)]
-
-
-def main():
-    os.chdir(os.path.join(os.path.dirname(sys.argv[0]), os.pardir))
-    tests = collect_tests()
-
-    os.environ["PYTHONPATH"] = os.curdir
-
-    for test in sorted(tests):
-        print test
-        subprocess.call((sys.executable, '-m', test))
-
-if __name__ == '__main__':
-    main()
index 1a340127fdc1c548fd694f9af85aeb803dde3122..d4b9c596a850ab281a1ae6f39160e082b8a9fd35 100755 (executable)
@@ -1,14 +1,6 @@
 #! /usr/bin/env python
 
 
 #! /usr/bin/env python
 
 
-import unittest
-from tests import main
-
-
-class TestTest(unittest.TestCase):
+class TestTest(object):
     def test_test(self):
     def test_test(self):
-        self.assertEqual()
-
-
-if __name__ == "__main__":
-    main()
+        assert True