taverntesting / tavern

A command-line tool and Python library and Pytest plugin for automated testing of RESTful APIs, with a simple, concise and flexible YAML-based syntax
https://taverntesting.github.io/
MIT License
1.03k stars 195 forks source link

pytest_collect_file `fspath` deprecation warning #838

Closed ahebrank closed 1 year ago

ahebrank commented 1 year ago

When running with -W error::DeprecationWarning:

________________________________________________________________________________________________________________ ERROR collecting test session _________________________________________________________________________________________________________________
/var/www/.local/lib/python3.9/site-packages/pluggy/_hooks.py:265: in __call__
    return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult)
/var/www/.local/lib/python3.9/site-packages/pluggy/_manager.py:80: in _hookexec
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
/var/www/.local/lib/python3.9/site-packages/tavern/_core/pytest/hooks.py:44: in pytest_collect_file
    return YamlFile.from_parent(parent, fspath=path)
/var/www/.local/lib/python3.9/site-packages/_pytest/nodes.py:642: in from_parent
    return super().from_parent(parent=parent, fspath=fspath, path=path, **kw)
/var/www/.local/lib/python3.9/site-packages/_pytest/nodes.py:262: in from_parent
    return cls._create(parent=parent, **kw)
/var/www/.local/lib/python3.9/site-packages/_pytest/nodes.py:140: in _create
    return super().__call__(*k, **kw)
/var/www/.local/lib/python3.9/site-packages/tavern/_core/pytest/file.py:245: in __init__
    super().__init__(*args, **kwargs)
/var/www/.local/lib/python3.9/site-packages/_pytest/nodes.py:597: in __init__
    path = _imply_path(type(self), path, fspath=fspath)
/var/www/.local/lib/python3.9/site-packages/_pytest/nodes.py:110: in _imply_path
    warnings.warn(
E   pytest.PytestRemovedIn8Warning: The (fspath: py.path.local) argument to YamlFile is deprecated. Please use the (path: pathlib.Path) argument instead.
E   See https://docs.pytest.org/en/latest/deprecations.html#fspath-argument-for-node-constructors-replaced-with-pathlib-path

I think it just means the param key on https://github.com/taverntesting/tavern/blob/master/tavern/_core/pytest/hooks.py#L44 should change from fspath to path?

ahebrank commented 1 year ago

This may only happen with Python 3.9 so I'm going to close for now.