simplistix / sybil

Automated testing for the examples in your documentation.
https://sybil.readthedocs.io/en/latest/
Other
74 stars 14 forks source link

Avoid using py.path.local #89

Closed adamtheturtle closed 1 year ago

adamtheturtle commented 1 year ago

If using py.path.local, we will have to skip errors regarding py.path for mypy. I chose to propose this change instead, as py.path.local is not the modern solution - pathlib.Path is.

The mypy errors that this removes:

sybil/integration/pytest.py:15: error: Skipping analyzing "py.path": module is installed, but missing library stubs or py.typed marker  [import-untyped]
sybil/integration/pytest.py:15: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports
sybil/integration/pytest.py:15: error: Skipping analyzing "py": module is installed, but missing library stubs or py.typed marker  [import-untyped]

In pytest 7.0.0, there were changes made which make this change possible.

See https://docs.pytest.org/en/7.1.x/changelog.html#id48. That changelog includes:

and:


pytest_collect_file - The file_path parameter (equivalent to existing path parameter).

I also brought in the exact type hint from the parent class's reportinfo method.

I did not change any tests as these will not be type checked.