releasetools: Add a common base class for unittests.

All the releasetools unittests extend the common base class of
test_utils.ReleaseToolsTestCase. Define tearDown() in the base class to
do the clean-up works.

Test: `pylint --rcfile=pylintrc test_*.py`
Test: `python -m unittest discover .`
Change-Id: I51775d964ef032dcdf3bb89c55e1a31371cde708
This commit is contained in:
Tao Bao
2018-10-11 21:57:26 -07:00
parent f77560ec12
commit 65b94e92be
10 changed files with 38 additions and 83 deletions

View File

@@ -16,25 +16,22 @@
"""Unittests for verity_utils.py."""
from __future__ import print_function
import os.path
import unittest
import build_image
import common
import sparse_img
import test_utils
from rangelib import RangeSet
from test_utils import get_testdata_dir, ReleaseToolsTestCase
from verity_utils import (
CreateHashtreeInfoGenerator, HashtreeInfo,
VerifiedBootVersion1HashtreeInfoGenerator)
class VerifiedBootVersion1HashtreeInfoGeneratorTest(unittest.TestCase):
class VerifiedBootVersion1HashtreeInfoGeneratorTest(ReleaseToolsTestCase):
def setUp(self):
self.testdata_dir = test_utils.get_testdata_dir()
self.testdata_dir = get_testdata_dir()
self.partition_size = 1024 * 1024
self.prop_dict = {
@@ -50,9 +47,6 @@ class VerifiedBootVersion1HashtreeInfoGeneratorTest(unittest.TestCase):
self.expected_root_hash = \
"0b7c4565e87b1026e11fbab91c0bc29e185c847a5b44d40e6e86e461e8adf80d"
def tearDown(self):
common.Cleanup()
def _create_simg(self, raw_data):
output_file = common.MakeTempFile()
raw_image = common.MakeTempFile()