← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~cjwatson/txpkgupload:py3-doctest-ignore-write into txpkgupload:master

 

Colin Watson has proposed merging ~cjwatson/txpkgupload:py3-doctest-ignore-write into txpkgupload:master with ~cjwatson/txpkgupload:py3-context-managers as a prerequisite.

Commit message:
Ignore return value from write()

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

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

The write() method on file objects returns None in Python 2, but the number of bytes written in Python 3.  Explicitly ignore its return value in doctests.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/txpkgupload:py3-doctest-ignore-write into txpkgupload:master.
diff --git a/src/txpkgupload/tests/filesystem.txt b/src/txpkgupload/tests/filesystem.txt
index 97b2286..20b80d9 100644
--- a/src/txpkgupload/tests/filesystem.txt
+++ b/src/txpkgupload/tests/filesystem.txt
@@ -21,7 +21,7 @@ First we need to setup our test environment.
     >>> full_testfile = os.path.join(rootpath, testfile)
     >>> testfile_contents = b"contents of the file"
     >>> with open(full_testfile, 'wb') as f:
-    ...     f.write(testfile_contents)
+    ...     _ = f.write(testfile_contents)
 
     >>> testdir = "testdir"
     >>> full_testdir = os.path.join(rootpath, testdir)
@@ -288,7 +288,7 @@ file does not exist or is a directory.
     >>> os.path.exists(full_testfile)
     False
     >>> with open(full_testfile, 'wb') as f:
-    ...     f.write(b"contents of the file")
+    ...     _ = f.write(b"contents of the file")
     
     >>> ufs.remove(testdir)
     Traceback (most recent call last):