Bug 1850933 - Building python in mock fails some tests (namely test_smtplib)
Summary: Building python in mock fails some tests (namely test_smtplib)
Keywords:
Status: CLOSED WORKSFORME
Alias: None
Product: Fedora
Classification: Fedora
Component: python3.9
Version: rawhide
Hardware: x86_64
OS: Linux
low
unspecified
Target Milestone: ---
Assignee: Python Maintainers
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-06-25 08:29 UTC by dani
Modified: 2020-11-13 13:49 UTC (History)
13 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-11-13 13:49:20 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description dani 2020-06-25 08:29:24 UTC
Description of problem:

Trying to build a flatpackage python38 from unmodified src rpm python3-3.8.3-2.fc32.src.rpm using the command line:
rpmbuild -ba ~/rpmbuild/SPECS/python3.spec --with flatpackage --with bootstrap --without rpmwheels
results in error:
2 tests failed:
    test_cmd_line_script test_code_module

Version-Release number of selected component (if applicable):
python3-3.8.3-2

How reproducible:
Always

Steps to Reproduce:
1. rpm -i python3-3.8.3-2.fc32.src.rpm
2. rpmbuild -ba ~/rpmbuild/SPECS/python3.spec --with flatpackage --with bootstrap --without rpmwheels
3.

Actual results:
Bad exit status from /var/tmp/rpm-tmp.x2PZME (%check)

Expected results:
RPMs built according to command line flags

Additional info:
gcc version 10.1.1

Comment 1 dani 2020-06-25 08:33:29 UTC
Opened new issue as per https://bugzilla.redhat.com/show_bug.cgi?id=1850621#c4
The additional info copied from https://bugzilla.redhat.com/show_bug.cgi?id=1850621#c3 :

FAILED (failures=1)
test test_cmd_line_script failed
2 tests failed again:
    test_cmd_line_script test_code_module

== Tests result: FAILURE then FAILURE ==

