Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Test failures when path to IPython source code contains spaces #15100

Copy link
Copy link
@Jayman2000

Description

@Jayman2000
Issue body actions

When I try to run IPython’s tests on NixOS 25.05, these tests fail:

  • tests/test_interactiveshell.py::ExitCodeChecks::test_exit_code_signal
  • tests/test_interactiveshell.py::TestSystemRaw::test_exit_code_signal
  • tests/test_interactiveshell.py::TestSystemPipedExitCode::test_exit_code_signal

EDIT: It turns out that those failures happen only if you store IPython’s source code in a directory that has at least one space in its path.

Steps to reproduce

  1. 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 contains at least one space.

  2. Open a terminal.

  3. Make sure that you have the python command. 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:

    1. Create a file named shell-for-working-on-ipython.nix that 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 = "09eb77e94fa25202af8f3e81ddc7353d9970ac1b";
        nixpkgsDirectory = builtins.fetchTarball {
          url = "https://github.com/NixOS/nixpkgs/archive/${nixpkgsCommit}.tar.gz";
          sha256 = "02hdh4r0cc5h78cmymndb8clfhkn6phbrkrv6s8kvyfspqwzj84r";
        };
        pkgs = import nixpkgsDirectory { };
      in
      pkgs.mkShellNoCC {
        name = "shell-for-working-on-ipython";
        packages = [ pkgs.python314 ];
      }
    2. Activate that Nix shell by running the following command:

      nix-shell <path to shell-for-working-on-ipython.nix>
  4. Create a new virtual environment by running this command:

    python -m venv <path to where you want the venv to be created>
  5. Activate the virtual environment that you just created. (See this section of the Python documentation).

  6. (Recommended) Update pip by running this command:

    python -m pip install --upgrade pip
  7. 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>
  8. (Optional) Switch to a Git commit that is known to have this issue by running this command:

    git switch --detach f63b2acb992e0e88619f4486bc67620f9f50fe50
  9. Install a development version of IPython by running this command:

    pip install -e '.[test]'
  10. 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/Git/Not mine/ipython/repo
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 1728 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 ......................................................................... [  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 .............................................Fs....Fs.....Fs...........................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..................

=========================================================== FAILURES ===========================================================
_____________________________________________ ExitCodeChecks.test_exit_code_signal _____________________________________________

self = <tests.test_interactiveshell.ExitCodeChecks testMethod=test_exit_code_signal>

    @skipif(not hasattr(signal, "SIGALRM"))
    def test_exit_code_signal(self):
        self.mktmp(
            "import signal, time\n"
            "signal.setitimer(signal.ITIMER_REAL, 0.1)\n"
            "time.sleep(1)\n"
        )
        self.system("%s %s" % (sys.executable, self.fname))
>       self.assertEqual(ip.user_ns["_exit_code"], -signal.SIGALRM)
E       AssertionError: 127 != -14

tests/test_interactiveshell.py:661: AssertionError
----------------------------------------------------- Captured stderr call -----------------------------------------------------
/nix/store/nn27l879np49xvx6l1a8nqnqlp9apd8n-bash-interactive-5.2p37/bin/bash: line 1: /home/jayman/Documents/Home/VC/Git/Not: No such file or directory
_____________________________________________ TestSystemRaw.test_exit_code_signal ______________________________________________

self = <tests.test_interactiveshell.TestSystemRaw testMethod=test_exit_code_signal>

    @skipif(not hasattr(signal, "SIGALRM"))
    def test_exit_code_signal(self):
        self.mktmp(
            "import signal, time\n"
            "signal.setitimer(signal.ITIMER_REAL, 0.1)\n"
            "time.sleep(1)\n"
        )
        self.system("%s %s" % (sys.executable, self.fname))
>       self.assertEqual(ip.user_ns["_exit_code"], -signal.SIGALRM)
E       AssertionError: 127 != -14

tests/test_interactiveshell.py:661: AssertionError
----------------------------------------------------- Captured stderr call -----------------------------------------------------
/nix/store/nn27l879np49xvx6l1a8nqnqlp9apd8n-bash-interactive-5.2p37/bin/bash: line 1: /home/jayman/Documents/Home/VC/Git/Not: No such file or directory
________________________________________ TestSystemPipedExitCode.test_exit_code_signal _________________________________________

self = <tests.test_interactiveshell.TestSystemPipedExitCode testMethod=test_exit_code_signal>

    @skip_win32
    def test_exit_code_signal(self):
>       ExitCodeChecks.test_exit_code_signal(self)

tests/test_interactiveshell.py:733:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tests/test_interactiveshell.py:661: in test_exit_code_signal
    self.assertEqual(ip.user_ns["_exit_code"], -signal.SIGALRM)
E   AssertionError: 127 != -14
----------------------------------------------------- Captured stdout call -----------------------------------------------------
/nix/store/nn27l879np49xvx6l1a8nqnqlp9apd8n-bash-interactive-5.2p37/bin/bash: line 1: /home/jayman/Documents/Home/VC/Git/Not: No such file or directory
======================================================= 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
  /nix/store/sddj4ifk8jdpqi1vzzz6cl7bb0cshskx-python3-3.14.0/lib/python3.14/pty.py:66: DeprecationWarning: This process (pid=554813) 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
  /home/jayman/Documents/Home/VC/Git/Not mine/ipython/repo/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/Git/Not mine/ipython/repo/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/Git/Not mine/ipython/repo/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/Git/Not mine/ipython/repo/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/Git/Not mine/ipython/repo/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/sddj4ifk8jdpqi1vzzz6cl7bb0cshskx-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)

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
===================================================== slowest 10 durations =====================================================
3.95s call     tests/test_debugger.py::test_ignore_module_all_commands
2.15s call     IPython/extensions/tests/test_deduperreload.py::DecoratorPatchingSuite::test_function_decorators
2.00s call     tests/test_magic.py::test_timeit_raise_on_interrupt
1.72s call     tests/test_debugger.py::test_xmode_skip
1.53s call     tests/test_embed.py::test_nest_embed
1.33s call     tests/test_debug_magic.py::test_debug_magic_passes_through_generators
1.26s call     tests/test_debugger.py::test_where_erase_value
1.12s call     IPython/extensions/tests/test_deduperreload.py::TestAutoreloadEnum::test_reload_enums
1.11s call     IPython/extensions/tests/test_deduperreload.py::DecoratorPatchingSuite::test_modify_property
1.10s call     tests/test_debugger.py::test_ignore_module_basic_functionality
=================================================== short test summary info ====================================================
FAILED tests/test_interactiveshell.py::ExitCodeChecks::test_exit_code_signal - AssertionError: 127 != -14
FAILED tests/test_interactiveshell.py::TestSystemRaw::test_exit_code_signal - AssertionError: 127 != -14
FAILED tests/test_interactiveshell.py::TestSystemPipedExitCode::test_exit_code_signal - AssertionError: 127 != -14
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! KeyboardInterrupt !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
/nix/store/sddj4ifk8jdpqi1vzzz6cl7bb0cshskx-python3-3.14.0/lib/python3.14/threading.py:1132: KeyboardInterrupt
(to show a full traceback on KeyboardInterrupt use --full-trace)
======================== 3 failed, 1178 passed, 96 skipped, 3 xfailed, 35 warnings in 82.23s (0:01:22) =========================

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.