[test-fix] Fixing test_autopkgtest.py configuration setup, so all tests pass now.

bzr-import-20160707
Celso Providelo 10 years ago
commit a729746fa8

@ -62,7 +62,7 @@ SMOOTH_UPDATES = badgers
REMOVE_OBSOLETE = no
ADT_ENABLE = no
ADT_ENABLE = yes
ADT_DEBUG = no
ADT_ARCHES = amd64 i386

@ -135,6 +135,11 @@ class TestBase(unittest.TestCase):
def tearDown(self):
del self.data
def restore_config(self, content):
"""Helper for restoring configuration contents on cleanup."""
with open(self.britney_conf, 'w') as fp:
fp.write(content)
def run_britney(self, args=[]):
'''Run britney.

@ -31,6 +31,16 @@ class TestAutoPkgTest(TestBase):
def setUp(self):
super(TestAutoPkgTest, self).setUp()
# Mofify configuration according to the test context.
with open(self.britney_conf, 'r') as fp:
original_config = fp.read()
# Disable boottests.
new_config = original_config.replace(
'BOOTTEST_ENABLE = yes', 'BOOTTEST_ENABLE = no')
with open(self.britney_conf, 'w') as fp:
fp.write(new_config)
self.addCleanup(self.restore_config, original_config)
# fake adt-britney script
self.adt_britney = os.path.join(
self.data.home, 'auto-package-testing', 'jenkins', 'adt-britney')

@ -117,18 +117,19 @@ class TestBoottestEnd2End(TestBase):
def setUp(self):
super(TestBoottestEnd2End, self).setUp()
self.britney_conf = os.path.join(
PROJECT_DIR, 'britney.conf')
old_config = None
# Modify shared configuration file.
with open(self.britney_conf, 'r') as fp:
self.old_config = fp.read()
config = self.old_config.replace(
original_config = fp.read()
# Disable autopkgtests.
new_config = original_config.replace(
'ADT_ENABLE = yes', 'ADT_ENABLE = no')
# Disable TouchManifest auto-fetching.
config = config.replace(
new_config = new_config.replace(
'BOOTTEST_FETCH = yes', 'BOOTTEST_FETCH = no')
with open(self.britney_conf, 'w') as fp:
fp.write(config)
fp.write(new_config)
self.addCleanup(self.restore_config, original_config)
self.data.add('libc6', False, {'Architecture': 'armhf'}),
@ -147,11 +148,6 @@ class TestBoottestEnd2End(TestBase):
'pyqt5:armhf 1.0',
])
def tearDown(self):
""" Replace the old_config. """
with open(self.britney_conf, 'w') as fp:
fp.write(self.old_config)
def create_manifest(self, lines):
"""Create a manifest for this britney run context."""
path = os.path.join(

Loading…
Cancel
Save