This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: test_mailbox fails if the hostname is empty
Type: behavior Stage: resolved
Components: email, FreeBSD, Tests Versions: Python 3.7, Python 3.6, Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: barry, koobs, r.david.murray, serhiy.storchaka, skrah
Priority: normal Keywords: patch

Created on 2017-09-29 07:17 by serhiy.storchaka, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 3821 merged serhiy.storchaka, 2017-09-29 13:28
PR 3837 merged python-dev, 2017-09-30 17:17
PR 3838 merged serhiy.storchaka, 2017-09-30 17:20
Messages (5)
msg303304 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2017-09-29 07:17
On just installed FreeBSD the hostname is empty. This causes a failure of test_mailbox.

======================================================================
FAIL: test_create_tmp (test.test_mailbox.TestMaildir)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/home/serhiy/py/cpython3.7-debug/Lib/test/test_mailbox.py", line 758, in test_create_tmp
    self.assertIsNotNone(match, "Invalid file name: '%s'" % tail)
AssertionError: unexpectedly None : Invalid file name: '1506668827.M125806P21276Q34.'

----------------------------------------------------------------------

Changing the "+" qualifier to the "*" qualifier in the regex pattern fixes the issue.

         pattern = re.compile(r"(?P<time>\d+)\.M(?P<M>\d{1,6})P(?P<P>\d+)"
-                             r"Q(?P<Q>\d+)\.(?P<host>[^:/]+)")
+                             r"Q(?P<Q>\d+)\.(?P<host>[^:/]*)")
msg303329 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2017-09-29 12:55
A system with no hostname can be considered to be improperly configured, but it doesn't look like this would weaken the test, so I think it is OK.
msg303411 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2017-09-30 14:10
New changeset f4ea642cb60556231e714089a79d3c59c202661e by Serhiy Storchaka in branch 'master':
bpo-31627: Make test_mailbox be lenient to empty hostname. (#3821)
https://github.com/python/cpython/commit/f4ea642cb60556231e714089a79d3c59c202661e
msg303421 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2017-09-30 19:52
New changeset d9c21a45fdc83904753d91ad45e3eafa195f4713 by Serhiy Storchaka (Miss Islington (bot)) in branch '3.6':
[3.6] bpo-31627: Make test_mailbox be lenient to empty hostname. (GH-3821) (#3837)
https://github.com/python/cpython/commit/d9c21a45fdc83904753d91ad45e3eafa195f4713
msg303422 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2017-09-30 19:52
New changeset 1163fb9be08c6072455b59d6f954e60662d18e75 by Serhiy Storchaka in branch '2.7':
[2.7] bpo-31627: Make test_mailbox be lenient to empty hostname. (GH-3821) (#3838)
https://github.com/python/cpython/commit/1163fb9be08c6072455b59d6f954e60662d18e75
History
Date User Action Args
2022-04-11 14:58:52adminsetgithub: 75808
2017-09-30 19:54:03serhiy.storchakasetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2017-09-30 19:52:27serhiy.storchakasetmessages: + msg303422
2017-09-30 19:52:02serhiy.storchakasetmessages: + msg303421
2017-09-30 17:20:28serhiy.storchakasetpull_requests: + pull_request3819
2017-09-30 17:17:52python-devsetpull_requests: + pull_request3818
2017-09-30 14:10:59serhiy.storchakasetmessages: + msg303411
2017-09-29 13:29:03serhiy.storchakasetversions: + Python 2.7, Python 3.6, Python 3.7
2017-09-29 13:28:24serhiy.storchakasetkeywords: + patch
stage: patch review
pull_requests: + pull_request3806
2017-09-29 12:55:16r.david.murraysetmessages: + msg303329
2017-09-29 07:26:11serhiy.storchakasettitle: test_mailbox if the hostname is empty -> test_mailbox fails if the hostname is empty
2017-09-29 07:17:31serhiy.storchakacreate