Skip to content

Instantly share code, notes, and snippets.

@pfuntner
Last active April 20, 2019 14:14
Show Gist options
  • Save pfuntner/2a51a42be60e95899af424306c458679 to your computer and use it in GitHub Desktop.
Save pfuntner/2a51a42be60e95899af424306c458679 to your computer and use it in GitHub Desktop.
Simple Python unit test
#! /usr/bin/env python
import os
import logging
from unittest import TestCase
import random
logging.basicConfig(format='%(asctime)s %(levelname)s %(pathname)s:%(lineno)d %(msg)s')
log = logging.getLogger()
class Tests(TestCase):
def __init__(self, *args, **vargs):
super(Tests, self).__init__(*args, **vargs)
log.setLevel(int(os.environ.get('LOG_LEVEL') or '30'))
def test1(self):
log.info('This is a test')
self.assertTrue((random.randint(0,9) % 2) == 0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment