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
Do not attempt to write out a depfile on failure #5291
Conversation
This would be pretty useless as it cannot be used -- the output file does not exist either. But as it happens, on error, the output file is reset to None, so instead we triggered a python traceback while trying to write a depfile for `os.path.relpath(None, cwd)` that was written to `None+'.dep'`
Seems worth adding a simple test for this where we try to compile an invalid module and check for the depfile afterwards. |
Wouldn't the test pass before this change anyway? The depfile can't be created, this PR just avoids an internal error caused by trying. |
@eli-schwartz we can do a test that checks whether compilation fails but cython output does not contain
Following test fails on the master and pass on the PR branch. |
We could, yes, but is it standard practice to create unittests to check whether a traceback occurs? Because that was my whole question -- not how to test it, but whether there is something worth testing. (Especially considering that as a test suite grows larger, its runtime gets longer, and for a project where the tests involve forking the cost of new tests are disproportionate.) If that's something the cython project wants, I'm happy to oblige, but I don't want to assume (especially since in my own projects I'd prefer to avoid such tests). |
We can not fork but cythonize in the test code, for example |
Exactly. :) And this isn't a change in expected behavior, and the user doesn't stop being able to do something... it's just testing whether something that fails, does so with a proper error message or else with a confusing internal error in the teardown handling code. There's no detectable difference between the two other than scanning stderr (the failing return code is the same, the absence of output files is the same) which is why the suggested test case has to hardcode the word "Traceback" in it. |
Ok, I see now |
Thanks |
This would be pretty useless as it cannot be used -- the output file does not exist either. But as it happens, on error, the output file is reset to None, so instead we triggered a python traceback while trying to write a depfile for `os.path.relpath(None, cwd)` that was written to `None+'.dep'`
This would be pretty useless as it cannot be used -- the output file does not exist either. But as it happens, on error, the output file is reset to None, so instead we triggered a python traceback while trying to write a depfile for
os.path.relpath(None, cwd)
that was written toNone+'.dep'
Discovered when trying to help debug pandas-dev/pandas#49115 (comment)