# HG changeset patch # User Augie Fackler # Date 2018-04-27 04:08:21 # Node ID 0dcd03637d365c9cc43af7a273fd50ba31c328e8 # Parent bb1b15acfd06c55118bffe3cd7973dbb4d62148a tests: fix error case in test-url.py's doctest This required some careful attention, so I wanted to split it out from the uninteresting bits that'll be in the next change. Differential Revision: https://phab.mercurial-scm.org/D3469 diff --git a/tests/test-url.py b/tests/test-url.py --- a/tests/test-url.py +++ b/tests/test-url.py @@ -236,7 +236,8 @@ check(_verifycert({'subject': (((u'commo def test_url(): """ - >>> from mercurial.util import url + >>> from mercurial import error, pycompat + >>> from mercurial.util import forcebytestr, url This tests for edge cases in url.URL's parsing algorithm. Most of these aren't useful for documentation purposes, so they aren't @@ -349,10 +350,11 @@ def test_url(): Non-localhost file URL: - >>> u = url('file://mercurial-scm.org/foo') - Traceback (most recent call last): - File "", line 1, in ? - Abort: file:// URLs can only refer to localhost + >>> try: + ... u = url(b'file://mercurial-scm.org/foo') + ... except error.Abort as e: + ... forcebytestr(e) + 'file:// URLs can only refer to localhost' Empty URL: