Skip to content

Handle some Deprecations#10410

Merged
di merged 8 commits intopypi:mainfrom
miketheman:deprecations
Dec 1, 2021
Merged

Handle some Deprecations#10410
di merged 8 commits intopypi:mainfrom
miketheman:deprecations

Conversation

@miketheman
Copy link
Copy Markdown
Member

@miketheman miketheman commented Nov 26, 2021

When running the test suite, I saw a bunch of deprecation warnings that looked to be relatively minimal to handle, so took a shot and cleaning up some of the output.

Each commit contains some text as to the change, and any links I could dig up with references to the source.

Reduced 175 warnings emitted in CI to 156.

When collecting tests, this class raises a warning since it's named
`Test*`:

    PytestCollectionWarning: cannot collect test class 'TestAdminFlagValues'
    because it has a __new__ constructor

Set an attribute that informs pytest to ignore this class, and thus
remove the warning.

Refs: https://docs.pytest.org/en/6.2.x/example/pythoncollection.html#customizing-test-collection
(last lines)

Signed-off-by: Mike Fiedler <miketheman@gmail.com>
Current test warns:

    PytestDeprecationWarning: The --strict option is deprecated, use --strict-markers instead.

Marked as deprecated in pytest-dev/pytest#7985
Released in pytest 6.2.0

Signed-off-by: Mike Fiedler <miketheman@gmail.com>
The import paths for these modules has changed in Pyramid 2.0, and
raises warnings.
There are other Pyramid 2.0 warnings, but are more involved than
changing an import path, and should be addressed as another commit.

Refs: Pylons/pyramid#3563

Signed-off-by: Mike Fiedler <miketheman@gmail.com>
A few instances of this warning are raised:

    DeprecationWarning: 'contextfilter' is renamed to 'pass_context',
    the old name will be removed in Jinja 3.1.

Replace the usages accordingly.

Refs: pallets/jinja#1389

Signed-off-by: Mike Fiedler <miketheman@gmail.com>
The pass-through import of markup.Markup() has been deprecated in Jinja
3.0, and will be removed in Jinja 3.1. Warnings raised:

    DeprecationWarning: 'jinja2.Markup' is deprecated and will be removed in Jinja 3.1.
    Import 'markupsafe.Markup' instead.

Replace the import paths.

TODO: Determine if the requirements/main.in needs to be changed as well.

Refs: pallets/jinja#1391

Signed-off-by: Mike Fiedler <miketheman@gmail.com>
Warnings raised:

    DeprecationWarning: Use babel.numbers.format_decimal() instead.

Deprecated since 2.6.0

Refs: python-babel/babel#538

Signed-off-by: Mike Fiedler <miketheman@gmail.com>
@di di merged commit 4d4c794 into pypi:main Dec 1, 2021
@di
Copy link
Copy Markdown
Member

di commented Dec 1, 2021

Thanks @miketheman! If you wanted to continue farther down this path, #9707 might be a good next issue (there is a start at #9712 but it seems to have stalled).

@miketheman miketheman deleted the deprecations branch December 1, 2021 01:40
domdfcoding pushed a commit to domdfcoding/warehouse that referenced this pull request Jun 7, 2022
* Fix PytestCollectionWarning

When collecting tests, this class raises a warning since it's named
`Test*`:

    PytestCollectionWarning: cannot collect test class 'TestAdminFlagValues'
    because it has a __new__ constructor

Set an attribute that informs pytest to ignore this class, and thus
remove the warning.

Refs: https://docs.pytest.org/en/6.2.x/example/pythoncollection.html#customizing-test-collection
(last lines)

Signed-off-by: Mike Fiedler <miketheman@gmail.com>

* Fix PytestDeprecationWarning

Current test warns:

    PytestDeprecationWarning: The --strict option is deprecated, use --strict-markers instead.

Marked as deprecated in pytest-dev/pytest#7985
Released in pytest 6.2.0

Signed-off-by: Mike Fiedler <miketheman@gmail.com>

* Fix DeprecationWarning pyramid import

The import paths for these modules has changed in Pyramid 2.0, and
raises warnings.
There are other Pyramid 2.0 warnings, but are more involved than
changing an import path, and should be addressed as another commit.

Refs: Pylons/pyramid#3563

Signed-off-by: Mike Fiedler <miketheman@gmail.com>

* Fix DeprecationWarning for jinja.contextfilter

A few instances of this warning are raised:

    DeprecationWarning: 'contextfilter' is renamed to 'pass_context',
    the old name will be removed in Jinja 3.1.

Replace the usages accordingly.

Refs: pallets/jinja#1389

Signed-off-by: Mike Fiedler <miketheman@gmail.com>

* Fix DeprecationWarning for jinja.Markup

The pass-through import of markup.Markup() has been deprecated in Jinja
3.0, and will be removed in Jinja 3.1. Warnings raised:

    DeprecationWarning: 'jinja2.Markup' is deprecated and will be removed in Jinja 3.1.
    Import 'markupsafe.Markup' instead.

Replace the import paths.

TODO: Determine if the requirements/main.in needs to be changed as well.

Refs: pallets/jinja#1391

Signed-off-by: Mike Fiedler <miketheman@gmail.com>

* Fix DeprecationWarning for babel.numbers.from_number

Warnings raised:

    DeprecationWarning: Use babel.numbers.format_decimal() instead.

Deprecated since 2.6.0

Refs: python-babel/babel#538

Signed-off-by: Mike Fiedler <miketheman@gmail.com>

Co-authored-by: Dustin Ingram <di@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants