annotate makeitso/python_package/tests/test_{{package}}.py @ 252:13de6f87c323

add pytest in anticipation of future greatness
author Jeff Hammel <k0scist@gmail.com>
date Sat, 13 May 2017 18:32:14 -0700
parents ee752ac566f1
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
147
bdf4049e83ea add a unit test skeleton
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
1 #!/usr/bin/env python
208
f7f7831f7c8c add UTF-8 disclaimer
Jeff Hammel <k0scist@gmail.com>
parents: 203
diff changeset
2 # -*- coding: utf-8 -*-
147
bdf4049e83ea add a unit test skeleton
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
3
bdf4049e83ea add a unit test skeleton
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
4 """
209
ee752ac566f1 correct template syntax
Jeff Hammel <k0scist@gmail.com>
parents: 208
diff changeset
5 unit tests for {{package}}
147
bdf4049e83ea add a unit test skeleton
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
6 """
bdf4049e83ea add a unit test skeleton
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
7
bdf4049e83ea add a unit test skeleton
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
8 import os
bdf4049e83ea add a unit test skeleton
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
9 import sys
202
2d009a183d53 STUB: makeitso/python_package/tests/test_{{package}}.py
Jeff Hammel <k0scist@gmail.com>
parents: 193
diff changeset
10 import tempfile
147
bdf4049e83ea add a unit test skeleton
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
11 import unittest
bdf4049e83ea add a unit test skeleton
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
12
bdf4049e83ea add a unit test skeleton
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
13 # globals
bdf4049e83ea add a unit test skeleton
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
14 here = os.path.dirname(os.path.abspath(__file__))
bdf4049e83ea add a unit test skeleton
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
15
148
e3ba71e7b927 correct capitalization
Jeff Hammel <jhammel@mozilla.com>
parents: 147
diff changeset
16 class {{package}}UnitTest(unittest.TestCase):
147
bdf4049e83ea add a unit test skeleton
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
17
bdf4049e83ea add a unit test skeleton
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
18 def test_{{package}}(self):
203
84be91d59996 STUB: makeitso/python_package/tests/test_{{package}}.py
Jeff Hammel <k0scist@gmail.com>
parents: 202
diff changeset
19 tf = tempfile.mktemp()
84be91d59996 STUB: makeitso/python_package/tests/test_{{package}}.py
Jeff Hammel <k0scist@gmail.com>
parents: 202
diff changeset
20 try:
84be91d59996 STUB: makeitso/python_package/tests/test_{{package}}.py
Jeff Hammel <k0scist@gmail.com>
parents: 202
diff changeset
21 # pass
84be91d59996 STUB: makeitso/python_package/tests/test_{{package}}.py
Jeff Hammel <k0scist@gmail.com>
parents: 202
diff changeset
22 pass
84be91d59996 STUB: makeitso/python_package/tests/test_{{package}}.py
Jeff Hammel <k0scist@gmail.com>
parents: 202
diff changeset
23 finally:
84be91d59996 STUB: makeitso/python_package/tests/test_{{package}}.py
Jeff Hammel <k0scist@gmail.com>
parents: 202
diff changeset
24 if os.path.exists(tf):
84be91d59996 STUB: makeitso/python_package/tests/test_{{package}}.py
Jeff Hammel <k0scist@gmail.com>
parents: 202
diff changeset
25 os.remove(tf)
147
bdf4049e83ea add a unit test skeleton
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
26
bdf4049e83ea add a unit test skeleton
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
27 if __name__ == '__main__':
bdf4049e83ea add a unit test skeleton
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
28 unittest.main()