Comments (25)
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.
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.
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.
@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.
@anki-code I tested it. All tests are passed! 🎉🎉🎉
from xonsh.
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.
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.
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.
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.
The problem only occurs with "TERM=dumb"!
I do not know why there is such a variable when building a package.
from xonsh.
Have you succeeded in reproducing this problem?
from xonsh.
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.
This variable is set in my build environment.
from xonsh.
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.
ls
doesn't seem to be used for tests/test_integrations.py::test_catching_system_exit
from xonsh.
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.
With TERM=dumb they always pass.
You mean this line -
xonsh/tests/test_integrations.py
Line 50 in 93e493a
from xonsh.
I mean TERM=dumb python3 -m xonsh run-tests.xsh test -- --timeout=240
from xonsh.
I have not tried to change this line
from xonsh.
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.
[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.
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.
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.
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.
Please make a new release with this fix 🥺
from xonsh.
Related Issues (20)
- Refactoring: commands cache HOT 4
- Xonsh immediately crashes when started, ujson attribute error HOT 2
- Reduce loading colors in non interactive command
- Refactoring: split `tools.py` into libs
- INVERT_ prompt color prefix does nothing HOT 1
- {user} in $PROMPT inaccurate if the user is root HOT 1
- $SHELL wrongly set; messes with tmux HOT 4
- Test failure building for NixOS HOT 1
- Refactoring: xontribs HOT 3
- No good way to get the last return code in a script HOT 2
- Implement `exit N` HOT 3
- current main: callable alias completion `Exception sequence item 0: expected str instance, FuncAlias found`
- Sometimes I see lag in first xonsh (or any python app?) run in new ssh session HOT 3
- Edge case: Shadowing xonsh in case of running script with shebang in virtual env
- Wrong path resolution in subprocess HOT 5
- Run tests: `fixture 'xession' not found use 'pytest --fixtures [testpath]' for help on them.` HOT 1
- conda and mamba: `DeprecationWarning: Use xonsh.lib.lazyasd instead of xonsh.lazyasd.` HOT 1
- What is changed after releasing new resolver? HOT 2
- Windows: Comapre typing speed: xonsh 0.16.0 vs 0.18.2 HOT 29
- [docs] Cli command examples in guides should be fully copy&pasteable, i.e., without @
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from xonsh.