Skip to content
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

Delegate interpreting the yaml away from collection #152

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

delfick
Copy link
Contributor

@delfick delfick commented May 4, 2024

For #144 I think it'll be useful if the yaml definition can be given more control over how the test actually runs it.

To help with that this PR makes it so that the pytest entry point is less responsible for those decisions, and that there is more separation between the raw definition and the processed idea of what the test should do.

I've split this PR into many commits to make it easier to see the small changes that happen as I move code around (best seen with the github ignore whitespace option).

The notable changes include

  • File is now defined in pytest_mypy_plugins.definition, but I've kept a reference to it from pytest_mypy_plugins.collect
  • When creating the File objects, it dosn't default path to "main.py" because it's mandatory in the schema so it should always have a value anyways
  • I made the skip logic not call eval if skip is a boolean or the strings "True" or "False"
  • made test_input_schema.py use SafeLineLoader
  • Changed the return annotations on the plugin entry point to be less specific as only pytest itself use them and it only cares about the more generic type
  • I changed how parse_parametrized works, I don't have strong opinions if the previous implementation is preferred.

Couple of unused imports and legacy fspath

These were missed in that PR that removed support for pytest 6.x
@delfick delfick force-pushed the schema/split-from-execution branch from bb170be to 3a39532 Compare May 4, 2024 13:21
This will make it easier to make the yaml able to do determine different
things to be done when the test is run
It doesn't need to be accessed outside this module

Also make File match the json schema we have (content is optional and
defaults to empty, path is mandatory)
Also some changes to types and how parsing parametrized is implemented
We want to split up turning the raw item into a pytest.Item
This stayed as long as it did to make the git diff a bit more useful
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant