Merge lp:~brian-murray/ubuntu-release-upgrader/test-ordering into lp:ubuntu-release-upgrader

Proposed by Brian Murray
Status: Merged
Merged at revision: 2998
Proposed branch: lp:~brian-murray/ubuntu-release-upgrader/test-ordering
Merge into: lp:ubuntu-release-upgrader
Diff against target: 40 lines (+5/-2)
2 files modified
DistUpgrade/DistUpgradeController.py (+2/-2)
debian/changelog (+3/-0)
To merge this branch: bzr merge lp:~brian-murray/ubuntu-release-upgrader/test-ordering
Reviewer Review Type Date Requested Status
Barry Warsaw (community) Approve
Review via email: mp+294313@code.launchpad.net

Description of the change

The test test_sources_list.py would fail if run by itself (with a NoDistroTemplate Exception) and would only succeed if it was run after test_dist_ugprade_fetcher_core.py. This is because test_dist_upgrade_fetcher_core.py downloads an ubuntu-release-upgrader tarball which includes Ubuntu.info and Ubuntu.mirrors from python-apt. Additionally, something in the dist upgrade fetcher test would also set the working directory to '/tmp/ubuntu-release-upgrader-XYZ' which contained the Ubuntu.* files.

Then test_sources_list.py uses DistUpgradeController which sets the following:

self.sources = SourcesList(matcherPath=".")

So when the test is run without test_dist_upgrade_fetcher_core.py we check the current directory for python apt templates and find none, so the test fails. I've resolved this by making the matcherPath dynamic and including Ubuntu.info and Ubuntu.mirrors in the tests' data directory.

To post a comment you must log in.
Revision history for this message
Barry Warsaw (barry) wrote :

Nice! :)

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'DistUpgrade/DistUpgradeController.py'
2--- DistUpgrade/DistUpgradeController.py 2016-04-06 04:52:31 +0000
3+++ DistUpgrade/DistUpgradeController.py 2016-05-10 22:59:58 +0000
4@@ -793,7 +793,7 @@
5
6 def updateSourcesList(self):
7 logging.debug("updateSourcesList()")
8- self.sources = SourcesList(matcherPath=".")
9+ self.sources = SourcesList(matcherPath=self.datadir)
10 # backup first!
11 self.sources.backup(self.sources_backup_ext)
12 if not self.rewriteSourcesList(mirror_check=True):
13@@ -813,7 +813,7 @@
14 ) % (self.fromDist, self.toDist))
15 if res:
16 # re-init the sources and try again
17- self.sources = SourcesList(matcherPath=".")
18+ self.sources = SourcesList(matcherPath=self.datadir)
19 # its ok if rewriteSourcesList fails here if
20 # we do not use a network, the sources.list may be empty
21 if (not self.rewriteSourcesList(mirror_check=False)
22
23=== modified file 'debian/changelog'
24--- debian/changelog 2016-05-10 20:53:14 +0000
25+++ debian/changelog 2016-05-10 22:59:58 +0000
26@@ -1,6 +1,9 @@
27 ubuntu-release-upgrader (1:16.10.2) UNRELEASED; urgency=medium
28
29 * data/release-upgrades: switch prompt from LTS to normal (LP: #1577165)
30+ * DistUpgrade/DistUpgradeController.py: instead of statically setting
31+ matcherPath, for a SourcesList, to "." set it to datadir which may be "."
32+ or something else entirely (like when we are running a test).
33
34 -- Brian Murray <brian@ubuntu.com> Tue, 10 May 2016 13:51:58 -0700
35
36
37=== added symlink 'tests/data-sources-list-test/Ubuntu.info'
38=== target is u'/usr/share/python-apt/templates/Ubuntu.info'
39=== added symlink 'tests/data-sources-list-test/Ubuntu.mirrors'
40=== target is u'/usr/share/python-apt/templates/Ubuntu.mirrors'

Subscribers

People subscribed via source and target branches