Merge ~cjwatson/launchpad:py3-test-generate-contents-files into launchpad:master

Proposed by Colin Watson
Status: Merged
Approved by: Colin Watson
Approved revision: 82fc4e7ee0cf8f48628c9e830593298b18b0bf84
Merge reported by: Otto Co-Pilot
Merged at revision: not available
Proposed branch: ~cjwatson/launchpad:py3-test-generate-contents-files
Merge into: launchpad:master
Diff against target: 52 lines (+4/-18)
1 file modified
lib/lp/archivepublisher/tests/test_generate_contents_files.py (+4/-18)
Reviewer Review Type Date Requested Status
Thiago F. Pappacena (community) Approve
Review via email: mp+397821@code.launchpad.net

Commit message

Fix generate_contents_files tests for Python 3

To post a comment you must log in.
Revision history for this message
Thiago F. Pappacena (pappacena) wrote :

LGTM

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/lib/lp/archivepublisher/tests/test_generate_contents_files.py b/lib/lp/archivepublisher/tests/test_generate_contents_files.py
2index b0238e2..a0d6967 100644
3--- a/lib/lp/archivepublisher/tests/test_generate_contents_files.py
4+++ b/lib/lp/archivepublisher/tests/test_generate_contents_files.py
5@@ -63,13 +63,13 @@ class TestHelpers(TestCaseWithFactory):
6 def test_differ_in_content_returns_true_if_one_file_does_not_exist(self):
7 # A nonexistent file differs from an existing one.
8 self.useTempDir()
9- write_file('one', self.factory.getUniqueString())
10+ write_file('one', self.factory.getUniqueBytes())
11 self.assertTrue(differ_in_content('one', 'other'))
12
13 def test_differ_in_content_returns_false_for_identical_files(self):
14 # Identical files do not differ.
15 self.useTempDir()
16- text = self.factory.getUniqueString()
17+ text = self.factory.getUniqueBytes()
18 write_file('one', text)
19 write_file('other', text)
20 self.assertFalse(differ_in_content('one', 'other'))
21@@ -77,8 +77,8 @@ class TestHelpers(TestCaseWithFactory):
22 def test_differ_in_content_returns_true_for_differing_files(self):
23 # Files with different contents differ.
24 self.useTempDir()
25- write_file('one', self.factory.getUniqueString())
26- write_file('other', self.factory.getUniqueString())
27+ write_file('one', self.factory.getUniqueBytes())
28+ write_file('other', self.factory.getUniqueBytes())
29 self.assertTrue(differ_in_content('one', 'other'))
30
31 def test_differ_in_content_returns_false_if_neither_file_exists(self):
32@@ -130,20 +130,6 @@ class TestGenerateContentsFiles(TestCaseWithFactory):
33 script.distribution = distribution
34 return script
35
36- def writeMarkerFile(self, file_path):
37- """Create a marker file at location `file_path`.
38-
39- An arbitrary string is written to the file, and flushed to the
40- filesystem. Any surrounding directories are created as needed.
41-
42- :param file_path: Full path to a file: optional directory prefix
43- followed by required file name.
44- :return: The arbitrary string that is also in the file.
45- """
46- marker_contents = self.factory.getUniqueString()
47- write_file(file_path, marker_contents)
48- return marker_contents
49-
50 def test_name_is_consistent(self):
51 # Script instances for the same distro get the same name.
52 distro = self.factory.makeDistribution()

Subscribers

People subscribed via source and target branches

to status/vote changes: