Skip to content

Type annotate some hookspecs & impls #6725

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

Closed
wants to merge 1 commit into from

Conversation

bluetech
Copy link
Member

Extracted from #6717.

Annotate some "easy" arguments of hooks that repeat in a lot of internal plugins.

Not all of the arguments are annotated fully for now.

def pytest_configure(config):
config.cache = Cache.for_config(config)
def pytest_configure(config: Config) -> None:
# Type ignored: pending mechanism to store typed objects scoped to config.
Copy link
Member Author

Choose a reason for hiding this comment

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

This repeats in several plugins. I have a simple plan for how to do it, but for now I added type-ignores.

@@ -510,13 +512,13 @@ def __init__(self, config):
)

log_file = get_option_ini(config, "log_file")
if log_file:
if not log_file:
Copy link
Member Author

Choose a reason for hiding this comment

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

Swapped the order so mypy can infer the type without an annotation.

Annotate some "easy" arguments of hooks that repeat in a lot of internal
plugins.

Not all of the arguments are annotated fully for now.
@bluetech bluetech closed this Feb 28, 2020
@bluetech bluetech deleted the hooks-annotate-1 branch February 28, 2020 12:08
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.

2 participants