[2.7] bpo-36234: test_os: check TypeError for invalid uid type by vstinner · Pull Request #12235 · python/cpython

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?

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?

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(...)

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.