← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~stevenk/launchpad/testfix-for-not-null-processor into lp:launchpad

 

Steve Kowalik has proposed merging lp:~stevenk/launchpad/testfix-for-not-null-processor into lp:launchpad.

Commit message:
Correct all of the test suite that {DistroArchSeries,ArchiveArch}.processor are no longer optional.

Requested reviews:
  William Grant (wgrant): code

For more details, see:
https://code.launchpad.net/~stevenk/launchpad/testfix-for-not-null-processor/+merge/186712

Due to some of the test suite being under the misapprehension that {DistroArchSeries,ArchiveArch}.processor are optional, when my NOT NULL patch landed against db-devel, the test suite blew up quite spectacularly. This corrects the tests, and works fine with or without the DB patch.
-- 
https://code.launchpad.net/~stevenk/launchpad/testfix-for-not-null-processor/+merge/186712
Your team Launchpad code reviewers is subscribed to branch lp:launchpad.
=== modified file 'lib/lp/soyuz/doc/gina-multiple-arch.txt'
--- lib/lp/soyuz/doc/gina-multiple-arch.txt	2012-11-22 00:15:23 +0000
+++ lib/lp/soyuz/doc/gina-multiple-arch.txt	2013-09-20 05:40:38 +0000
@@ -50,23 +50,26 @@
     >>> if pf is None:
     ...     pf = ProcessorFamily(name="x86", title="X86",
     ...                          description="Intel X86")
-    >>> dar = DistroArchSeries(distroseries=dapper, processorfamily=pf,
-    ...                         architecturetag="i386", official=True,
-    ...                         owner=celebs.launchpad_developers)
+    >>> dar = dapper.newArch(
+    ...     processorfamily=pf, architecturetag="i386", official=True,
+    ...     owner=celebs.launchpad_developers)
     >>> pf = ProcessorFamily.selectOneBy(name="amd64")
     >>> if pf is None:
     ...     pf = ProcessorFamily(name="amd64", title="AMD64",
     ...                          description="AMD 64")
-    >>> dar = DistroArchSeries(distroseries=dapper, processorfamily=pf,
-    ...                         architecturetag="amd64", official=True,
-    ...                         owner=celebs.launchpad_developers)
+    >>> dar = dapper.newArch(
+    ...     processorfamily=pf, architecturetag="amd64", official=True,
+    ...     owner=celebs.launchpad_developers)
     >>> pf = ProcessorFamily.selectOneBy(name="powerpc")
     >>> if pf is None:
     ...     pf = ProcessorFamily(name="powerpc", title="PowerPC",
     ...                          description="PowerPC")
-    >>> dar = DistroArchSeries(distroseries=dapper, processorfamily=pf,
-    ...                         architecturetag="powerpc", official=True,
-    ...                         owner=celebs.launchpad_developers)
+    >>> from lp.soyuz.model.processor import Processor
+    >>> p = Processor(name="powerpc", title="PowerPC", family=pf,
+    ...     description="The little processor that could")
+    >>> dar = dapper.newArch(
+    ...     processorfamily=pf, architecturetag="powerpc", official=True,
+    ...     owner=celebs.launchpad_developers)
     >>> import transaction
     >>> transaction.commit()
 
@@ -85,28 +88,10 @@
     >>> path = os.path.join(os.getcwd(), relative_path)
     >>> os.symlink(path, '/tmp/gina_test_archive')
 
-Run gina without a powerpc processor for the powerpc family:
-
-    >>> gina_proc = [sys.executable, 'scripts/gina.py', '-q',
-    ...              'dapper', 'dapper-updates']
-    >>> proc = subprocess.Popen(gina_proc, stderr=subprocess.PIPE)
-    >>> print proc.stderr.read()
-    WARNING ...
-    ERROR   Database setup required for run on powerpc
-    Traceback (most recent call last):
-    ...
-    DataSetupError: Unable to find a processor from the processor family...
-    <BLANKLINE>
-    >>> proc.wait()
-    1
-
 Set up the processor, commit and run her again. Note that
 dapper-updates/universe doesn't include the powerpc architecture, but we
 just warn it and move right ahead.
 
-    >>> from lp.soyuz.model.processor import Processor
-    >>> p = Processor(name="powerpc", title="PowerPC", family=pf,
-    ...     description="The little processor that could")
     >>> p == Processor.selectOneBy(familyID=pf.id)
     True
     >>> transaction.commit()

