tantale / deprecated

Python @deprecated decorator to deprecate old python classes, functions or methods.
MIT License
298 stars 32 forks source link

1.2.13: pytest warnings #56

Closed kloczek closed 1 year ago

kloczek commented 2 years ago

I'm trying to package your module as an rpm package. So I'm using the typical PEP517 based build, install and test cycle used on building packages from non-root account.

Here is pytest output:

+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-deprecated-1.2.13-5.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-deprecated-1.2.13-5.fc35.x86_64/usr/lib/python3.8/site-packages
+ /usr/bin/pytest -ra
=========================================================================== test session starts ============================================================================
platform linux -- Python 3.8.13, pytest-7.1.2, pluggy-1.0.0
rootdir: /home/tkloczko/rpmbuild/BUILD/deprecated-1.2.13, configfile: setup.cfg
collected 159 items

tests/test.py ..                                                                                                                                                     [  1%]
tests/test_deprecated.py .........................................                                                                                                   [ 27%]
tests/test_deprecated_class.py .......                                                                                                                               [ 31%]
tests/test_deprecated_metaclass.py ....                                                                                                                              [ 33%]
tests/test_sphinx.py ..................................................................................                                                              [ 85%]
tests/test_sphinx_adapter.py ............                                                                                                                            [ 93%]
tests/test_sphinx_class.py .......                                                                                                                                   [ 97%]
tests/test_sphinx_metaclass.py ....                                                                                                                                  [100%]

============================================================================= warnings summary =============================================================================
tests/test_deprecated_class.py::test_simple_class_deprecation_with_args
  /home/tkloczko/rpmbuild/BUILD/deprecated-1.2.13/tests/test_deprecated_class.py:148: DeprecationWarning: Call to deprecated class MyClass. (kwargs class)
    MyClass(5)

tests/test_sphinx_class.py::test_isinstance_deprecated
  /home/tkloczko/rpmbuild/BUILD/deprecated-1.2.13/tests/test_sphinx_class.py:134: DeprecationWarning: Call to deprecated class DeprecatedChildCls. (some reason) -- Deprecated since version Y.Z.
    instance = DeprecatedChildCls()

tests/test_sphinx_class.py::test_isinstance_deprecated
  /home/tkloczko/rpmbuild/BUILD/deprecated-1.2.13/deprecated/classic.py:173: DeprecationWarning: Call to deprecated class DeprecatedCls. (some reason) -- Deprecated since version X.Y.
    return old_new1(cls, *args, **kwargs)

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
===================================================================== 159 passed, 3 warnings in 0.44s ======================================================================
tantale commented 1 year ago

I'm sorry, but I don't reproduce this anomaly. I think it's fixed in the version v1.2.14 that I've just published.

I'm closing this issue, but you can reopen it if necessary. In this case, please describe precisely the steps to reproduce the problem.

kloczek commented 1 year ago

Just tested 1.2.14 and warnings are still present.

+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-deprecated-1.2.14-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-deprecated-1.2.14-2.fc35.x86_64/usr/lib/python3.8/site-packages
+ /usr/bin/pytest -ra -m 'not network'
============================= test session starts ==============================
platform linux -- Python 3.8.16, pytest-7.3.1, pluggy-1.0.0
rootdir: /home/tkloczko/rpmbuild/BUILD/deprecated-1.2.14
configfile: setup.cfg
collected 171 items

tests/test.py ..                                                         [  1%]
tests/test_deprecated.py .........................................       [ 25%]
tests/test_deprecated_class.py .......                                   [ 29%]
tests/test_deprecated_metaclass.py ....                                  [ 31%]
tests/test_sphinx.py ................................................... [ 61%]
...........................................                              [ 86%]
tests/test_sphinx_adapter.py ............                                [ 93%]
tests/test_sphinx_class.py .......                                       [ 97%]
tests/test_sphinx_metaclass.py ....                                      [100%]

=============================== warnings summary ===============================
../../../../../usr/lib/python3.8/site-packages/pkg_resources/__init__.py:121
  /usr/lib/python3.8/site-packages/pkg_resources/__init__.py:121: DeprecationWarning: pkg_resources is deprecated as an API
    warnings.warn("pkg_resources is deprecated as an API", DeprecationWarning)

../../../../../usr/lib/python3.8/site-packages/pkg_resources/__init__.py:2870
../../../../../usr/lib/python3.8/site-packages/pkg_resources/__init__.py:2870
../../../../../usr/lib/python3.8/site-packages/pkg_resources/__init__.py:2870
../../../../../usr/lib/python3.8/site-packages/pkg_resources/__init__.py:2870
../../../../../usr/lib/python3.8/site-packages/pkg_resources/__init__.py:2870
  /usr/lib/python3.8/site-packages/pkg_resources/__init__.py:2870: DeprecationWarning: Deprecated call to `pkg_resources.declare_namespace('sphinxcontrib')`.
  Implementing implicit namespace packages (as specified in PEP 420) is preferred to `pkg_resources.declare_namespace`. See https://setuptools.pypa.io/en/latest/references/keywords.html#keyword-namespace-packages
    declare_namespace(pkg)

tests/test_deprecated_class.py::test_simple_class_deprecation_with_args
  /home/tkloczko/rpmbuild/BUILD/deprecated-1.2.14/tests/test_deprecated_class.py:148: DeprecationWarning: Call to deprecated class MyClass. (kwargs class)
    MyClass(5)

tests/test_sphinx_class.py::test_isinstance_deprecated
  /home/tkloczko/rpmbuild/BUILD/deprecated-1.2.14/tests/test_sphinx_class.py:134: DeprecationWarning: Call to deprecated class DeprecatedChildCls. (some reason) -- Deprecated since version Y.Z.
    instance = DeprecatedChildCls()

tests/test_sphinx_class.py::test_isinstance_deprecated
  /home/tkloczko/rpmbuild/BUILD/deprecated-1.2.14/deprecated/classic.py:173: DeprecationWarning: Call to deprecated class DeprecatedCls. (some reason) -- Deprecated since version X.Y.
    return old_new1(cls, *args, **kwargs)

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
======================= 171 passed, 9 warnings in 0.42s ========================

You need setuptools 67.x.