cpython icon indicating copy to clipboard operation
cpython copied to clipboard

test_pyrepl: test_not_wiping_history_file() fails (randomly?) on multiple buildbots

Open vstinner opened this issue 1 year ago • 3 comments

Example with s390x Fedora 3.x: https://buildbot.python.org/all/#/builders/223/builds/6180

FAIL: test_not_wiping_history_file (test.test_pyrepl.test_pyrepl.TestMain.test_not_wiping_history_file)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/dje/cpython-buildarea/3.x.edelsohn-fedora-z/build/Lib/test/test_pyrepl/test_pyrepl.py", line 916, in test_not_wiping_history_file
    self.assertNotEqual(pathlib.Path(hfile.name).stat().st_size, 0)
    ~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: 0 == 0

Failure seen on:

  • s390x Fedora 3.x: https://buildbot.python.org/all/#/builders/223/builds/6180
  • AMD64 FreeBSD14 3.x: https://buildbot.python.org/all/#/builders/1232/builds/2756
  • ARM64 MacOS M1 NoGIL 3.x: https://buildbot.python.org/all/#/builders/1270/builds/1984
  • PPC64LE RHEL7 3.x: https://buildbot.python.org/all/#/builders/446/builds/5115

vstinner avatar Jul 03 '24 21:07 vstinner

I've been seeing test_pyrepl errors for a week or so now. I see the above and a failure in test_exposed_globals_in_repl on M1 Mac and my old Dell running Ubuntu. Happy to provide more details if needed, but it sounds like this is a fairly widespread problem.

Mac output:

Re-running test_pyrepl in verbose mode (matching: test_exposed_globals_in_repl, test_not_wiping_history_file)
test_exposed_globals_in_repl (test.test_pyrepl.test_pyrepl.TestMain.test_exposed_globals_in_repl) ... FAIL
test_not_wiping_history_file (test.test_pyrepl.test_pyrepl.TestMain.test_not_wiping_history_file) ... FAIL

======================================================================
FAIL: test_exposed_globals_in_repl (test.test_pyrepl.test_pyrepl.TestMain.test_exposed_globals_in_repl)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/skip/src/python/cpython/Lib/test/support/__init__.py", line 2622, in wrapper
    return func(*args, **kwargs)
  File "/Users/skip/src/python/cpython/Lib/test/test_pyrepl/test_pyrepl.py", line 868, in test_exposed_globals_in_repl
    self.assertTrue(case1 or case2 or case3 or case4, output)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: False is not true : sorted(dir())
io.FileIO name='/var/folders/d6/rzq9g7qd7zn5pwbc3pj1sthc0000gn/T/test_python_tk38j3o9/tmp8nzxvwmu' mode='rb+' closefd=True>
  gc.collect()
ResourceWarning: Enable tracemalloc to get the object allocation traceback
test test_pyrepl failed
1 test failed again:
    test_pyrepl

Dell (Ubuntu) output:

Re-running test_pyrepl in verbose mode (matching: test_exposed_globals_in_repl, test_not_wiping_history_file)
test_exposed_globals_in_repl (test.test_pyrepl.test_pyrepl.TestMain.test_exposed_globals_in_repl) ... FAIL
test_not_wiping_history_file (test.test_pyrepl.test_pyrepl.TestMain.test_not_wiping_history_file) ... FAIL

======================================================================
FAIL: test_exposed_globals_in_repl (test.test_pyrepl.test_pyrepl.TestMain.test_exposed_globals_in_repl)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/skip/src/python/cpython/Lib/test/support/__init__.py", line 2622, in wrapper
    return func(*args, **kwargs)
  File "/home/skip/src/python/cpython/Lib/test/test_pyrepl/test_pyrepl.py", line 868, in test_exposed_globals_in_repl
    self.assertTrue(case1 or case2 or case3 or case4, output)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: False is not true : sorted(dir())
exit

Python 3.14.0a0 (heads/main:94f50f8ee68, Jul  3 2024, 16:43:33) [GCC 11.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.


>>> 

>>> s

>>> so
>>> sor
>>> sort
>>> sorte
>>> sorted


>>> sorted(
>>> sorted(d

>>> sorted(di
>>> sorted(dir
>>> sorted(dir(
>>> sorted(dir()
>>> sorted(dir())



['__class__', '__class_getitem__', '__contains__', '__delattr__', '__delitem__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__getstate__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__ior__', '__iter__', '__le__', '__len__', '__lt__', '__ne__', '__new__', '__or__', '__reduce__', '__reduce_ex__', '__repr__', '__reversed__', '__ror__', '__setattr__', '__setitem__', '__sizeof__', '__str__', '__subclasshook__', 'clear', 'copy', 'fromkeys', 'get', 'items', 'keys', 'pop', 'popitem', 'setdefault', 'update', 'values']


>>> 

>>> e

>>> ex
>>> exi
>>> exit





======================================================================
FAIL: test_not_wiping_history_file (test.test_pyrepl.test_pyrepl.TestMain.test_not_wiping_history_file)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/skip/src/python/cpython/Lib/test/test_pyrepl/test_pyrepl.py", line 913, in test_not_wiping_history_file
    self.assertEqual(exit_code, 0)
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^
AssertionError: 1 != 0

----------------------------------------------------------------------
Ran 2 tests in 1.149s

FAILED (failures=2)
/home/skip/src/python/cpython/Lib/test/support/__init__.py:813: ResourceWarning: unclosed file <_io.FileIO name='/tmp/test_python_arl58hui/tmpp21h4toz' mode='rb+' closefd=True>
  gc.collect()
ResourceWarning: Enable tracemalloc to get the object allocation traceback
test test_pyrepl failed
1 test failed again:
    test_pyrepl

smontanaro avatar Jul 03 '24 22:07 smontanaro

I see the above and a failure in test_exposed_globals_in_repl on M1 Mac and my old Dell running Ubuntu. Happy to provide more details if needed, but it sounds like this is a fairly widespread problem.

Please open a separated issue for test_exposed_globals_in_repl(). See also https://github.com/python/cpython/issues/121206.

vstinner avatar Jul 04 '24 07:07 vstinner

Please open a separated issue for test_exposed_globals_in_repl(). See also #121206.

Yes, I saw that before. I opened a new issue:

https://github.com/python/cpython/issues/121359

smontanaro avatar Jul 04 '24 11:07 smontanaro

That means, that #121245 is not fixed on some systems.

Edit:

randomly?

@vstinner, is there examples of such failures AND successes on same buildbot?

I'm working on this.

skirpichev avatar Jul 06 '24 03:07 skirpichev

Example with s390x Fedora 3.x: https://buildbot.python.org/all/#/builders/223/builds/6180

In this example: "checking for stdlib extension module readline... missing". Unless I miss something, it's valid for other cases too, e.g.: https://buildbot.python.org/all/#/builders/1481/builds/288

As a workaround, I suggest to disable test if readline module is missing.

skirpichev avatar Jul 06 '24 04:07 skirpichev

FYI, pr is ready: https://github.com/python/cpython/pull/121422

skirpichev avatar Jul 06 '24 04:07 skirpichev

Fixed by change https://github.com/python/cpython/commit/68e279b37aae3019979a05ca55f462b11aac14be.

vstinner avatar Jul 06 '24 22:07 vstinner

I know it's closed, but this test still fails for me on my Mac (main and 3.13). I'm out of town, so can't check on my Ubuntu system, but I seem to recall that Apple's libedit maybe isn't a faithful replacement for all readline features:

% otool -L Modules/readline.cpython-314-darwin.so 
Modules/readline.cpython-314-darwin.so:
	/usr/lib/libedit.3.dylib (compatibility version 2.0.0, current version 3.0.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1345.100.2)

Is it possible that simply skipping the test based on the presence of the readline module isn't discriminating enough?

Edit @vstinner in case comments on closed issues don't send out notifications.

smontanaro avatar Jul 10 '24 14:07 smontanaro

https://github.com/python/cpython/issues/121245 was reopened.

Edit: @smontanaro, could you reproduce that original issue on your Mac?

skirpichev avatar Jul 10 '24 15:07 skirpichev