mirror of
https://github.com/Brandon-Rozek/website.git
synced 2024-11-22 08:16:29 -05:00
793 B
793 B
title | date | draft | tags | ||
---|---|---|---|---|---|
Quick Python: Unit Testing | 2020-03-31T07:27:47-04:00 | false |
|
Python has a great built-in unit test framework. This post will give a skeleton for how to format the files in your tests
directory.
Example tests/test_basic.py
import unittest
class Tester(unittest.TestCase):
def setUp(self):
"""To Run Before Every Test Case"""
pass
def tearDown(self):
"""To Run After Every Test Case"""
pass
def test_something(self):
"""A Test Case"""
self.assertEqual(True, True)
if __name__ == '__main__':
unittest.main()
To auto-discover and run your tests
python -m unittest discover -s tests