xonsh/tests
jyn a953c29443
allow test_raise_subproc_error_with_show_traceback to be run locally (#5461)
previously, this succeeded in CI, but always failed locally with the
following error:
```xsh
_____________________________________________________________________ test_raise_subproc_error_with_show_traceback[True] _____________________________________________________________________

monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x76f6ba8882e0>, interactive = True

    @skip_if_on_windows
    @pytest.mark.parametrize("interactive", [True, False])
    def test_raise_subproc_error_with_show_traceback(monkeypatch, interactive):
        out, err, ret = run_xonsh(
            "$COLOR_RESULTS=False\n$RAISE_SUBPROC_ERROR=False\n$XONSH_SHOW_TRACEBACK=False\nls nofile",
            interactive=interactive,
            single_command=True,
        )
        assert ret != 0
>       assert re.match("ls.*No such file or directory\n", out)
E       assert None
E        +  where None = <function match at 0x76f6bcd0cd30>('ls.*No such file or directory\n', "\x1b]0;ls | jyn@pop-os: ~/src/xonsh | xonsh\x07ls: cannot access 'nofile': No such file or directory\n")
E        +    where <function match at 0x76f6bcd0cd30> = re.match

tests/test_integrations.py:1190: AssertionError
```

the problem was that the following string was prepended before the error
message:
```
\x1b]0;ls | jyn@pop-os: ~/src/xonsh | xonsh\x07l
```

that in turn came from
[`BaseShell.settitle`](66c0490d37/xonsh/base_shell.py (L570)),
which always prepends at least the escape codes even when TITLE is set
to an empty string.

avoid this issue by mimicking a dumb terminal in tests, in which case
`settitle` doesn't add any title at all.

see
https://xonsh.zulipchat.com/#narrow/stream/435069-xonsh-dev/topic/Running.20tests.20locally
for more context.
<!---

Thanks for opening a PR on xonsh!

Please do this:

1. Include a news file with your PR
(https://xon.sh/devguide.html#changelog).
2. Add the documentation for your feature into `/docs`.
3. Add the example of usage or before-after behavior.
4. Mention the issue that this PR is addressing e.g. `#1234`.

-->

## For community
⬇️ **Please click the 👍 reaction instead of leaving a `+1` or 👍
comment**
2024-05-30 17:02:53 +02:00
..
aliases refactor(aliases): source foreign shell funcs without interactive mode (#5344) 2024-04-18 19:51:39 +05:30
bin style: isort imports 2022-01-31 11:16:51 -05:00
completers chore: use stable 3.12 for CI jobs (#5307) 2024-05-16 15:43:57 +05:30
histories Fix tests 2020-09-23 21:15:37 +02:00
man1 improve completers (#4648) 2022-01-27 21:22:36 +05:30
procs Added SpecModifierAlias and xthread, xunthread aliases (#5443) 2024-05-28 11:03:45 -04:00
prompt Py 312 pre-liminary support (#5156) 2023-07-04 22:18:37 +05:30
scripts xonsh script.xsh should not fail over 2017-01-11 21:59:42 +08:00
test_lib chore: update tests 2022-03-24 19:49:30 +05:30
xoreutils Py 312 pre-liminary support (#5156) 2023-07-04 22:18:37 +05:30
xpack fix: do not append empty/comment-only input to history (#4822) 2022-05-26 17:50:08 +05:30
.somedotfile dotfile matching 2018-09-12 18:12:02 -04:00
bashrc.sh added tests for foreign shells 2015-10-10 19:52:53 -04:00
batch.bat Add test for sourcing bat file on windows 2016-04-18 00:41:11 +02:00
conftest.py Fix vox env dir (#4736) 2022-03-27 17:12:52 +05:30
run_pwd.xsh more fixes 2016-09-09 00:58:32 -04:00
sample.xsh fixed up dashing 2018-11-08 13:16:44 -05:00
test_aliases.py feat: add superhelp and additional context via new FuncAlias (#5366) 2024-05-13 09:11:58 -04:00
test_ansi_colors.py [pre-commit.ci] pre-commit autoupdate (#5271) 2024-01-30 12:23:50 +01:00
test_ast.py [pre-commit.ci] pre-commit autoupdate (#5271) 2024-01-30 12:23:50 +01:00
test_base_shell.py [pre-commit.ci] pre-commit autoupdate (#5271) 2024-01-30 12:23:50 +01:00
test_builtins.py [pre-commit.ci] pre-commit autoupdate (#5271) 2024-01-30 12:23:50 +01:00
test_cli_utils.py Fix argparser (#5421) 2024-05-16 16:31:05 +05:30
test_color_tools.py [pre-commit.ci] pre-commit autoupdate (#5271) 2024-01-30 12:23:50 +01:00
test_commands_cache.py Added support of NixOS core tools in `predict_threadable` (#5440) 2024-05-24 16:51:25 -04:00
test_completer.py Use substring for env completion and better way to sort list (#5388) 2024-05-03 10:30:14 +02:00
test_completion_context.py [pre-commit.ci] pre-commit autoupdate (#5271) 2024-01-30 12:23:50 +01:00
test_contexts.py [pre-commit.ci] pre-commit autoupdate (#5271) 2024-01-30 12:23:50 +01:00
test_dirstack.py fix(dirstack): use XSH.env for $HOME check, not os.path (#5211) 2023-09-25 14:53:15 +06:00
test_dirstack_unc.py refactor: update line length to default setting 2024-04-16 11:23:35 -04:00
test_environ.py Added `env.detype_all()` to get all available variables that is possible to detype. (#5431) 2024-05-22 07:53:11 +05:30
test_events.py [pre-commit.ci] pre-commit autoupdate (#5271) 2024-01-30 12:23:50 +01:00
test_execer.py [pre-commit.ci] pre-commit autoupdate (#5271) 2024-01-30 12:23:50 +01:00
test_foreign_shells.py [pre-commit.ci] pre-commit autoupdate (#5271) 2024-01-30 12:23:50 +01:00
test_history_dummy.py Add XONSH_HISTORY_IGNORE_REGEX support (#4953) 2022-10-05 00:16:42 +05:30
test_history_json.py Revert partial_proxy (#5445) 2024-05-27 18:00:15 +02:00
test_history_sqlite.py [pre-commit.ci] pre-commit autoupdate (#5271) 2024-01-30 12:23:50 +01:00
test_imphooks.py [pre-commit.ci] pre-commit autoupdate (#5271) 2024-01-30 12:23:50 +01:00
test_integrations.py allow test_raise_subproc_error_with_show_traceback to be run locally (#5461) 2024-05-30 17:02:53 +02:00
test_jobs.py Fix job control for callable aliases (#4901) 2022-08-03 11:37:26 +05:30
test_jsonutils.py [pre-commit.ci] pre-commit autoupdate (#5271) 2024-01-30 12:23:50 +01:00
test_lazyasd.py [pre-commit.ci] pre-commit autoupdate (#5271) 2024-01-30 12:23:50 +01:00
test_lazyjson.py [pre-commit.ci] pre-commit autoupdate (#5271) 2024-01-30 12:23:50 +01:00
test_lexer.py Fix parsing of redirect tokens (#5322) 2024-04-05 13:21:54 +05:30
test_main.py [pre-commit.ci] pre-commit autoupdate (#5271) 2024-01-30 12:23:50 +01:00
test_man.py style: sort imports 2022-03-24 19:49:30 +05:30
test_news.py [pre-commit.ci] pre-commit autoupdate (#5271) 2024-01-30 12:23:50 +01:00
test_parser.py feat: allow square brackets in command arguments (#5326) 2024-04-09 22:33:43 +05:30
test_pipelines.py feat: add subproc output format, autostrip singleline output (#5377) 2024-05-02 11:48:25 -04:00
test_platform.py style: isort imports 2022-01-31 11:16:51 -05:00
test_pretty.py fix: item order of pretty-printed dictionaries (#4786) 2022-04-30 08:25:52 +05:30
test_ptk_completer.py cmd cache refactor - optimize cache usage (#4954) 2022-11-14 23:52:10 +05:30
test_ptk_highlight.py [pre-commit.ci] pre-commit autoupdate (#5271) 2024-01-30 12:23:50 +01:00
test_ptk_history.py refactor: remove xonsh.ptk2 module (#4570) 2021-11-30 08:22:31 -05:00
test_ptk_multiline.py [pre-commit.ci] pre-commit autoupdate (#5271) 2024-01-30 12:23:50 +01:00
test_ptk_shell.py [pre-commit.ci] pre-commit autoupdate (#5148) 2023-05-30 17:10:53 +06:00
test_pyghooks.py [pre-commit.ci] pre-commit autoupdate (#5271) 2024-01-30 12:23:50 +01:00
test_readline_shell.py Add test for readline shell (#4447) 2021-09-02 22:15:20 +03:00
test_shell.py [pre-commit.ci] pre-commit autoupdate (#5271) 2024-01-30 12:23:50 +01:00
test_tools.py feat: add superhelp and additional context via new FuncAlias (#5366) 2024-05-13 09:11:58 -04:00
test_tracer.py pre-commit hook for pyupgrade (#4583) 2021-12-06 14:42:26 -05:00
test_virtualenv_activator.py fix: update virtualenv activator (#5419) 2024-05-16 14:29:48 +05:30
test_wizard.py [pre-commit.ci] pre-commit autoupdate (#5271) 2024-01-30 12:23:50 +01:00
test_xonfig.py refactor: update line length to default setting 2024-04-16 11:23:35 -04:00
test_xonsh.xsh Remove globals (#4280) 2021-05-20 13:14:26 +03:00
test_xontribs.py [pre-commit.ci] pre-commit autoupdate (#5271) 2024-01-30 12:23:50 +01:00