Last active
January 27, 2016 13:45
-
-
Save dmerejkowsky/8343144c51bb8d98202d to your computer and use it in GitHub Desktop.
unittest sucks
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
# in test_qibuild_configure.py | |
class QiBuildTestCase(unittest.TestCase, ActionTestCase): | |
def setUp(self): | |
self.tmpdir = tmpfile.mkdtemp("test-qibuild-") | |
def test_configure(self): | |
# do stuff in tmpdir | |
rc = ... | |
self.assertEquals(rc, 0) | |
def tearDown(self): | |
shutil.rmtree(self.tmpdir) | |
# in run_tests.py | |
suite = unittest.TestSuite() | |
for test_case in TEST_CASES: | |
suite.addTests(unittest.makeSuite(test_case)) | |
runner = unittest.TextTestRunner() | |
result = runner.run(suite) | |
if not result.wasSuccessful(): | |
sys.exit(1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment