-
Notifications
You must be signed in to change notification settings - Fork 19
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
[BUG] A reconstruct() call alters the sys.stdout #125
Comments
Thank you for pointing this issue. However I am afraid this isn't related to pysap-mri. Here is some more details: https://intellij-support.jetbrains.com/hc/en-us/community/posts/360000019990-Unittest-Error-AttributeError-file-object-has-no-attribute-getvalue- Can you please run the test from terminal and not use pycharm to ensure that pysap-mri isn't causing it? From what I see, the same tests pass at CI, hence I am closing this issue here. Feel free to ping here if you still have the issues. |
Also, which version of pycharm are you using? |
Hello @chaithyagr , The problem is not related to PyCharm.
the reconstruct() function introduces something wrong for the sys.stdout interpretation by xmlrunner afterwards. Patrick |
Reopening this here, will have a look to be sure |
Can you please post how did you run the test, also which particular test is failing. The stacktrace given above indicates the issue is in xmlrunner more than pysap-mri. Further, I could run all the tests locally and also we have successful test at travis CI here |
I am sorry, I can't do it (reasonably). |
I understand that. However, I am sorry but without a minimum reproducible example, I cant be able to reproduce and hence fix the bug, that too if any. I am quite confident the codes at pysap-mri is fine as it is constantly used by many users and also the codes are constantly tested with rigid CI pipelines. If possible, please do try to setup a minimum reproducible example which isnt directly related to your internal codes. Or you can send in an email with the minimum reproducible codes if you are comfortable with it. |
Hello, Maybe it could be relevant to do the same for the other optimisers, if not :) |
Sure, I can take some time and open a PR for this. While I still don't understand how this can cause that issue, it surely can be a good feature to add. |
Thank you for helping with this. |
Hello,
I am working on a pysap test with unitest.
But my unitest can't be correctly executed due to the following AttributeError:
File "/home/300.86-METRO_CARAC/PYTHON/miniconda3/lib/python3.7/unittest/case.py", line 647, in run
result.stopTest(self)
File "/home/300.86-METRO_CARAC/PYTHON/pycharm-community-2021.1.2/plugins/python-ce/helpers/pycharm/teamcity/unittestpy.py", line 263, in stopTest
output = sys.stdout.getvalue()
AttributeError: '_io.TextIOWrapper' object has no attribute 'getvalue'
This error is related to a
mri.reconstructors.base.ReconstructorBase.reconstruct()
function call.When this function is not called, the sys.stdout is :
and the unitest is correctly executed.
But when this function is called, the sys.stdout becomes :
and the unitest goes wrong (AttributeError).
Could you please investigate and fix this ?
(this could be related to the buffer or a file not correctly closed when passing in the reconstruct() function ?)
Note : The following workaround which consists in :
after calling the function didn't work for me.
Thank you,
Patrick
The text was updated successfully, but these errors were encountered: