-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix issue with basilisp test
standard streams output
#1082
Fix issue with basilisp test
standard streams output
#1082
Conversation
80a068d
to
0b88a04
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you'll need to rewrite the changes below in terms of push-thread-bindings
and pop-thread-bindings
because otherwise the changes you're pushing into *out*
and *err*
here won't be eligible for binding conveyance.
Updated. I've used list comprehension for brevity when creating the dictionary, but I can change it if you think it's not worth it. |
The report coverage failure doesn't seem to be related. It was unable to install |
It appears to be related to this: actions/runner-images#10781 (indeed unrelated to your changes). |
Good catch—talk about being at the forefront of cutting edge technology! 😅 A viable option could be to switch from ubuntu-latest to ubuntu-22.04 until a solution is proposed in that ticket, while maintaining the current status quo.. |
Hi,
can you please review patch to address the
basilisp test
failure on MS-Windows. It fixes #1080.The problem arises because pytest's mechanism for capturing standard streams during tests breaks when those streams are saved before pytest.main is called and then used in the test. This happens when running
basilisp test
from the CLI:In
basilisp.init
,sys.stdout
andsys.stderr
are saved to the*out*
and*err*
dynamic variables beforepytest.main
is called. If a test prints anything, it tries to write to these original streams, causing failures due to an issue I just reported in pytest-dev/pytest#12876.This patch rebinds
*out*
and*err*
to the streams set bypytest
and restores them whenpytest
finishes (via theconfigure
functions). I've tested it with a case that prints to*out*
and*err*
at the top level, inside a test, and inside a fixture, and it works as expected.I’d also like to discuss
Basilisp
integration tests, which I think the above testing falls under, though there’s currently no support for such tests inBasilisp
.Ideally I think, I would like to create a
Basilisp
project in a temporary directory, add the above test, install the fix alongsidepytest
, activate the environment, and then runbasilisp test
.Do you have any suggestions how to extend the
Basilisp
test suite to implement this? or shall I open a new ticket for this discussion? I was thinking of having a new--integration
pytest option for these tests, something I have been experimenting with in the basilisp-blender package.Thanks