Created
March 18, 2016 09:01
-
-
Save mayerwin/21c471f1adaf18728089 to your computer and use it in GitHub Desktop.
Sample unittest module for "Run a specific unit test function inside PyCharm IDE 5.0.4" question (http://stackoverflow.com/questions/36079152/run-a-specific-unit-test-function-inside-pycharm-ide-5-0-4)
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
import unittest | |
import pytest | |
from unittest import TestCase | |
# http://stackoverflow.com/questions/1323455/python-unit-test-with-base-and-sub-class | |
class BaseTestCases: | |
class TestAbstract(TestCase): | |
def test_a(self): | |
print("Running from base class", self.__class__) | |
def test_fail_ok(self): | |
with self.assertRaises(Exception): | |
pytest.fail() | |
def test_fail_bad(self): | |
pytest.fail() | |
class TestDerived(BaseTestCases.TestAbstract): | |
def test_b(self): | |
print("Running from derived class") | |
if __name__ == "__main__": | |
unittest.main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment