-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Description
When I try to run IPython’s tests on NixOS 25.05 with a 32-bit version of Python, these tests fail:
-
IPython/extensions/tests/test_deduperreload.py::DecoratorPatchingSuite::test_function_decorator_from_other_module -
IPython/extensions/tests/test_deduperreload.py::DecoratorPatchingSuite::test_function_decorators -
IPython/extensions/tests/test_deduperreload.py::DecoratorPatchingSuite::test_method_decorator
Steps to reproduce
-
Make sure that you have a copy of IPython’s Git repository on your system. Make sure that the path to your copy of IPython’s Git repository does not contain spaces, or else you will run into this other bug.
-
Open a terminal.
-
Make sure that you have a 32-bit version of Python. If you use the Nix package manager, then you can make sure that you have the exact same version of Python that I used to reproduce this bug by doing the following:
-
Create a file named
shell-for-working-on-ipython.nixthat contains the following Nix expression:# This file is dedicated to the public domain using 🅭🄍1.0: # <https://creativecommons.org/publicdomain/zero/1.0>. let nixpkgsCommit = "2b0d2b456e4e8452cf1c16d00118d145f31160f9"; nixpkgsDirectory = builtins.fetchTarball { url = "https://github.com/NixOS/nixpkgs/archive/${nixpkgsCommit}.tar.gz"; sha256 = "1c04l0yx2g9v5dslbxdy25x8pvja6mxyi6xqpmgzw61ry5yxbggv"; }; pkgs = import nixpkgsDirectory { }; in pkgs.pkgsi686Linux.mkShellNoCC { name = "shell-for-working-on-ipython"; packages = [ pkgs.pkgsi686Linux.python314 ]; }
-
Activate that Nix shell by running the following command:
nix-shell <path to shell-for-working-on-ipython.nix>
-
-
Create a new virtual environment by running this command:
python -m venv <path to where you want the venv to be created>
-
Activate the virtual environment that you just created. (See this section of the Python documentation).
-
(Recommended) Update pip by running this command:
python -m pip install --upgrade pip
-
Change directory to the root of your local copy of IPython’s Git repository by doing one of the following:
-
If your terminal is using the Windows Command Shell, then run this command:
CD /D <path to repo>
-
Otherwise, run this command:
cd <path to repo>
-
-
(Optional) Switch to a Git commit that is known to have this issue by running this command:
git switch --detach 11e1f400eecbfa12bbf55cdfff758a256d41d34e
-
Install a development version of IPython by running this command:
pip install -e '.[test]' -
Run IPython’s tests by running this command:
pytest
Results
===================================================== test session starts ======================================================
platform linux -- Python 3.14.0, pytest-9.0.2, pluggy-1.6.0
rootdir: /home/jayman/Documents/Home/VC/space_afraid/Git/not_mine/ipython/detached
configfile: pyproject.toml
plugins: asyncio-1.3.0
asyncio: mode=Mode.STRICT, debug=False, asyncio_default_fixture_loop_scope=None, asyncio_default_test_loop_scope=function
collected 1729 items / 2 skipped
IPython/core/completer.py ss [ 0%]
IPython/core/debugger.py s [ 0%]
IPython/core/display.py .. [ 0%]
IPython/core/display_functions.py . [ 0%]
IPython/core/formatters.py . [ 0%]
IPython/core/history.py . [ 0%]
IPython/core/interactiveshell.py .s.s [ 0%]
IPython/core/magics/ast_mod.py s [ 0%]
IPython/core/magics/auto.py s [ 0%]
IPython/core/magics/basic.py ss [ 0%]
IPython/core/magics/code.py s. [ 1%]
IPython/core/magics/config.py . [ 1%]
IPython/core/magics/execution.py ssssss [ 1%]
IPython/core/magics/history.py s [ 1%]
IPython/core/magics/namespace.py s..sss [ 1%]
IPython/core/magics/osm.py ssss [ 2%]
IPython/core/magics/pylab.py s [ 2%]
IPython/core/magics/script.py . [ 2%]
IPython/core/oinspect.py s [ 2%]
IPython/extensions/autoreload.py s [ 2%]
IPython/extensions/storemagic.py s [ 2%]
IPython/extensions/tests/test_deduperreload.py ...................................................................FFF... [ 6%]
. [ 6%]
IPython/lib/display.py s [ 6%]
IPython/terminal/magics.py s [ 6%]
IPython/terminal/shortcuts/auto_suggest.py . [ 6%]
IPython/testing/plugin/dtexample.py ....... [ 7%]
IPython/testing/plugin/simple.py .. [ 7%]
IPython/testing/plugin/test_combo.txt . [ 7%]
IPython/testing/plugin/test_example.txt .. [ 7%]
IPython/testing/plugin/test_exampleip.txt . [ 7%]
IPython/testing/plugin/test_ipdoctest.py ..... [ 7%]
IPython/testing/plugin/test_refs.py .... [ 8%]
IPython/testing/tools.py .. [ 8%]
IPython/utils/contexts.py . [ 8%]
IPython/utils/frame.py . [ 8%]
IPython/utils/ipstruct.py ........... [ 8%]
IPython/utils/path.py . [ 8%]
IPython/utils/strdispatch.py . [ 9%]
IPython/utils/sysinfo.py . [ 9%]
IPython/utils/text.py ....... [ 9%]
tests/test_alias.py .... [ 9%]
tests/test_application.py ... [ 9%]
tests/test_async_helpers.py .ssss...... [ 10%]
tests/test_autocall.py .. [ 10%]
tests/test_backgroundjobs.py .... [ 10%]
tests/test_capture.py ........................ [ 12%]
tests/test_clipboard.py . [ 12%]
tests/test_compilerop.py ...... [ 12%]
tests/test_completer.py ...........................................s.................................................... [ 18%]
.s...................................................................................................................... [ 25%]
........................xxx................................... [ 28%]
tests/test_completerlib.py ............ [ 29%]
tests/test_cve.py . [ 29%]
tests/test_debug_magic.py . [ 29%]
tests/test_debugger.py ..........sss... [ 30%]
tests/test_decorators.py .ss..s.ss.. [ 31%]
tests/test_decorators_2.py . [ 31%]
tests/test_deepreload.py ... [ 31%]
tests/test_dir2.py .... [ 31%]
tests/test_display.py ..............ss.sssss.ssss. [ 33%]
tests/test_display_2.py ........ssss.............. [ 34%]
tests/test_displayhook.py ....... [ 35%]
tests/test_editorhooks.py . [ 35%]
tests/test_embed.py .. [ 35%]
tests/test_events.py ..... [ 35%]
tests/test_exceptiongroup_tb.py sssssssss [ 36%]
tests/test_extension.py ... [ 36%]
tests/test_formatters.py ................................ [ 38%]
tests/test_guarded_eval.py .ss.ssss..................................................................................... [ 43%]
........................................................................................................................ [ 50%]
.............................................................................s.. [ 55%]
tests/test_handlers.py .................... [ 56%]
tests/test_help.py ......s [ 56%]
tests/test_history.py ...................... [ 57%]
tests/test_hooks.py ... [ 58%]
tests/test_imports.py ... [ 58%]
tests/test_importstring.py ... [ 58%]
tests/test_inputtransformer2.py ......................................... [ 60%]
tests/test_inputtransformer2_line.py ......... [ 61%]
tests/test_interactiveshell.py ..............................................s.....s......s...........................s [ 66%]
tests/test_interactivshell.py ......... [ 66%]
tests/test_io.py ... [ 67%]
tests/test_iplib.py ....... [ 67%]
tests/test_ipunittest.py ..... [ 67%]
tests/test_latextools.py ..sssssss...s. [ 68%]
tests/test_logger.py .. [ 68%]
tests/test_magic.py ......................s..............................s..............sss............................. [ 74%]
...................... [ 75%]
tests/test_magic_arguments.py . [ 75%]
tests/test_magic_terminal.py ........... [ 76%]
tests/test_module_paths.py ...... [ 76%]
tests/test_oinspect.py .................................. [ 78%]
tests/test_openpy.py ... [ 78%]
tests/test_page.py . [ 79%]
tests/test_path.py ss...s.....s.....s...........s [ 80%]
tests/test_paths.py ........... [ 81%]
tests/test_prefilter.py ........ [ 81%]
tests/test_pretty.py .................................... [ 83%]
tests/test_process.py .s.....ssss........ [ 85%]
tests/test_profile.py ..... [ 85%]
tests/test_pt_inputhooks.py s [ 85%]
tests/test_pycolorize.py ........ [ 85%]
tests/test_qt_loaders.py . [ 85%]
tests/test_run.py .....s............ss................. [ 88%]
tests/test_shellapp.py ... [ 88%]
tests/test_shortcuts.py s........................................................ [ 91%]
tests/test_splitinput.py ....................... [ 92%]
tests/test_storemagic.py .. [ 92%]
tests/test_sysinfo.py . [ 93%]
tests/test_tempdir.py .. [ 93%]
tests/test_text.py ....... [ 93%]
tests/test_tips.py ssssssssssssssssssssssss [ 94%]
tests/test_tokenutil.py ..................... [ 96%]
tests/test_tools.py .s........ [ 96%]
tests/test_ultratb.py ......s.................... [ 98%]
tests/test_wildcard.py ...... [ 98%]
tests/test_zzz_autoreload.py ..........s............ [ 99%]
=========================================================== FAILURES ===========================================================
_______________________________ DecoratorPatchingSuite.test_function_decorator_from_other_module _______________________________
self = <test_deduperreload.DecoratorPatchingSuite testMethod=test_function_decorator_from_other_module>
def test_function_decorator_from_other_module(self):
self.shell.magic_autoreload("2")
other_mod_name, _ = self.new_module(
"""
import functools
def incremented(f):
@functools.wraps(f)
def wrapper(*args, **kwargs):
return f(*args, **kwargs) + 1
return wrapper
"""
)
mod_name, mod_file = self.new_module(
f"""
from {other_mod_name} import incremented as deco
@deco
def foo():
return 42
"""
)
self.shell.run_code(f"from {mod_name} import foo")
self.shell.run_code("assert foo() == 43")
self.write_file(
mod_file,
f"""
from {other_mod_name} import incremented as deco
@deco
def foo():
return 43
""",
)
> self.shell.run_code("assert foo() == 44")
IPython/extensions/tests/test_deduperreload.py:2279:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
IPython/extensions/tests/test_deduperreload.py:720: in run_code
exec(code, self.user_ns)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> ???
E AssertionError
<string>:1: AssertionError
_______________________________________ DecoratorPatchingSuite.test_function_decorators ________________________________________
self = <test_deduperreload.DecoratorPatchingSuite testMethod=test_function_decorators>
def test_function_decorators(self):
self.shell.magic_autoreload("2")
mod_name, mod_file = self.new_module(
"""
def incremented(f):
return lambda *args: f(*args) + 1
@incremented
def foo():
return 42
"""
)
self.shell.run_code("import %s" % mod_name)
self.shell.run_code("pass")
mod = sys.modules[mod_name]
assert mod.foo() == 43
self.write_file(
mod_file,
"""
def incremented(f):
return lambda *args: f(*args) + 1
def foo():
return 42
""",
)
self.shell.run_code("pass")
> assert mod.foo() == 42
E AssertionError: assert 43 == 42
E + where 43 = <function incremented.<locals>.<lambda> at 0xf2ceb4f8>()
E + where <function incremented.<locals>.<lambda> at 0xf2ceb4f8> = <module 'tmpmod_u67mvjbge31lycwf20rs' from '/tmp/nix-shell-37909-0/tmpez8a41ty/tmpmod_u67mvjbge31lycwf20rs.py'>.foo
IPython/extensions/tests/test_deduperreload.py:2186: AssertionError
_________________________________________ DecoratorPatchingSuite.test_method_decorator _________________________________________
self = <test_deduperreload.DecoratorPatchingSuite testMethod=test_method_decorator>
def test_method_decorator(self):
self.shell.magic_autoreload("2")
mod_name, mod_file = self.new_module(
"""
def incremented(f):
return lambda *args: f(*args) + 1
class Foo:
@classmethod
@incremented
def foo(cls):
return 42
foo = Foo.foo
"""
)
self.shell.run_code(f"from {mod_name} import foo")
self.shell.run_code("assert foo() == 43")
self.write_file(
mod_file,
"""
def incremented(f):
return lambda *args: f(*args) + 1
class Foo:
@classmethod
def foo(cls):
return 42
foo = Foo.foo
""",
)
> self.shell.run_code("assert foo() == 42")
IPython/extensions/tests/test_deduperreload.py:2122:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
IPython/extensions/tests/test_deduperreload.py:720: in run_code
exec(code, self.user_ns)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> ???
E AssertionError
<string>:1: AssertionError
======================================================= warnings summary =======================================================
tests/test_async_helpers.py::AsyncTest::test_in_func_no_error
<>:8: SyntaxWarning: 'return' in a 'finally' block
tests/test_async_helpers.py::AsyncTest::test_in_func_no_error
tests/test_async_helpers.py::AsyncTest::test_in_func_no_error
<ipython-input-1-a475a201f42b>:8: SyntaxWarning: 'return' in a 'finally' block
return
tests/test_async_helpers.py::AsyncTest::test_top_level_return_error
<>:6: SyntaxWarning: 'return' in a 'finally' block
tests/test_async_helpers.py::AsyncTest::test_top_level_return_error
tests/test_async_helpers.py::AsyncTest::test_top_level_return_error
<ipython-input-1-714c4c819d0d>:6: SyntaxWarning: 'return' in a 'finally' block
return
tests/test_debug_magic.py: 1 warning
tests/test_debugger.py: 8 warnings
tests/test_embed.py: 1 warning
tests/test_interactiveshell.py: 3 warnings
tests/test_process.py: 3 warnings
/nix/store/hyffdrdibp82d5z9raypiyr59nmszcr4-python3-3.14.0/lib/python3.14/pty.py:66: DeprecationWarning: This process (pid=38126) is multi-threaded, use of forkpty() may lead to deadlocks in the child.
pid, fd = os.forkpty()
tests/test_debugger.py: 9 warnings
tests/test_magic.py: 2 warnings
tests/test_run.py: 5 warnings
/home/jayman/Documents/Home/VC/space_afraid/Git/not_mine/ipython/detached/IPython/core/debugger.py:617: DeprecationWarning: The frame locals reference is no longer cached. Use 'curframe.f_locals' instead.
return self.curframe_locals
tests/test_debugger.py::tests.test_debugger.test_ipdb_magics
/home/jayman/Documents/Home/VC/space_afraid/Git/not_mine/ipython/detached/IPython/core/debugger.py:958: DeprecationWarning: The frame locals reference is no longer cached. Use 'curframe.f_locals' instead.
("Locals", self.curframe_locals),
tests/test_debugger.py::tests.test_debugger.test_ipdb_magics
/home/jayman/Documents/Home/VC/space_afraid/Git/not_mine/ipython/detached/IPython/core/debugger.py:969: DeprecationWarning: The frame locals reference is no longer cached. Use 'curframe.f_locals' instead.
("Locals", self.curframe_locals),
tests/test_debugger.py::tests.test_debugger.test_ipdb_magics
/home/jayman/Documents/Home/VC/space_afraid/Git/not_mine/ipython/detached/IPython/core/debugger.py:992: DeprecationWarning: The frame locals reference is no longer cached. Use 'curframe.f_locals' instead.
("Locals", self.curframe_locals),
tests/test_inputtransformer2.py::test_check_make_token_by_line_never_ends_empty
/home/jayman/Documents/Home/VC/space_afraid/Git/not_mine/ipython/detached/tests/test_inputtransformer2.py:188: UserWarning: `make_tokens_by_line` received a list of lines which do not have lineending markers ('\n', '\r', '\r\n', '\x0b', '\x0c'), behavior will be unspecified
assert make_tokens_by_line(c + k)[-1] != []
tests/test_interactiveshell.py::test_run_cell_async
/nix/store/hyffdrdibp82d5z9raypiyr59nmszcr4-python3-3.14.0/lib/python3.14/asyncio/events.py:94: DeprecationWarning: `run_cell_async` will not call `transform_cell` automatically in the future. Please pass the result to `transformed_cell` argument and any exception that happen during thetransform in `preprocessing_exc_tuple` in IPython 7.17 and above.
self._context.run(self._callback, *self._args)
tests/test_ultratb.py::Python3ChainedExceptionsTest::test_sysexit_while_handling_error
/home/jayman/Documents/Home/VC/space_afraid/Git/not_mine/ipython/detached/IPython/core/interactiveshell.py:3709: UserWarning: To exit: use 'exit', 'quit', or Ctrl-D.
warn("To exit: use 'exit', 'quit', or Ctrl-D.", stacklevel=1)
-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
===================================================== slowest 10 durations =====================================================
5.34s call tests/test_zzz_autoreload.py::TestAutoreload::test_autoreload_output
4.21s call tests/test_debugger.py::test_ignore_module_all_commands
3.56s call tests/test_zzz_autoreload.py::TestAutoreload::test_autoload_newly_added_objects
3.54s call tests/test_magic.py::test_script_streams_continuously
3.44s call tests/test_zzz_autoreload.py::TestAutoreload::test_smoketest_autoreload
3.38s call tests/test_zzz_autoreload.py::TestAutoreload::test_smoketest_aimport
2.07s call tests/test_magic.py::test_script_raise_on_interrupt
2.03s call tests/test_magic.py::test_script_do_not_raise_on_interrupt
2.00s call tests/test_magic.py::test_timeit_raise_on_interrupt
2.00s call tests/test_magic.py::test_time_raise_on_interrupt
=================================================== short test summary info ====================================================
FAILED IPython/extensions/tests/test_deduperreload.py::DecoratorPatchingSuite::test_function_decorator_from_other_module - AssertionError
FAILED IPython/extensions/tests/test_deduperreload.py::DecoratorPatchingSuite::test_function_decorators - AssertionError: assert 43 == 42
FAILED IPython/extensions/tests/test_deduperreload.py::DecoratorPatchingSuite::test_method_decorator - AssertionError
======================= 3 failed, 1586 passed, 139 skipped, 3 xfailed, 44 warnings in 134.15s (0:02:14) ========================