Last active
April 20, 2019 14:14
-
-
Save pfuntner/2a51a42be60e95899af424306c458679 to your computer and use it in GitHub Desktop.
Simple Python unit test
This file contains hidden or 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
#! /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