=== modified file 'lib/lp/soyuz/doc/gina.txt'
--- lib/lp/soyuz/doc/gina.txt	2013-02-14 01:10:48 +0000
+++ lib/lp/soyuz/doc/gina.txt	2013-09-20 05:40:38 +0000
@@ -35,7 +35,6 @@
 
 Create a distribution release and an arch release for breezy:
 
-    >>> from lp.soyuz.model.distroarchseries import DistroArchSeries
     >>> from lp.soyuz.model.processor import ProcessorFamily
     >>> from lp.app.interfaces.launchpad import ILaunchpadCelebrities
     >>> celebs = getUtility(ILaunchpadCelebrities)
@@ -51,10 +50,9 @@
     >>> login(ANONYMOUS)
 
     >>> pf = ProcessorFamily.selectOneBy(name="x86")
-    >>> breezy_i386 = DistroArchSeries(distroseries=breezy,
-    ...                         processorfamily=pf,
-    ...                         architecturetag="i386", official=True,
-    ...                         owner=celebs.launchpad_developers)
+    >>> breezy_i386 = breezy.newArch(
+    ...     processorfamily=pf, architecturetag="i386", official=True,
+    ...     owner=celebs.launchpad_developers)
     >>> import transaction
     >>> transaction.commit()
 
@@ -727,9 +725,8 @@
 source-only import to happen.
 
     >>> pf = ProcessorFamily.selectOneBy(name="x86")
-    >>> lenny_i386 = DistroArchSeries(
-    ...     distroseries=lenny, processorfamily=pf,
-    ...     architecturetag="i386", official=True,
+    >>> lenny_i386 = lenny.newArch(
+    ...     processorfamily=pf, architecturetag="i386", official=True,
     ...     owner=celebs.launchpad_developers)
 
 We will also store the number of binaries already published in debian

=== modified file 'lib/lp/soyuz/model/archivearch.py'
--- lib/lp/soyuz/model/archivearch.py	2013-09-10 05:00:15 +0000
+++ lib/lp/soyuz/model/archivearch.py	2013-09-20 05:40:38 +0000
@@ -46,10 +46,11 @@
 
     def new(self, archive, processorfamily):
         """See `IArchiveArchSet`."""
+        processor = processorfamily.processors[0]
         archivearch = ArchiveArch()
         archivearch.archive = archive
         archivearch.processorfamily = processorfamily
-        archivearch.processor = processorfamily.processors[0]
+        archivearch.processor = processor
         IStore(ArchiveArch).add(archivearch)
         return archivearch
 

=== modified file 'lib/lp/soyuz/scripts/initialize_distroseries.py'
--- lib/lp/soyuz/scripts/initialize_distroseries.py	2013-06-20 05:50:00 +0000
+++ lib/lp/soyuz/scripts/initialize_distroseries.py	2013-09-20 05:40:38 +0000
@@ -380,12 +380,12 @@
                 sqlvalues(self.arches))
         self._store.execute("""
             INSERT INTO DistroArchSeries
-            (distroseries, processorfamily, architecturetag, owner, official,
-             supports_virtualized)
-            SELECT %s, processorfamily, architecturetag, %s,
+            (distroseries, processorfamily, processor, architecturetag, owner,
+            official, supports_virtualized)
+            SELECT %s, processorfamily, processor, architecturetag, %s,
                 bool_and(official), bool_or(supports_virtualized)
             FROM DistroArchSeries WHERE enabled = TRUE %s
-            GROUP BY processorfamily, architecturetag
+            GROUP BY processorfamily, processor, architecturetag
             """ % (sqlvalues(self.distroseries, self.distroseries.owner)
             + (das_filter, )))
         self._store.flush()

=== modified file 'utilities/soyuz-sampledata-setup.py'
--- utilities/soyuz-sampledata-setup.py	2013-09-05 01:40:22 +0000
+++ utilities/soyuz-sampledata-setup.py	2013-09-20 05:40:38 +0000
@@ -149,8 +149,8 @@
     family = getUtility(IProcessorFamilySet).getByName(architecture_name)
     archseries = DistroArchSeries(
         distroseries=distroseries, processorfamily=family,
-        owner=distroseries.owner, official=True,
-        architecturetag=architecture_name)
+        processor=family.processors[0], owner=distroseries.owner,
+        official=True, architecturetag=architecture_name)
     IMasterStore(DistroArchSeries).add(archseries)
 
 


References