Skip to Content
Mastering Object-oriented Python
book

Mastering Object-oriented Python

by Steven F. Lott
April 2014
Beginner to intermediate
634 pages
15h 22m
English
Packt Publishing
Content preview from Mastering Object-oriented Python

The TestCase class hierarchy

Inheritance works among the TestCase classes. Ideally, each TestCase is unique. Pragmatically, there may be common features among cases. There are three common ways in which TestCase classes may overlap:

  • Common setUp(): We may have some data that is used in multiple TestCases. There's no reason to repeat the data. A TestCase class that only defines setUp() or tearDown() with no test methods is legal, but it may lead to a confusing log because there are zero tests involved.
  • Common tearDown(): It's common to have a common cleanup for tests that involve OS resources. We might need to remove files and directories or kill subprocesses.
  • Common results checking: For algorithmically complex tests, we may have a results checking ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Mastering Object-Oriented Python - Second Edition

Mastering Object-Oriented Python - Second Edition

Steven F. Lott

Publisher Resources

ISBN: 9781783280971Supplemental Content