======================================================================
FAIL: test_pep_409_verbiage (test.test_cmd_line_script.CmdLineTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/dani/rpmbuild/BUILD/Python-3.8.3/Lib/test/test_cmd_line_script.py", line 526, in test_pep_409_verbiage
    self.assertEqual(len(text), 4)
AssertionError: 5 != 4

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


test_cause_tb (test.test_code_module.TestInteractiveConsole) ... Binary field with zero length
FAIL

======================================================================
FAIL: test_cause_tb (test.test_code_module.TestInteractiveConsole)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/dani/rpmbuild/BUILD/Python-3.8.3/Lib/test/test_code_module.py", line 132, in test_cause_tb
    self.assertIn(expected, output)
AssertionError: '\nAttributeError\n\nThe above exception was the direct cause of the following exception:\n\nTraceback (most recent call last):\n  File "<console>", line 1, in <module>\nValueError\n' not found in 'Python <MagicMock name=\'sys.version\' id=\'140286517534336\'> on <MagicMock name=\'sys.platform\' id=\'140286517051296\'>\nType "help", "copyright", "credits" or "license" for more information.\n(InteractiveConsole)\nAttributeError\n\nThe above exception was the direct cause of the following exception:\n\nTraceback (most recent call last):\n  File "/home/dani/rpmbuild/BUILD/Python-3.8.3/Lib/code.py", line 90, in runcode\n    exec(code, self.locals)\n  File "<console>", line 1, in <module>\nValueError\n\nnow exiting InteractiveConsole...\n'

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

Comment 2 Miro Hrončok 2020-06-25 09:04:21 UTC
Do you build the F32 package on Fedora 32?

Can you reproduce the failures in mock?

$ mock -r fedora-32-x86_64 --with flatpackage --with bootstrap --without rpmwheels python3-3.8.3-2.fc32.src.rpm

Comment 3 dani 2020-06-25 13:39:45 UTC
1. Yes, building on Fedora 32
2. Running in mock produces a different error - in test_smtplib:

test_with_statement (test.test_smtplib.SMTPSimTests) ... ERROR
test_with_statement_QUIT_failure (test.test_smtplib.SMTPSimTests) ... ERROR
test_send_message_uses_smtputf8_if_addrs_non_ascii (test.test_smtplib.SMTPUTF8SimTests) ... ok
test_send_unicode_with_SMTPUTF8_via_low_level_API (test.test_smtplib.SMTPUTF8SimTests) ... ok
test_send_unicode_with_SMTPUTF8_via_sendmail (test.test_smtplib.SMTPUTF8SimTests) ... ok
test_test_server_supports_extensions (test.test_smtplib.SMTPUTF8SimTests) ... ok
testLineTooLong (test.test_smtplib.TooLongLineTests) ... test test_smtplib failed
ok

======================================================================
ERROR: test_with_statement (test.test_smtplib.SMTPSimTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/builddir/build/BUILD/Python-3.8.3/Lib/test/test_smtplib.py", line 1068, in test_with_statement
    code, message = smtp.noop()
  File "/builddir/build/BUILD/Python-3.8.3/Lib/smtplib.py", line 518, in noop
    return self.docmd("noop")
  File "/builddir/build/BUILD/Python-3.8.3/Lib/smtplib.py", line 425, in docmd
    return self.getreply()
  File "/builddir/build/BUILD/Python-3.8.3/Lib/smtplib.py", line 398, in getreply
    raise SMTPServerDisconnected("Connection unexpectedly closed")
smtplib.SMTPServerDisconnected: Connection unexpectedly closed

======================================================================
ERROR: test_with_statement_QUIT_failure (test.test_smtplib.SMTPSimTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/builddir/build/BUILD/Python-3.8.3/Lib/test/test_smtplib.py", line 1078, in test_with_statement_QUIT_failure
    smtp.noop()
  File "/builddir/build/BUILD/Python-3.8.3/Lib/smtplib.py", line 518, in noop
    return self.docmd("noop")
  File "/builddir/build/BUILD/Python-3.8.3/Lib/smtplib.py", line 425, in docmd
    return self.getreply()
  File "/builddir/build/BUILD/Python-3.8.3/Lib/smtplib.py", line 398, in getreply
    raise SMTPServerDisconnected("Connection unexpectedly closed")
smtplib.SMTPServerDisconnected: Connection unexpectedly closed

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

Ran 63 tests in 240.786s

FAILED (errors=2)
1 test failed again:
    test_smtplib

== Tests result: FAILURE then FAILURE ==

400 tests OK.

10 slowest tests:
- test_smtplib: 4 min
- test_urllib2: 2 min 40 sec
- test_concurrent_futures: 2 min 34 sec
- test_socket: 2 min 23 sec
- test_multiprocessing_spawn: 1 min 47 sec
- test_logging: 1 min 40 sec
- test_urllib: 1 min 20 sec
- test_multiprocessing_forkserver: 1 min 16 sec
- test_asyncio: 1 min 10 sec
- test_multiprocessing_fork: 1 min 7 sec

1 test failed:
    test_smtplib

20 tests skipped:
    test_curses test_devpoll test_ioctl test_kqueue test_msilib
    test_ossaudiodev test_smtpnet test_socketserver test_startfile
    test_timeout test_tix test_tk test_ttk_guionly test_urllib2net
    test_urllibnet test_winconsoleio test_winreg test_winsound
    test_xmlrpc_net test_zipfile64

1 re-run test:
    test_smtplib

Total duration: 9 min 31 sec
Tests result: FAILURE then FAILURE
error: Bad exit status from /var/tmp/rpm-tmp.kPlx6t (%check)

Comment 4 Miro Hrončok 2020-06-25 22:58:33 UTC
The test_cmd_line_script and test_code_module test failures might be caused by your environment: installed .pth files, Shell environment variables, etc. We cannot really guarantee that all tests will pass during such build.

The mock build uses an isolated environment without such things.


I can however reproduce the test_smtplib failure.

Comment 5 dani 2020-06-26 04:25:57 UTC
Will RPMs produced in mock work normally? if so, that's a good enough workaround.

Comment 6 Miro Hrončok 2020-06-26 08:20:19 UTC
Yes, it will. This is how official Fedora builds are done (in mock in https://koji.fedoraproject.org/koji/).

Comment 7 Petr Viktorin 2020-07-08 12:27:52 UTC
We're sorry, but we don't have the capacity to look into this now.
If you want to help, could you test:
- if flatpackage actually triggers this failure, or if flatpackage is unrelated?
- if Python 3.8.4 fixes the issue?

Comment 8 Miro Hrončok 2020-08-05 12:16:00 UTC
I've seen this as well, no flatpakcage. It might have been Python 3.8 or 3.9 in mock.

Comment 9 Miro Hrončok 2020-08-12 10:47:14 UTC
This also happens on python3.9 3.9.0rc1.

Comment 10 Petr Viktorin 2020-11-13 13:49:20 UTC
The command:

   mock -r fedora-32-x86_64 --with flatpackage --with bootstrap --without rpmwheels python3.9-3.9.0-1.fc34.src.rpm

still works perfectly for me.

We agreed with Miro to close this now: sadly, we'll probably always have bigger priorities than investigating this further. If you'd like to help, please reopen and look at the questions above.


Note You need to log in before you can comment on or make changes to this bug.