-
-
Notifications
You must be signed in to change notification settings - Fork 32.2k
[2.7] bpo-36234: test_os: check TypeError for invalid uid type #12235
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
Conversation
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.
LGTM, I think that we could use context for some raises. What do you think @vstinner ?
self.assertRaises(OverflowError, os.setegid, 1<<32) | ||
|
||
@unittest.skipUnless(hasattr(os, 'setreuid'), 'test needs os.setreuid()') | ||
def test_setreuid(self): | ||
if os.getuid() != 0: | ||
self.assertRaises(os.error, os.setreuid, 0, 0) | ||
self.assertRaises(TypeError, os.setreuid, 'not an int', 0) |
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.
why don't use context?
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.
Which context? Context of what?
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.
Sorry, something like this:
with self.assertRaises(TypeError):
os.setreuid(...)
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.
It's basically the same. Both variants are used in Python test suite. Here I just applied David's patch to make it upstream.
See also PR #12234 for the mastesr branch. |
Patch written by David Malcolm. Co-Authored-By: David Malcolm <dmalcolm@redhat.com>
I modified the NEWS entry to add "Patch written by David Malcolm." I forgot to credit David there! |
Upstreamed patches: - 157: python/cpython#12235 - 168: python/cpython#12349 Rebased patches: - 189: updated bundles setuptools/pip versions
Patch written by David Malcolm.
Co-Authored-By: David Malcolm dmalcolm@redhat.com
https://bugs.python.org/issue36234