pypy/interpreter/test/test_app_main.py::TestInteraction::()::test_options_i_m
self = <pypy.interpreter.test.test_app_main.TestInteraction instance at 0x000000001d82ace0>
monkeypatch = <_pytest.monkeypatch.monkeypatch instance at 0x000000001d82aca0>
def test_options_i_m(self, monkeypatch):
if sys.platform == "win32":
py.test.skip("close_fds is not supported on Windows platforms")
if not hasattr(runpy, '_run_module_as_main'):
py.test.skip("requires CPython >= 2.6")
p = os.path.join(os.path.realpath(os.path.dirname(__file__)), 'mymodule.py')
p = os.path.abspath(p)
monkeypatch.chdir(os.path.dirname(app_main))
child = self.spawn(['-i',
'-m', 'test.mymodule',
'extra'])
child.expect('mymodule running')
child.expect('Name: __main__')
child.expect(re.escape('File: ' + p))
child.expect(re.escape('Argv: ' + repr([p, 'extra'])))
> child.expect('>>> ')
test/test_app_main.py:673:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../../virt_test/site-packages/pexpect/spawnbase.py:355: in expect
timeout, searchwindowsize, async_)
../../virt_test/site-packages/pexpect/spawnbase.py:383: in expect_list
return exp.expect_loop(timeout)
../../virt_test/site-packages/pexpect/expect.py:179: in expect_loop
return self.eof(e)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pexpect.expect.Expecter object at 0x000000001d834ad8>
err = EOF('End Of File (EOF). Exception style platform.',)
def eof(self, err=None):
spawn = self.spawn
spawn.before = spawn._before.getvalue()
spawn._buffer = spawn.buffer_type()
spawn._before = spawn.buffer_type()
spawn.after = EOF
index = self.searcher.eof_index
if index >= 0:
spawn.match = EOF
spawn.match_index = index
return index
else:
spawn.match = None
spawn.match_index = None
msg = str(spawn)
msg += '\nsearcher: %s' % self.searcher
if err is not None:
msg = str(err) + '\n' + msg
exc = EOF(msg)
exc.__cause__ = None # in Python 3.x we can use "raise exc from None"
> raise exc
E EOF: End Of File (EOF). Exception style platform.
E <pexpect.pty_spawn.spawn object at 0x000000001d8297c0>
E command: /usr/local/bin/python3.12
E args: ['/usr/local/bin/python3.12', '/buildbot/slave/own-linux-x86-64/build/pypy/interpreter/app_main.py', '-i', '-m', 'test.mymodule', 'extra']
E buffer (last 100 chars): ''
E before (last 100 chars): '(code, namespace)\r\n File "<string>", line 1, in <module>\r\nNameError: name \'object\' is not defined\r\n'
E after: <class 'pexpect.exceptions.EOF'>
E match: None
E match_index: None
E exitstatus: None
E flag_eof: True
E pid: 158818
E child_fd: 206
E closed: False
E timeout: 10
E delimiter: <class 'pexpect.exceptions.EOF'>
E logfile: <_pytest.capture.EncodedFile object at 0x0000000001877868>
E logfile_read: None
E logfile_send: None
E maxread: 2000
E ignorecase: False
E searchwindowsize: None
E delaybeforesend: 0.05
E delayafterclose: 0.1
E delayafterterminate: 0.1
E searcher: searcher_re:
E 0: re.compile('>>> ')
../../virt_test/site-packages/pexpect/expect.py:122: EOF
---------- Captured stdout call ----------
SPAWN: /usr/local/bin/python3.12 /buildbot/slave/own-linux-x86-64/build/pypy/interpreter/app_main.py -i -m test.mymodule extra {'env': None, 'timeout': 10}
mymodule running
Name: __main__
File: /buildbot/slave/own-linux-x86-64/build/pypy/interpreter/test/mymodule.py
Argv: ['/buildbot/slave/own-linux-x86-64/build/pypy/interpreter/test/mymodule.py', 'extra']
Traceback (most recent call last):
File "/buildbot/slave/own-linux-x86-64/build/pypy/interpreter/app_main.py", line 166, in run_toplevel
f(*fargs, **fkwds)
File "<frozen site>", line 462, in register_readline
File "/buildbot/slave/own-linux-x86-64/build/lib_pypy/readline.py", line 10, in <module>
from pyrepl.readline import *
File "/buildbot/slave/own-linux-x86-64/build/lib_pypy/pyrepl/readline.py", line 32, in <module>
from dataclasses import dataclass, field
File "/buildbot/slave/own-linux-x86-64/build/lib-python/3/dataclasses.py", line 1, in <module>
import re
File "/buildbot/slave/own-linux-x86-64/build/lib-python/3/re/__init__.py", line 124, in <module>
import enum
File "/buildbot/slave/own-linux-x86-64/build/lib-python/3/enum.py", line 5, in <module>
from functools import reduce
File "/buildbot/slave/own-linux-x86-64/build/lib-python/3/functools.py", line 442, in <module>
_CacheInfo = namedtuple("CacheInfo", ["hits", "misses", "maxsize", "currsize"])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/buildbot/slave/own-linux-x86-64/build/lib-python/3/collections/__init__.py", line 492, in namedtuple
exec(code, namespace)
File "<string>", line 1, in <module>
NameError: name 'object' is not defined
Traceback (most recent call last):
File "/buildbot/slave/own-linux-x86-64/build/pypy/interpreter/app_main.py", line 166, in run_toplevel
f(*fargs, **fkwds)
File "/buildbot/slave/own-linux-x86-64/build/lib_pypy/_pypy_interact.py", line 36, in interactive_console
from pyrepl.simple_interact import check
File "/buildbot/slave/own-linux-x86-64/build/lib_pypy/pyrepl/simple_interact.py", line 29, in <module>
import linecache
File "/buildbot/slave/own-linux-x86-64/build/lib-python/3/linecache.py", line 8, in <module>
import functools
File "/buildbot/slave/own-linux-x86-64/build/lib-python/3/functools.py", line 442, in <module>
_CacheInfo = namedtuple("CacheInfo", ["hits", "misses", "maxsize", "currsize"])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/buildbot/slave/own-linux-x86-64/build/lib-python/3/collections/__init__.py", line 492, in namedtuple
exec(code, namespace)
File "<string>", line 1, in <module>
NameError: name 'object' is not defined
builder: own-linux-x86-64 build #11021+
test: pypy/interpreter/test/test_app_main.py::TestInteraction::()::test_options_i_m