launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #26269
[Merge] ~cjwatson/launchpad:py3-test-generate-contents-files into launchpad:master
Colin Watson has proposed merging ~cjwatson/launchpad:py3-test-generate-contents-files into launchpad:master.
Commit message:
Fix generate_contents_files tests for Python 3
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/397821
--
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:py3-test-generate-contents-files into launchpad:master.
diff --git a/lib/lp/archivepublisher/tests/test_generate_contents_files.py b/lib/lp/archivepublisher/tests/test_generate_contents_files.py
index b0238e2..a0d6967 100644
--- a/lib/lp/archivepublisher/tests/test_generate_contents_files.py
+++ b/lib/lp/archivepublisher/tests/test_generate_contents_files.py
@@ -63,13 +63,13 @@ class TestHelpers(TestCaseWithFactory):
def test_differ_in_content_returns_true_if_one_file_does_not_exist(self):
# A nonexistent file differs from an existing one.
self.useTempDir()
- write_file('one', self.factory.getUniqueString())
+ write_file('one', self.factory.getUniqueBytes())
self.assertTrue(differ_in_content('one', 'other'))
def test_differ_in_content_returns_false_for_identical_files(self):
# Identical files do not differ.
self.useTempDir()
- text = self.factory.getUniqueString()
+ text = self.factory.getUniqueBytes()
write_file('one', text)
write_file('other', text)
self.assertFalse(differ_in_content('one', 'other'))
@@ -77,8 +77,8 @@ class TestHelpers(TestCaseWithFactory):
def test_differ_in_content_returns_true_for_differing_files(self):
# Files with different contents differ.
self.useTempDir()
- write_file('one', self.factory.getUniqueString())
- write_file('other', self.factory.getUniqueString())
+ write_file('one', self.factory.getUniqueBytes())
+ write_file('other', self.factory.getUniqueBytes())
self.assertTrue(differ_in_content('one', 'other'))
def test_differ_in_content_returns_false_if_neither_file_exists(self):
@@ -130,20 +130,6 @@ class TestGenerateContentsFiles(TestCaseWithFactory):
script.distribution = distribution
return script
- def writeMarkerFile(self, file_path):
- """Create a marker file at location `file_path`.
-
- An arbitrary string is written to the file, and flushed to the
- filesystem. Any surrounding directories are created as needed.
-
- :param file_path: Full path to a file: optional directory prefix
- followed by required file name.
- :return: The arbitrary string that is also in the file.
- """
- marker_contents = self.factory.getUniqueString()
- write_file(file_path, marker_contents)
- return marker_contents
-
def test_name_is_consistent(self):
# Script instances for the same distro get the same name.
distro = self.factory.makeDistribution()