← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~cjwatson/launchpad:faster-build-behaviour-tests into launchpad:master

 

Colin Watson has proposed merging ~cjwatson/launchpad:faster-build-behaviour-tests into launchpad:master.

Commit message:
Make build behaviour tests slightly quicker

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/414673

Most of these tests don't need to upload files to the librarian, which also lets them avoid committing some transactions.

This doesn't seem to save much elapsed time for me (9m55s → 9m50s for `bin/test -vvct -t buildbehaviour -t recipebuilder`, which is surely within the bounds of measurement error), but it does mean that a number of tests have a lower setup cost if you're only running those tests.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:faster-build-behaviour-tests into launchpad:master.
diff --git a/lib/lp/buildmaster/tests/test_buildfarmjobbehaviour.py b/lib/lp/buildmaster/tests/test_buildfarmjobbehaviour.py
index f36750e..3bdbf55 100644
--- a/lib/lp/buildmaster/tests/test_buildfarmjobbehaviour.py
+++ b/lib/lp/buildmaster/tests/test_buildfarmjobbehaviour.py
@@ -299,7 +299,7 @@ class TestDispatchBuildToWorker(StatsMixin, TestCase):
 class TestGetUploadMethodsMixin:
     """Tests for `IPackageBuild` that need objects from the rest of LP."""
 
-    layer = LaunchpadZopelessLayer
+    layer = ZopelessDatabaseLayer
 
     def makeBuild(self):
         """Allow classes to override the build with which the test runs."""
@@ -323,7 +323,7 @@ class TestGetUploadMethodsMixin:
 class TestVerifySuccessfulBuildMixin:
     """Tests for `IBuildFarmJobBehaviour`'s verifySuccessfulBuild method."""
 
-    layer = LaunchpadZopelessLayer
+    layer = ZopelessDatabaseLayer
 
     def makeBuild(self):
         """Allow classes to override the build with which the test runs."""
@@ -333,10 +333,6 @@ class TestVerifySuccessfulBuildMixin:
         """Allow classes to override the build with which the test runs."""
         raise NotImplementedError
 
-    def setUp(self):
-        super().setUp()
-        self.factory = LaunchpadObjectFactory()
-
     def test_verifySuccessfulBuild_allows_modifiable_suite(self):
         # verifySuccessfulBuild allows uploading to a suite that the archive
         # says is modifiable.
diff --git a/lib/lp/charms/tests/test_charmrecipebuildbehaviour.py b/lib/lp/charms/tests/test_charmrecipebuildbehaviour.py
index 86d645c..6cd8791 100644
--- a/lib/lp/charms/tests/test_charmrecipebuildbehaviour.py
+++ b/lib/lp/charms/tests/test_charmrecipebuildbehaviour.py
@@ -25,7 +25,6 @@ from testtools.matchers import (
 from testtools.twistedsupport import (
     AsynchronousDeferredRunTestForBrokenTwisted,
     )
-import transaction
 from twisted.internet import defer
 from zope.component import getUtility
 from zope.proxy import isProxy
@@ -85,11 +84,12 @@ from lp.testing import TestCaseWithFactory
 from lp.testing.dbuser import dbuser
 from lp.testing.gpgkeys import gpgkeysdir
 from lp.testing.keyserver import InProcessKeyServerFixture
-from lp.testing.layers import LaunchpadZopelessLayer
+from lp.testing.layers import ZopelessDatabaseLayer
 
 
 class TestCharmRecipeBuildBehaviourBase(TestCaseWithFactory):
-    layer = LaunchpadZopelessLayer
+
+    layer = ZopelessDatabaseLayer
 
     def setUp(self):
         self.useFixture(FeatureFixture({CHARM_RECIPE_ALLOW_CREATE: "on"}))
@@ -116,7 +116,6 @@ class TestCharmRecipeBuildBehaviourBase(TestCaseWithFactory):
 
 
 class TestCharmRecipeBuildBehaviour(TestCharmRecipeBuildBehaviourBase):
-    layer = LaunchpadZopelessLayer
 
     def test_provides_interface(self):
         # CharmRecipeBuildBehaviour provides IBuildFarmJobBehaviour.
@@ -133,8 +132,7 @@ class TestCharmRecipeBuildBehaviour(TestCharmRecipeBuildBehaviourBase):
         # verifyBuildRequest doesn't raise any exceptions when called with a
         # valid builder set.
         job = self.makeJob()
-        lfa = self.factory.makeLibraryFileAlias()
-        transaction.commit()
+        lfa = self.factory.makeLibraryFileAlias(db_only=True)
         job.build.distro_arch_series.addOrUpdateChroot(lfa)
         builder = MockBuilder()
         job.setBuilder(builder, OkWorker())
@@ -146,8 +144,7 @@ class TestCharmRecipeBuildBehaviour(TestCharmRecipeBuildBehaviourBase):
         # verifyBuildRequest raises on an attempt to build a virtualized
         # build on a non-virtual builder.
         job = self.makeJob()
-        lfa = self.factory.makeLibraryFileAlias()
-        transaction.commit()
+        lfa = self.factory.makeLibraryFileAlias(db_only=True)
         job.build.distro_arch_series.addOrUpdateChroot(lfa)
         builder = MockBuilder(virtualized=False)
         job.setBuilder(builder, OkWorker())
diff --git a/lib/lp/code/model/tests/test_recipebuilder.py b/lib/lp/code/model/tests/test_recipebuilder.py
index 9c75d68..fcc1cf2 100644
--- a/lib/lp/code/model/tests/test_recipebuilder.py
+++ b/lib/lp/code/model/tests/test_recipebuilder.py
@@ -56,13 +56,16 @@ from lp.testing import (
 from lp.testing.fakemethod import FakeMethod
 from lp.testing.gpgkeys import gpgkeysdir
 from lp.testing.keyserver import InProcessKeyServerFixture
-from lp.testing.layers import LaunchpadZopelessLayer
+from lp.testing.layers import (
+    LaunchpadZopelessLayer,
+    ZopelessDatabaseLayer,
+    )
 from lp.testing.mail_helpers import pop_notifications
 
 
 class TestRecipeBuilderBase(TestCaseWithFactory):
 
-    layer = LaunchpadZopelessLayer
+    layer = ZopelessDatabaseLayer
 
     def makeJob(self, recipe_registrant=None, recipe_owner=None,
                 archive=None, git=False, with_builder=False):
@@ -381,7 +384,7 @@ class TestAsyncRecipeBuilder(TestRecipeBuilderBase):
     def test_composeBuildRequest(self):
         job = self.makeJob(with_builder=True)
         test_publisher = SoyuzTestPublisher()
-        test_publisher.addFakeChroots(job.build.distroseries)
+        test_publisher.addFakeChroots(job.build.distroseries, db_only=True)
         das = job.build.distroseries.nominatedarchindep
         build_request = yield job.composeBuildRequest(None)
         extra_args = yield job.extraBuildArgs()
diff --git a/lib/lp/oci/tests/test_ocirecipebuildbehaviour.py b/lib/lp/oci/tests/test_ocirecipebuildbehaviour.py
index cb5438f..890a916 100644
--- a/lib/lp/oci/tests/test_ocirecipebuildbehaviour.py
+++ b/lib/lp/oci/tests/test_ocirecipebuildbehaviour.py
@@ -87,7 +87,10 @@ from lp.soyuz.adapters.archivedependencies import (
 from lp.testing import TestCaseWithFactory
 from lp.testing.dbuser import dbuser
 from lp.testing.fakemethod import FakeMethod
-from lp.testing.layers import LaunchpadZopelessLayer
+from lp.testing.layers import (
+    LaunchpadZopelessLayer,
+    ZopelessDatabaseLayer,
+    )
 from lp.testing.mail_helpers import pop_notifications
 
 
@@ -138,7 +141,7 @@ class MakeOCIBuildMixin:
 
 class TestOCIBuildBehaviour(TestCaseWithFactory):
 
-    layer = LaunchpadZopelessLayer
+    layer = ZopelessDatabaseLayer
 
     def setUp(self):
         super().setUp()
@@ -161,7 +164,7 @@ class TestAsyncOCIRecipeBuildBehaviour(
 
     run_tests_with = AsynchronousDeferredRunTestForBrokenTwisted.make_factory(
         timeout=30)
-    layer = LaunchpadZopelessLayer
+    layer = ZopelessDatabaseLayer
 
     @defer.inlineCallbacks
     def setUp(self):
@@ -265,7 +268,8 @@ class TestAsyncOCIRecipeBuildBehaviour(
             distro = self.factory.makeDistroArchSeries(
                 distroseries=distroseries, architecturetag=proc_name,
                 processor=proc)
-            distro.addOrUpdateChroot(self.factory.makeLibraryFileAlias())
+            distro.addOrUpdateChroot(
+                self.factory.makeLibraryFileAlias(db_only=True))
             processors_list.append(proc)
         recipe.setProcessors(processors_list)
         return recipe
diff --git a/lib/lp/snappy/tests/test_snapbuildbehaviour.py b/lib/lp/snappy/tests/test_snapbuildbehaviour.py
index 6836941..d1836e1 100644
--- a/lib/lp/snappy/tests/test_snapbuildbehaviour.py
+++ b/lib/lp/snappy/tests/test_snapbuildbehaviour.py
@@ -30,7 +30,6 @@ from testtools.matchers import (
 from testtools.twistedsupport import (
     AsynchronousDeferredRunTestForBrokenTwisted,
     )
-import transaction
 from twisted.internet import defer
 from zope.component import getUtility
 from zope.proxy import isProxy
@@ -103,7 +102,7 @@ from lp.testing.gpgkeys import (
     import_public_key,
     )
 from lp.testing.keyserver import InProcessKeyServerFixture
-from lp.testing.layers import LaunchpadZopelessLayer
+from lp.testing.layers import ZopelessDatabaseLayer
 
 
 class FormatAsRfc3339TestCase(TestCase):
@@ -122,7 +121,8 @@ class FormatAsRfc3339TestCase(TestCase):
 
 
 class TestSnapBuildBehaviourBase(TestCaseWithFactory):
-    layer = LaunchpadZopelessLayer
+
+    layer = ZopelessDatabaseLayer
 
     def setUp(self):
         super().setUp()
@@ -153,7 +153,6 @@ class TestSnapBuildBehaviourBase(TestCaseWithFactory):
 
 
 class TestSnapBuildBehaviour(TestSnapBuildBehaviourBase):
-    layer = LaunchpadZopelessLayer
 
     def test_provides_interface(self):
         # SnapBuildBehaviour provides IBuildFarmJobBehaviour.
@@ -170,8 +169,7 @@ class TestSnapBuildBehaviour(TestSnapBuildBehaviourBase):
         # verifyBuildRequest doesn't raise any exceptions when called with a
         # valid builder set.
         job = self.makeJob()
-        lfa = self.factory.makeLibraryFileAlias()
-        transaction.commit()
+        lfa = self.factory.makeLibraryFileAlias(db_only=True)
         job.build.distro_arch_series.addOrUpdateChroot(lfa)
         builder = MockBuilder()
         job.setBuilder(builder, OkWorker())
@@ -183,8 +181,7 @@ class TestSnapBuildBehaviour(TestSnapBuildBehaviourBase):
         # verifyBuildRequest raises on an attempt to build a virtualized
         # build on a non-virtual builder.
         job = self.makeJob()
-        lfa = self.factory.makeLibraryFileAlias()
-        transaction.commit()
+        lfa = self.factory.makeLibraryFileAlias(db_only=True)
         job.build.distro_arch_series.addOrUpdateChroot(lfa)
         builder = MockBuilder(virtualized=False)
         job.setBuilder(builder, OkWorker())
@@ -197,8 +194,7 @@ class TestSnapBuildBehaviour(TestSnapBuildBehaviourBase):
         archive = self.factory.makeArchive(
             enabled=False, displayname="Disabled Archive")
         job = self.makeJob(archive=archive)
-        lfa = self.factory.makeLibraryFileAlias()
-        transaction.commit()
+        lfa = self.factory.makeLibraryFileAlias(db_only=True)
         job.build.distro_arch_series.addOrUpdateChroot(lfa)
         builder = MockBuilder()
         job.setBuilder(builder, OkWorker())
@@ -210,8 +206,7 @@ class TestSnapBuildBehaviour(TestSnapBuildBehaviourBase):
         archive = self.factory.makeArchive(private=True)
         job = self.makeJob(
             archive=archive, registrant=archive.owner, owner=archive.owner)
-        lfa = self.factory.makeLibraryFileAlias()
-        transaction.commit()
+        lfa = self.factory.makeLibraryFileAlias(db_only=True)
         job.build.distro_arch_series.addOrUpdateChroot(lfa)
         builder = MockBuilder()
         job.setBuilder(builder, OkWorker())
@@ -222,8 +217,7 @@ class TestSnapBuildBehaviour(TestSnapBuildBehaviourBase):
     def test_verifyBuildRequest_archive_private_owners_mismatch(self):
         archive = self.factory.makeArchive(private=True)
         job = self.makeJob(archive=archive)
-        lfa = self.factory.makeLibraryFileAlias()
-        transaction.commit()
+        lfa = self.factory.makeLibraryFileAlias(db_only=True)
         job.build.distro_arch_series.addOrUpdateChroot(lfa)
         builder = MockBuilder()
         job.setBuilder(builder, OkWorker())
diff --git a/lib/lp/soyuz/tests/test_binarypackagebuildbehaviour.py b/lib/lp/soyuz/tests/test_binarypackagebuildbehaviour.py
index 73bff8d..d687a9d 100644
--- a/lib/lp/soyuz/tests/test_binarypackagebuildbehaviour.py
+++ b/lib/lp/soyuz/tests/test_binarypackagebuildbehaviour.py
@@ -17,7 +17,6 @@ from testtools.twistedsupport import (
     AsynchronousDeferredRunTest,
     AsynchronousDeferredRunTestForBrokenTwisted,
     )
-import transaction
 from twisted.internet import defer
 from zope.component import getUtility
 from zope.security.proxy import removeSecurityProxy
@@ -76,7 +75,10 @@ from lp.testing import TestCaseWithFactory
 from lp.testing.dbuser import switch_dbuser
 from lp.testing.gpgkeys import gpgkeysdir
 from lp.testing.keyserver import InProcessKeyServerFixture
-from lp.testing.layers import LaunchpadZopelessLayer
+from lp.testing.layers import (
+    LaunchpadZopelessLayer,
+    ZopelessDatabaseLayer,
+    )
 
 
 class TestBinaryBuildPackageBehaviour(StatsMixin, TestCaseWithFactory):
@@ -89,7 +91,7 @@ class TestBinaryBuildPackageBehaviour(StatsMixin, TestCaseWithFactory):
     interesting parameters.
     """
 
-    layer = LaunchpadZopelessLayer
+    layer = ZopelessDatabaseLayer
     run_tests_with = AsynchronousDeferredRunTestForBrokenTwisted.make_factory(
         timeout=30)
 
@@ -183,8 +185,7 @@ class TestBinaryBuildPackageBehaviour(StatsMixin, TestCaseWithFactory):
         vitals = extract_vitals_from_db(builder)
         build = self.factory.makeBinaryPackageBuild(
             builder=builder, archive=archive)
-        lf = self.factory.makeLibraryFileAlias()
-        transaction.commit()
+        lf = self.factory.makeLibraryFileAlias(db_only=True)
         build.distro_arch_series.addOrUpdateChroot(lf)
         bq = build.queueBuild()
         bq.markAsBuilding(builder)
@@ -218,8 +219,7 @@ class TestBinaryBuildPackageBehaviour(StatsMixin, TestCaseWithFactory):
             archive=archive.distribution.main_archive,
             sourcepackagename=build.source_package_release.sourcepackagename,
             component='main')
-        lf = self.factory.makeLibraryFileAlias()
-        transaction.commit()
+        lf = self.factory.makeLibraryFileAlias(db_only=True)
         build.distro_arch_series.addOrUpdateChroot(lf)
         bq = build.queueBuild()
         bq.markAsBuilding(builder)
@@ -241,8 +241,7 @@ class TestBinaryBuildPackageBehaviour(StatsMixin, TestCaseWithFactory):
         vitals = extract_vitals_from_db(builder)
         build = self.factory.makeBinaryPackageBuild(
             builder=builder, archive=archive)
-        lf = self.factory.makeLibraryFileAlias()
-        transaction.commit()
+        lf = self.factory.makeLibraryFileAlias(db_only=True)
         build.distro_arch_series.addOrUpdateChroot(lf)
         bq = build.queueBuild()
         bq.markAsBuilding(builder)
@@ -282,8 +281,7 @@ class TestBinaryBuildPackageBehaviour(StatsMixin, TestCaseWithFactory):
                    build.source_package_release.sourcepackagename.name,
                    'main'),
                sprf.libraryfile.filename))
-        lf = self.factory.makeLibraryFileAlias()
-        transaction.commit()
+        lf = self.factory.makeLibraryFileAlias(db_only=True)
         build.distro_arch_series.addOrUpdateChroot(lf)
         bq = build.queueBuild()
         bq.markAsBuilding(builder)
@@ -310,8 +308,7 @@ class TestBinaryBuildPackageBehaviour(StatsMixin, TestCaseWithFactory):
         vitals = extract_vitals_from_db(builder)
         build = self.factory.makeBinaryPackageBuild(
             builder=builder, archive=archive)
-        lf = self.factory.makeLibraryFileAlias()
-        transaction.commit()
+        lf = self.factory.makeLibraryFileAlias(db_only=True)
         build.distro_arch_series.addOrUpdateChroot(lf)
         bq = build.queueBuild()
         bq.markAsBuilding(builder)
@@ -334,8 +331,7 @@ class TestBinaryBuildPackageBehaviour(StatsMixin, TestCaseWithFactory):
             builder=builder, archive=archive,
             distroarchseries=distro_arch_series,
             pocket=PackagePublishingPocket.RELEASE)
-        lf = self.factory.makeLibraryFileAlias()
-        transaction.commit()
+        lf = self.factory.makeLibraryFileAlias(db_only=True)
         build.distro_arch_series.addOrUpdateChroot(lf)
         behaviour = IBuildFarmJobBehaviour(build)
         behaviour.setBuilder(builder, None)
@@ -354,8 +350,7 @@ class TestBinaryBuildPackageBehaviour(StatsMixin, TestCaseWithFactory):
         build = self.factory.makeBinaryPackageBuild(
             builder=builder, archive=archive,
             pocket=PackagePublishingPocket.SECURITY)
-        lf = self.factory.makeLibraryFileAlias()
-        transaction.commit()
+        lf = self.factory.makeLibraryFileAlias(db_only=True)
         build.distro_arch_series.addOrUpdateChroot(lf)
         behaviour = IBuildFarmJobBehaviour(build)
         behaviour.setBuilder(builder, None)
@@ -488,8 +483,7 @@ class TestBinaryBuildPackageBehaviour(StatsMixin, TestCaseWithFactory):
         build = self.factory.makeBinaryPackageBuild(
             builder=builder, archive=archive,
             pocket=PackagePublishingPocket.RELEASE)
-        lf = self.factory.makeLibraryFileAlias()
-        transaction.commit()
+        lf = self.factory.makeLibraryFileAlias(db_only=True)
         build.distro_arch_series.addOrUpdateChroot(lf)
         behaviour = IBuildFarmJobBehaviour(build)
         behaviour.setBuilder(builder, None)
@@ -542,8 +536,7 @@ class TestBinaryBuildPackageBehaviourBuildCollection(TestCaseWithFactory):
         self.interactor = BuilderInteractor()
         self.build = self.factory.makeBinaryPackageBuild(
             builder=self.builder, pocket=PackagePublishingPocket.RELEASE)
-        lf = self.factory.makeLibraryFileAlias()
-        transaction.commit()
+        lf = self.factory.makeLibraryFileAlias(db_only=True)
         self.build.distro_arch_series.addOrUpdateChroot(lf)
         self.candidate = self.build.queueBuild()
         self.candidate.markAsBuilding(self.builder)
diff --git a/lib/lp/soyuz/tests/test_livefsbuildbehaviour.py b/lib/lp/soyuz/tests/test_livefsbuildbehaviour.py
index 73680d7..eb815ba 100644
--- a/lib/lp/soyuz/tests/test_livefsbuildbehaviour.py
+++ b/lib/lp/soyuz/tests/test_livefsbuildbehaviour.py
@@ -9,7 +9,6 @@ import os.path
 import pytz
 from testtools.matchers import MatchesListwise
 from testtools.twistedsupport import AsynchronousDeferredRunTest
-import transaction
 from twisted.internet import defer
 from zope.component import getUtility
 from zope.security.proxy import Proxy
@@ -57,12 +56,12 @@ from lp.soyuz.tests.soyuz import Base64KeyMatches
 from lp.testing import TestCaseWithFactory
 from lp.testing.gpgkeys import gpgkeysdir
 from lp.testing.keyserver import InProcessKeyServerFixture
-from lp.testing.layers import LaunchpadZopelessLayer
+from lp.testing.layers import ZopelessDatabaseLayer
 
 
 class TestLiveFSBuildBehaviourBase(TestCaseWithFactory):
 
-    layer = LaunchpadZopelessLayer
+    layer = ZopelessDatabaseLayer
 
     def setUp(self):
         super().setUp()
@@ -109,8 +108,7 @@ class TestLiveFSBuildBehaviour(TestLiveFSBuildBehaviourBase):
         # verifyBuildRequest doesn't raise any exceptions when called with a
         # valid builder set.
         job = self.makeJob()
-        lfa = self.factory.makeLibraryFileAlias()
-        transaction.commit()
+        lfa = self.factory.makeLibraryFileAlias(db_only=True)
         job.build.distro_arch_series.addOrUpdateChroot(lfa)
         builder = MockBuilder()
         job.setBuilder(builder, OkWorker())
@@ -122,8 +120,7 @@ class TestLiveFSBuildBehaviour(TestLiveFSBuildBehaviourBase):
         # verifyBuildRequest raises on an attempt to build a virtualized
         # build on a non-virtual builder.
         job = self.makeJob()
-        lfa = self.factory.makeLibraryFileAlias()
-        transaction.commit()
+        lfa = self.factory.makeLibraryFileAlias(db_only=True)
         job.build.distro_arch_series.addOrUpdateChroot(lfa)
         builder = MockBuilder(virtualized=False)
         job.setBuilder(builder, OkWorker())
@@ -136,8 +133,7 @@ class TestLiveFSBuildBehaviour(TestLiveFSBuildBehaviourBase):
         archive = self.factory.makeArchive(
             enabled=False, displayname="Disabled Archive")
         job = self.makeJob(archive=archive)
-        lfa = self.factory.makeLibraryFileAlias()
-        transaction.commit()
+        lfa = self.factory.makeLibraryFileAlias(db_only=True)
         job.build.distro_arch_series.addOrUpdateChroot(lfa)
         builder = MockBuilder()
         job.setBuilder(builder, OkWorker())
@@ -149,8 +145,7 @@ class TestLiveFSBuildBehaviour(TestLiveFSBuildBehaviourBase):
         archive = self.factory.makeArchive(private=True)
         job = self.makeJob(
             archive=archive, registrant=archive.owner, owner=archive.owner)
-        lfa = self.factory.makeLibraryFileAlias()
-        transaction.commit()
+        lfa = self.factory.makeLibraryFileAlias(db_only=True)
         job.build.distro_arch_series.addOrUpdateChroot(lfa)
         builder = MockBuilder()
         job.setBuilder(builder, OkWorker())
@@ -161,8 +156,7 @@ class TestLiveFSBuildBehaviour(TestLiveFSBuildBehaviourBase):
     def test_verifyBuildRequest_archive_private_owners_mismatch(self):
         archive = self.factory.makeArchive(private=True)
         job = self.makeJob(archive=archive)
-        lfa = self.factory.makeLibraryFileAlias()
-        transaction.commit()
+        lfa = self.factory.makeLibraryFileAlias(db_only=True)
         job.build.distro_arch_series.addOrUpdateChroot(lfa)
         builder = MockBuilder()
         job.setBuilder(builder, OkWorker())
diff --git a/lib/lp/translations/tests/test_translationtemplatesbuildbehaviour.py b/lib/lp/translations/tests/test_translationtemplatesbuildbehaviour.py
index 5b532e5..e296b0f 100644
--- a/lib/lp/translations/tests/test_translationtemplatesbuildbehaviour.py
+++ b/lib/lp/translations/tests/test_translationtemplatesbuildbehaviour.py
@@ -68,7 +68,6 @@ class MakeBehaviourMixin:
         if use_fake_chroot:
             behaviour.distro_arch_series.addOrUpdateChroot(
                 self.factory.makeLibraryFileAlias(db_only=True))
-            self.layer.txn.commit()
         return behaviour
 
     def makeProductSeriesWithBranchForTranslation(self):