Repository navigation
current workaround #4792 for appveyor python 3.5 does not work correctly - #4793
Conversation
|
I've pushed a "fix" and included a test that the extra function calls are unnecessary. Since this might be objectionable I haven't deleted these functions yet but included a test with Warning in case I've missed some input that actually looses his Since I had problems setting up the tests with file-creation and teardown in the And I'm very sorry that the previous PR didn't work out. Maybe it would have worked out but since the calculation was flawed and I always got the result that it's not in append-mode it was certainly not a good PR. |
|
That's amazing ... the first commit did fail because of an unrelated error. 😄 so much for the "proof"... |
|
|
||
| def test_append_mode_is_determined_correctly(self, tmpdir): | ||
| # TODO: Move this test in test_util as soon as I figure out how to | ||
| # setup a class with tmpdir... |
There was a problem hiding this comment.
I use temporary directory in astropy/vo/validator/tests/test_validate.py. Something like
import shutil
import tempfile
class TestConeSearchValidation(object):
def setup_class(self):
self.out_dir = tempfile.mkdtemp()
def teardown_class(self):
shutil.rmtree(self.out_dir)Is this what you are looking for?
There was a problem hiding this comment.
That looks promising. I'll try to setup an own test-class for these test. Thank you.
|
I know this will be a very tough review - it took me quite a while to figure out what happens in there - but I would be very happy if anyone would volunteer. I've tried to make the first two comments of this PR as informative as possible but if something seems strange please ask and I'll try to explain. |
| # TODO: This is probably superfluous the old corner cases where FILEIO | ||
| # objects didn't keep track of their append-flag are over (?) | ||
| # At least the bugfix was ported to python 2.7 and 3.3+: | ||
| # http://bugs.python.org/issue18876 |
There was a problem hiding this comment.
Just for info, we do indeed only support Python 2.7 and 3.3+
There was a problem hiding this comment.
the warning is for cases I might have forgotten (the most common ones: pil, gzip, fileio, hdulist are covered in the tests) that still forget if they are opened in append-mode. These shouldn't exist anymore but better to have some kind of grace-period where users might get this warning.
|
@embray ? |
|
I looked over the code and it seems OK to me, but I have to admit I don't understand the guts too well. I do think in general it is a good idea to try to simplify rather than leave code in place as we feel we do not understand it well enough to be sure we can remove it. If we are wrong, this is of course unfortunate, but then at least we can have a test case that ensures it keeps being right (and I think the new test cases here are quite exhaustive!). |
|
@mhvk Thank you for reviewing it. So you would suggest removing the (probably) unnessary functions? |
Yes. |
I'm not sure: Should I just go ahead and delete it or wait? |
|
Ideally, @astrofrog pipes in too, but I think you added such good testing that I'm comfortable merging it (with -- I hope I won't come to regret it -- the unnecessary functions removed -- I think we should understand for all our code why it is there). |
|
Ok if no one disputs your opinion I'll remove the (probably) unnecessary function that manually checks if a file is opened in append mode and do a push sometime this weekend. I hope you don't mind that I ping you: @embray @astrofrog @eteq |
|
I think somewhere during this PR I've messed something up or did some dubious merge. I had to force push this commit. Probably because I did some local merges with test-branches. How do I resolve such problems? Is there a general way? |
|
@MSeifert04 - I don't think there is anything wrong with force push. At least, I do them all the time; I think one more or less has to if one rebases on master, or amends a commit. |
|
@mhvk Okay, I was amending so that explains it. Thank you |
| test_core.TestConvenienceFunctions.test_fileobj_mode_guessing | ||
| but added some low-level tests as well. | ||
|
|
||
| TODO: These are regression tests for |
There was a problem hiding this comment.
Why is this marked as a TODO?
There was a problem hiding this comment.
Because first I had no regression test for the workaround fail and made this TODO, then I inserted the regression test but after @mhvk said I should delete the "unnecessary" functions I deleted the test again. Long story short: I'll delete the TODO. I thought I caught all of these in the recent cleanup commit. Thanks
|
Apart from my comment above, I think this looks good. @embray - would you be able to just confirm that this is ok? |
|
@astrofrog do I need to write a Changelog? or for that matter will it be part of 1.2? |
|
@embray Do you think removing this workaround is ok or could there still be objects which not track their @astrofrog I don't want to disturb you but will this be in 1.2 and does it need a changelog? |
|
This has been "ready-for-final-review" for a while now. Anyone interested in doing that final review? |
|
bump |
|
I think we're still waiting for a final nod from @embray |
|
Should I rebase this now or wait for the nod/review? |
|
Maybe rebase first, in case you need to change something due to conflict? |
- included an roundtripping test that the extra functions might be unneccessary.
|
was just a trivial change that triggered the conflict. |
|
@pllim Could you restart the coverage test? It got stuck inside some On a side note: I could have sworn I was able to restart jobs on Travis last week. 😕 |
|
@MSeifert04 , it is restarted. Are you logged into Travis? Sometimes you have to log in again. Otherwise, maybe @astrofrog can check if you still have access. |
astrofrog
left a comment
There was a problem hiding this comment.
This has been open for a while, and no one has objected. I agree with @mhvk that the testing is extensive enough that I think it's unlikely this will break anything on supported versions of Python. Even in the unlikely case that this produces regressions, we do still have the option of reverting the changes later on, so I think we should go ahead and merge.
|
@astrofrog - thanks for merging this! However, I noticed the following issues with this pull request:
Would it be possible to fix these? Thanks! This is an experimental bot being written by @astrofrog - let me know if the message above is incorrect! |
|
Thanks @MSeifert04! |
|
Changelog entry added in f8aa9f8 |
|
👍 🎉 @astrofrog Thanks for adding the changelog entry. |
I thought #4792 might be a good idea and at least the tests are passing but inside this workaround just hides the error message. So I dug a bit deeper and I found out that the function
io.fits.util._is_append_mode_platformwas just a workaround becausepython.io.FitsIO-Instances lost their"a"-mode. This has been fixed for a while and ported to all supported python versions 2.7 and 3.3+Then I tried some things one could put into
io.fits.openand noticed that on my machine the function call was unnecessary for all things I could think of (also including some things I wouldn't have thought of).So this first commit is a test-case that fails with the "fix" from #4792 . It fails because depending on the built the ctypes.cdll.mscvrt is outdated and contains other constants than the msvcrt that python uses. These constants are hidden since msvc 14 and are unlikely to be exported again.
I'll submit another commit shortly that (hopefilly) shows that the extra-functions are unnecessary since there is no lost
"a"-mode anymore and even if a file-handle would lose it it's unlikely to be recovered by the current function.