Git Product home page Git Product logo

Comments (25)

anki-code avatar anki-code commented on July 23, 2024 1

Maybe this occurs because of using ls in tests? So to be TERM indifferent we just need to use another way to generate the error.

from xonsh.

anki-code avatar anki-code commented on July 23, 2024 1

Can you please check that you're running tests from environment with attached TTY (e.g. using #!/bin/bash -i shebang)? In other case with detached TTY the subprocess can be suspended by OS.

from xonsh.

anki-code avatar anki-code commented on July 23, 2024 1

I can reproduce this:

cat > run-test.xsh <<EOF
#!/usr/bin/env xonsh
![pytest tests/test_integrations.py]
EOF

xonsh run-test.xsh
# 99 passed

TERM=dumb xonsh run-test.xsh
# 50% passed and timeout error

I think this is the case from #5462. Minimal PoC:

echo whoami | TERM=dumb xonsh -i --no-rc
# or the same
echo whoami | xonsh -st dumb -i  # dumb is readline in fact
# or the same
echo whoami | xonsh -st readline -i

What is the difference between

  • In TERM=xterm: backend=prompt_toolkit
  • In TERM=dumb: backend=readline without colors, updating title disabled.

I think the issue is around how readline backend process stdin. I suppose this case is just not implemented.

I'm going to close this as duplication.

from xonsh.

anki-code avatar anki-code commented on July 23, 2024 1

@rautyrauty I've made the fix in #5536. If you can test it will be cool.

git clone -b 'fix_stdin_to_interactive' https://github.com/xonsh/xonsh
cd xonsh
pytest

from xonsh.

rautyrauty avatar rautyrauty commented on July 23, 2024 1

@anki-code I tested it. All tests are passed! 🎉🎉🎉

from xonsh.

anki-code avatar anki-code commented on July 23, 2024 1

We have major refactoring in master and two awesome PRs is waiting for approve. So the future release will be in a week or two or maybe in a month.
We have no distinct minor and major versions in git. So if you can pin and use the commit with fix it will be ok.

from xonsh.

anki-code avatar anki-code commented on July 23, 2024

This was working in our Github CI and on my local. Please provide a bit more details about your environment and PR is welcome!

from xonsh.

rautyrauty avatar rautyrauty commented on July 23, 2024
xonfig
+-----------------------------+-----------------+
| xonsh                       | 0.17.0          |
| Python                      | 3.12.2          |
| PLY                         | 3.11            |
| have readline               | True            |
| prompt toolkit              | 3.0.43          |
| shell type                  | prompt_toolkit  |
| history backend             | json            |
| pygments                    | 2.18.0          |
| on posix                    | True            |
| on linux                    | True            |
| distro                      | altlinux        |
| on wsl                      | False           |
| on darwin                   | False           |
| on windows                  | False           |
| on cygwin                   | False           |
| on msys2                    | False           |
| is superuser                | False           |
| default encoding            | utf-8           |
| xonsh encoding              | utf-8           |
| encoding errors             | surrogateescape |
| xontrib                     | []              |
| RC file                     | []              |
| UPDATE_OS_ENVIRON           | False           |
| XONSH_CAPTURE_ALWAYS        | False           |
| XONSH_SUBPROC_OUTPUT_FORMAT | stream_lines    |
| THREAD_SUBPROCS             | True            |
| XONSH_CACHE_SCRIPTS         | True            |
+-----------------------------+-----------------+

PR is welcome!

Unfortunately, I have no idea how to fix it.

from xonsh.

anki-code avatar anki-code commented on July 23, 2024

Thanks for xonfig! If you can can repeat this in altlinux docker and provide the list of commands to repeat (like here) it will be awesome.

from xonsh.

rautyrauty avatar rautyrauty commented on July 23, 2024

The problem only occurs with "TERM=dumb"!
I do not know why there is such a variable when building a package.

from xonsh.

rautyrauty avatar rautyrauty commented on July 23, 2024

Have you succeeded in reproducing this problem?

from xonsh.

anki-code avatar anki-code commented on July 23, 2024

The problem only occurs with "TERM=dumb"!

I remember we had this fix to fix timeout integration tests - https://github.com/xonsh/xonsh/pull/5461/files (#5461)
Where you see TERM=dumb?

from xonsh.

rautyrauty avatar rautyrauty commented on July 23, 2024

This variable is set in my build environment.

from xonsh.

rautyrauty avatar rautyrauty commented on July 23, 2024

Well, now when I unset TERM the tests/procs/test_specs.py::test_proc_raise_subproc_error fails in ppc64le.
With the TERM=dumb this test passes.

from xonsh.

rautyrauty avatar rautyrauty commented on July 23, 2024

ls doesn't seem to be used for tests/test_integrations.py::test_catching_system_exit

from xonsh.

rautyrauty avatar rautyrauty commented on July 23, 2024

Well, now when I unset TERM the tests/procs/test_specs.py::test_proc_raise_subproc_error fails in ppc64le. With the TERM=dumb this test passes.

I restarted the tests without changes and only tests/test_pipelines.py::test_simple_capture[echo hi | grep h-hi] failed on i568. Restarted it again and only tests/procs/test_specs.py::test_proc_raise_subproc_error on ppc64le failed. On one more try, all the tests passed. With TERM=dumb they always pass.

from xonsh.

anki-code avatar anki-code commented on July 23, 2024

With TERM=dumb they always pass.

You mean this line -

"TERM": "linux", # disable ansi escape codes
?

from xonsh.

rautyrauty avatar rautyrauty commented on July 23, 2024

I mean TERM=dumb python3 -m xonsh run-tests.xsh test -- --timeout=240

from xonsh.

rautyrauty avatar rautyrauty commented on July 23, 2024

I have not tried to change this line

from xonsh.

anki-code avatar anki-code commented on July 23, 2024

Can you check the state of xonsh when you see hanging of the test? E.g.:

Window 1: run test see hanging. May be you need to increase timeout to 99999 to avoid stopping by timeout.

Window 2:

ps ax | grep xonsh
# or get pid from ps tree:
pstree -s xonsh # Here you can see the tree from pytest to xonsh
# and grep by pid e.g. 16763
ps ax | grep 16763

You will have something like this:

16763 s001  T     0:00.00 xonsh

Where T means "Marks a stopped process." (from man ps).

I think hanging tests issue may related to suspending xonsh in case of detached TTY (#5244 (comment)).

from xonsh.

rautyrauty avatar rautyrauty commented on July 23, 2024
[builder@localhost python3-module-xonsh-0.17.0]$ ps ax | grep xonsh
  32811 pts/0    SN     0:00 /usr/bin/python3 -m pyproject_installer run -- python3 -m xonsh run-tests.xsh test -- -vvvra
  32813 pts/0    SN     0:00 python3 -m xonsh run-tests.xsh test -- -vvvra
  32816 pts/0    SNl    0:06 /usr/src/RPM/BUILD/python3-module-xonsh-0.17.0/.run_venv/bin/python3 /usr/src/RPM/BUILD/python3-module-xonsh-0.17.0/.run_venv/bin/pytest -vvvra --durations=5
  34320 pts/0    RN     4:17 /usr/src/RPM/BUILD/python3-module-xonsh-0.17.0/.run_venv/bin/python3 /usr/src/RPM/BUILD/python3-module-xonsh-0.17.0/.run_venv/bin/xonsh --no-rc -i
  34503 pts/0    SN+    0:00 grep --color=auto xonsh
[builder@localhost python3-module-xonsh-0.17.0]$ ps ax | grep 34320
  34320 pts/0    RN     4:57 /usr/src/RPM/BUILD/python3-module-xonsh-0.17.0/.run_venv/bin/python3 /usr/src/RPM/BUILD/python3-module-xonsh-0.17.0/.run_venv/bin/xonsh --no-rc -i
  34515 pts/0    SN+    0:00 grep --color=auto 34320
[builder@localhost python3-module-xonsh-0.17.0]$ tty
/dev/pts/0
[builder@localhost python3-module-xonsh-0.17.0]$ tty --version
tty (GNU coreutils) 9.4.0.75.7f2c97
Copyright (C) 2023 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by David MacKenzie

from xonsh.

rautyrauty avatar rautyrauty commented on July 23, 2024

To avoid failures, I am currently running tests like this: TERM= /usr/bin/python3 -m pyproject_installer run -- python3 -m xonsh run-tests.xsh test -- --timeout=240 -vvvra --reruns=3

from xonsh.

anki-code avatar anki-code commented on July 23, 2024

I can't repeat this in ALT linux docker.

docker run --rm -it alt

cat /etc/os-release
# PRETTY_NAME="ALT Starterkit 10 (Hypericum)"
echo $TERM
# xterm

apt-get update && apt-get install -y python3 python3-dev git sqlite3 libsqlite3 python3-modules-sqlite3
python3 -m ensurepip --upgrade && pip3 install -U pip
cd /usr/bin && ln -s python3 python && cd /

git clone https://github.com/xonsh/xonsh # 9f0bf03
cd /xonsh
pip3 install '.[dev]'

pytest tests/test_integrations.py
TERM=dumb pytest tests/test_integrations.py
# 99 passed, 3 skipped, 1 xfailed, 1 xpassed, 2 rerun in 28.29s

python3 -m xonsh run-tests.xsh test
# Success: 5049 passed, 22 failed (it's system dependent bash-completer tests)

from xonsh.

rautyrauty avatar rautyrauty commented on July 23, 2024

I've never used docker, I'll try to reproduce it in docker tomorrow. I remind you that tests fail only with TERM=dumb.

from xonsh.

rautyrauty avatar rautyrauty commented on July 23, 2024

Please make a new release with this fix 🥺

from xonsh.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.