-
Notifications
You must be signed in to change notification settings - Fork 18
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
Handle pytest 5.4 deprecation to use Node.from_parent
#27
Conversation
Thank you! Dropping support for Python 2 and Pytest < 5.4 would be even harsher than what I did in #25 though. |
I wasn't totally sure when |
Maybe "use from_parent() except AttributeError: old way" will work? |
There would also need to be changes to |
Ok, looked into this a bit more. How about this: Remove the @classmethod
def from_parent(cls, parent, obj):
name = obj.__name__
try:
from_parent_super = super(DescribeBlock, cls).from_parent
except AttributeError: # PyTest < 5.4
self = cls(name, parent)
else:
self = from_parent_super(parent, name=name)
self._name = getattr(obj, '_mangled_name', name)
self.funcobj = obj
return self Then, in This works for me with all supported versions in #25. Eventually, we should of course desupport the legacy Python and Pytest versions. But for now, I think it would be nice to have a version that is a bit more backward compatible. |
Thanks for looking into the API a bit more! Maybe we should let @ropez decide? If they have limited bandwidth, perhaps trying to support anything other than the latest version of |
Even then, in order to test libraries that still need to support a broad range of Python versions, it would be nice to publish one last official release that supports that broad version range, and only then remove the Python 2 and older Pytest support, simplify the code for Python 3, and maybe release that as version 1.0 or so. We must not forget to adapt "install_requires" and the classifiers in setup.py when doing that. |
This has now been solved in with the alternative fix in 453aa90 that also provides backward compatibility, so we can close this now. |
Fixes #26
Depends on #25
In order to release this, I believe
pytest-describe
will need to officially drop support forpytest<5.4
, which will in turn require dropping support forpython<3.5
.To use this patch in your Poetry project, add the following to
pyproject.toml
: