pytest-mypy-plugins icon indicating copy to clipboard operation
pytest-mypy-plugins copied to clipboard

Delegate interpreting the yaml away from collection

Open delfick opened this issue 1 year ago • 0 comments

For https://github.com/typeddjango/pytest-mypy-plugins/issues/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.

delfick avatar May 04 '24 13:05 delfick