Created
August 4, 2015 15:59
-
-
Save lbillingham/d9d75a4b86dc1c23dcf2 to your computer and use it in GitHub Desktop.
skeleton for test code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
""" | |
Tests for app code. | |
Usage: | |
in a terminal: | |
1. cd folder containing `{tests, app}` folders | |
2. run `nosetests --with-coverage --cover-html --cover-package=utils` | |
from anaconda ipython console: | |
* !nosetests tests | |
nose will find these test scripts, run them and alert you to any errors | |
@author: laurence | |
""" | |
from __future__ import division, print_function | |
import <app>.<module> as foo | |
from mock import patch | |
def test_in_a_function():# pylint: disable-msg=C0103 | |
""" | |
Test basic ... | |
""" | |
assert False | |
class TestClassy(unittest.TestCase): | |
""" | |
Class for testing the app code | |
""" | |
@classmethod | |
def setupClass(cls): # pylint: disable-msg=C0103 | |
"""This method is run once for each class before any tests are run""" | |
pass | |
@classmethod | |
def teardownClass(cls): # pylint: disable-msg=C0103 | |
"""This method is run once for each class _after_ all tests are run""" | |
pass | |
def setUp(self): # pylint: disable-msg=C0103 | |
"""This method is run once before _each_ test method is executed""" | |
pass | |
def tearDown(self): # pylint: disable-msg=C0103 | |
"""This method is run once after _each_ test method is executed""" | |
pass | |
def test_a_thing(self): | |
""" | |
Test basic workingness of thing | |
""" | |
assert False | |
@patch('<module>.attribute') | |
def test_a_thing(self, mock_attribute): | |
""" | |
Test basic workingness of thing where we need to patch `attribute` | |
""" | |
assert False | |
if __name__ == '__main__': | |
unittest.main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment