Closed Antiz96 closed 2 weeks ago
This works on our CI. Not sure what might be different in your environment.
Could you add print(result.stderr)
to see if that produces any more information?
Ah wait. I see the error if I scroll right. This test is depending on textual being installed in the current environment. Can you install the package in your test runner?
Ah wait. I see the error if I scroll right. This test is depending on textual being installed in the current environment.
Indeed, I haven't paid attention to No module named \'textual\'\n').returncode
Can you install the package in your test runner?
The test env is also the build env (Arch packages are built in a clean chroot and the tests are ran right after the build in that same env). I'm afraid having the textual
package depending on itself for the tests to pass will go against our packaging guidelines (as said in this comment, that would be a "chicken-egg" problem).
I'll check if I can manage to make the tests use the path to the newly built binary (or add it to $PATH
locally during tests) on my side.
Presumably if I was to change the subprocess command to use {sys.executable}
rather than python
, that would ensure it is in the same environment?
I'm afraid I cannot say... But I'd be happy to test if you're able to provide a patch!
Can you give this a try?
diff --git a/tests/test_pipe.py b/tests/test_pipe.py
index 21329b302..92593ac4d 100644
--- a/tests/test_pipe.py
+++ b/tests/test_pipe.py
@@ -14,7 +14,8 @@ def test_deadlock():
"""Regression test for https://github.com/Textualize/textual/issues/4643"""
app_path = (Path(__file__) / "../deadlock.py").resolve().absolute()
result = subprocess.run(
- f'echo q | python "{app_path}"', shell=True, capture_output=True
+ f'echo q | "{sys.executable}" "{app_path}"', shell=True, capture_output=True
)
print(result.stdout)
+ print(result.stderr)
assert result.returncode == 0
Can you give this a try?
diff --git a/tests/test_pipe.py b/tests/test_pipe.py index 21329b302..92593ac4d 100644 --- a/tests/test_pipe.py +++ b/tests/test_pipe.py @@ -14,7 +14,8 @@ def test_deadlock(): """Regression test for https://github.com/Textualize/textual/issues/4643""" app_path = (Path(__file__) / "../deadlock.py").resolve().absolute() result = subprocess.run( - f'echo q | python "{app_path}"', shell=True, capture_output=True + f'echo q | "{sys.executable}" "{app_path}"', shell=True, capture_output=True ) print(result.stdout) + print(result.stderr) assert result.returncode == 0
Works! :tada:
Do you eventually intend to merge this on upstream side or do you prefer me to keep this patch on the Arch package side instead?
In any case, thanks a lot for you quick help! :pray:
No problem. I can push that to main now.
Alright, I patched https://github.com/Textualize/textual/commit/e9ad400559c14645e56b7a98a467295c6817686b into the v0.68.0 textual Arch package while waiting for a new release to include it. Thanks once again!
I guess this issue can be closed now :)
Don't forget to star the repository!
Follow @textualizeio for Textual updates.
Hi,
I'm trying to build v0.68.0 on Arch Linux using this PKGBUILD (which contains build and tests instructions) but the test_deadlock is failing with the following error:
Tests works with v0.67.1 though.
It's apparently related to https://github.com/Textualize/textual/issues/4643 & https://github.com/Textualize/textual/pull/4647
I remain available if any more info are needed :)