← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~gz/launchpad/py27_doctest_trivia_1020137_1020185 into lp:launchpad

 

Martin Packman has proposed merging lp:~gz/launchpad/py27_doctest_trivia_1020137_1020185 into lp:launchpad.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  Bug #1020137 in Launchpad itself: "Doctest lp/services/webapp/doc/test_adapter.txt fails on Python 2.7"
  https://bugs.launchpad.net/launchpad/+bug/1020137
  Bug #1020185 in Launchpad itself: "lp/app/doc/displaying-numbers.txt fails on Python 2.7"
  https://bugs.launchpad.net/launchpad/+bug/1020185

For more details, see:
https://code.launchpad.net/~gz/launchpad/py27_doctest_trivia_1020137_1020185/+merge/113088

Poke a couple of doctests to cope with tiny changes in Python 2.7 that they're being overly sensitive about.

Firstly wait() on threading.Event started returning the internal flag rather than just None:

<http://docs.python.org/library/threading.html#threading.Event.wait>

Secondly the spelling of the message when trying to cast non-numbers to float changed a little.

Neither doctest actually cares about these details, they're just overly assertive by nature.
-- 
https://code.launchpad.net/~gz/launchpad/py27_doctest_trivia_1020137_1020185/+merge/113088
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~gz/launchpad/py27_doctest_trivia_1020137_1020185 into lp:launchpad.
=== modified file 'lib/lp/app/doc/displaying-numbers.txt'
--- lib/lp/app/doc/displaying-numbers.txt	2011-12-18 16:25:15 +0000
+++ lib/lp/app/doc/displaying-numbers.txt	2012-07-02 18:32:23 +0000
@@ -81,5 +81,5 @@
     >>> test_tales('foo/fmt:float/bong', foo=12345.67890)
     Traceback (most recent call last):
     ...
-    ValueError: invalid literal for float(): bong
+    ValueError: ... float...: bong
 

=== modified file 'lib/lp/services/webapp/doc/test_adapter.txt'
--- lib/lp/services/webapp/doc/test_adapter.txt	2012-02-07 15:28:50 +0000
+++ lib/lp/services/webapp/doc/test_adapter.txt	2012-07-02 18:32:23 +0000
@@ -371,7 +371,7 @@
     >>> set_request_started()
     >>> thread = threading.Thread(target=foo)
     >>> thread.start()
-    >>> started_request.wait()
+    >>> _ = started_request.wait()
     >>> store.execute('SELECT 1', noresult=True)
     >>> statement_issued.set()
     >>> thread.join()
@@ -390,7 +390,7 @@
     >>> set_request_started(time.time() - 60)
     >>> thread = threading.Thread(target=bar)
     >>> thread.start()
-    >>> started_request.wait()
+    >>> _ = started_request.wait()
     >>> store.execute('SELECT 1', noresult=True)
     Traceback (most recent call last):
     ...


Follow ups