Skip to content

Conversation

@bluetech
Copy link
Member

This is some work per comment #8405 (comment).

The first commit removes the _ from the TypeVars.

The third commit exposes ExceptionInfo (cc #7469). I still need to figure out how to get sphinx to use the public names but ran out of time for today (I also opened some sphinx issues).

The prefixes make the API Reference docs (for e.g. `pytest.raises`,
`pytest.fixture`) uglier.

Being under `_pytest` is sufficient from a privacy perspective, so let's
drop them.
No such thing as `_pytest._code.AssertionError`, it's just the built-in
`AssertionError`.
This type is most prominent in `pytest.raises` and we should allow to
refer to it by a public name.

The type is not in a perfectly "exposable" state. In particular:

- The `traceback` property with type `Traceback` which is derived from
  the `py.code` API and exposes a bunch more types transitively. This
  stuff is *not* exported and probably won't be.

- The `getrepr` method which probably should be private.

But they're already used in the wild so no point in just hiding them
now.

The __init__ API is hidden -- the public API for this are the `from_*`
classmethods.
@bluetech bluetech force-pushed the rm-typevar-prefix branch from 610c625 to f2d65c8 Compare March 13, 2021 14:00
Copy link
Member

@nicoddemus nicoddemus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

I still need to figure out how to get sphinx to use the public names but ran out of time for today

Feel free to merge as is. 👍

@RonnyPfannschmidt
Copy link
Member

If worst comes to worse, let's just assign the classes module as pytest

@bluetech bluetech merged commit db539ed into pytest-dev:main Mar 13, 2021
@bluetech
Copy link
Member Author

If worst comes to worse, let's just assign the classes module as pytest

Do you mean like ExceptionInfo.__module__ = 'pytest'? Didn't even cross my mind 😀 Seems like something better avoided but I'll keep it in mind as a last resort (if it manages to fool sphinx).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants