-
Notifications
You must be signed in to change notification settings - Fork 515
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
Fix deprecation warnings #2756
Fix deprecation warnings #2756
Conversation
Some people just want to watch the world burn, and they merge 2500 deprecation warnings into main. 🔥 |
eaae562
to
5639b28
Compare
5639b28
to
c8bdbf4
Compare
@dbluhm I've added the following to the pyproject.toml: [tool.pytest.ini_options]
filterwarnings = [
'ignore:distutils Version classes are deprecated. Use packaging.version instead.:DeprecationWarning', # Ignore specific DeprecationWarning for old packages using distutils version class
] This specifically ignores warning related to the old way of reading versions, used in some old external packages. Also, So, you'll notice I added warning ignore conditions to PR test output: 4836 passed, 290 skipped, 6 xfailed in 205.33s (0:03:25) No warnings! It's now optional to raise errors for any extra warnings that come up -- in which case they will have to be solved, or explicitly ignored as well. If we opt for this, to raise error on warnings, then I can remove that workflow edit which explicitly errors on coroutine not awaited. I think that's preferable, but all contributors will have to be on the same page, that warnings must now be solved or ignored. Let me know what you think! |
Nice! I agree, failing on new warnings seems preferable to checks for specific warnings. We will have the maintainers meeting tomorrow. I suspect there will be little controversy given that these sorts of warnings can hide test failures but I will bring this up on that call to get everyone on the same page. cc @swcurran |
@dbluhm awesome - I'll add the "error on warning" option in the meantime. Can review after the aca-pug meeting 👍 |
Note: when I test locally, there's some warnings that raise errors, even though the warning was not logged previously: Running with pytest 7.4, it's a There's about 30 such errors... Very strange. When I run without the "error on warning" config, then it doesn't print any warnings. So it seems there are some test teardown issues which are being absorbed, and they manifest when the error config is active. I'll see what I can figure out, but may be some extra steps required to properly add the "error on warning" config. Edit:
|
78c0e8d
to
59356aa
Compare
Not a pretty solution, but I can just ignore the PluggyTeardownRaisedWarning and PytestUnraisableExceptionWarning. Instead, I'll see if I can figure out what's wrong with the teardown logic, e.g.: Traceback (most recent call last):
File "/opt/hostedtoolcache/Python/3.9.18/x64/lib/python3.9/unittest/mock.py", line 2058, in _mock_set_magics
setattr(_type, entry, MagicProxy(entry, self))
ResourceWarning: unclosed <socket.socket fd=12, family=AddressFamily.AF_UNIX, type=SocketKind.SOCK_STREAM, proto=0>
FAILED aries_cloudagent/messaging/jsonld/tests/test_routes.py::TestJSONLDRoutes::test_register - pytest.PytestUnraisableExceptionWarning: Exception ignored in: <socket.socket fd=-1, family=AddressFamily.AF_UNIX, type=SocketKind.SOCK_STREAM, proto=0> |
b010960
to
40f8529
Compare
@dbluhm nope, I tried both pytest 7 and 8, same behaviour of no warnings until the error config is added. Some of the errors are non-deterministic, due to resources not being closed properly across tests. E.g. running all tests will yield ~30 errors; running those tests individually raise no errors; and then running specific modules may vary which exact test is raising the error. So it's not so straightforward... the logs don't help isolate which resource is causing the problem. Best I could figure out is that AioHTTPTestCase may be preferable to use in some modules, because it defines some built in teardown logic for testing aiohttp web.Applications. But I couldn't make headway, plugging away at it myself. I think it's reasonable to put the error-on-warning config on the back burner for now, because it will require some more investigation and broader test refactoring. Also because to add the ignore condition, to solve these teardown issues, is a very generic ignore condition, which may obfuscate other legitimate warnings. So I think this is good enough for now just to fix all warnings, and then future PR test logs can more easily be reviewed to catch any new warnings that may be introduced |
Signed-off-by: ff137 <[email protected]>
…h importlib Signed-off-by: ff137 <[email protected]>
Signed-off-by: ff137 <[email protected]>
Signed-off-by: ff137 <[email protected]>
Signed-off-by: ff137 <[email protected]>
Signed-off-by: ff137 <[email protected]>
Signed-off-by: ff137 <[email protected]>
Signed-off-by: ff137 <[email protected]>
Signed-off-by: ff137 <[email protected]>
Signed-off-by: ff137 <[email protected]>
Signed-off-by: ff137 <[email protected]>
Signed-off-by: ff137 <[email protected]>
Signed-off-by: ff137 <[email protected]>
Signed-off-by: ff137 <[email protected]>
Signed-off-by: ff137 <[email protected]>
Signed-off-by: ff137 <[email protected]>
40f8529
to
dfd829d
Compare
- Configure Dependabot to automatically maintain dependencies for GitHub Actions. - Check for updates once a week. - Group all updates into a single PR. Signed-off-by: Wade Barnes <[email protected]>
Bumps the all-actions group with 10 updates: | Package | From | To | | --- | --- | --- | | [actions/checkout](https://github.com/actions/checkout) | `2` | `4` | | [actions/setup-python](https://github.com/actions/setup-python) | `4` | `5` | | [psf/black](https://github.com/psf/black) | `24.1.1` | `24.2.0` | | [github/codeql-action](https://github.com/github/codeql-action) | `2` | `3` | | [pypa/gh-action-pip-audit](https://github.com/pypa/gh-action-pip-audit) | `1.0.0` | `1.0.8` | | [actions/cache](https://github.com/actions/cache) | `3` | `4` | | [docker/setup-buildx-action](https://github.com/docker/setup-buildx-action) | `2` | `3` | | [docker/login-action](https://github.com/docker/login-action) | `2` | `3` | | [docker/metadata-action](https://github.com/docker/metadata-action) | `4` | `5` | | [docker/build-push-action](https://github.com/docker/build-push-action) | `3` | `5` | Updates `actions/checkout` from 2 to 4 - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](actions/checkout@v2...v4) Updates `actions/setup-python` from 4 to 5 - [Release notes](https://github.com/actions/setup-python/releases) - [Commits](actions/setup-python@v4...v5) Updates `psf/black` from 24.1.1 to 24.2.0 - [Release notes](https://github.com/psf/black/releases) - [Changelog](https://github.com/psf/black/blob/main/CHANGES.md) - [Commits](psf/black@24.1.1...24.2.0) Updates `github/codeql-action` from 2 to 3 - [Release notes](https://github.com/github/codeql-action/releases) - [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md) - [Commits](github/codeql-action@v2...v3) Updates `pypa/gh-action-pip-audit` from 1.0.0 to 1.0.8 - [Release notes](https://github.com/pypa/gh-action-pip-audit/releases) - [Commits](pypa/gh-action-pip-audit@v1.0.0...v1.0.8) Updates `actions/cache` from 3 to 4 - [Release notes](https://github.com/actions/cache/releases) - [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md) - [Commits](actions/cache@v3...v4) Updates `docker/setup-buildx-action` from 2 to 3 - [Release notes](https://github.com/docker/setup-buildx-action/releases) - [Commits](docker/setup-buildx-action@v2...v3) Updates `docker/login-action` from 2 to 3 - [Release notes](https://github.com/docker/login-action/releases) - [Commits](docker/login-action@v2...v3) Updates `docker/metadata-action` from 4 to 5 - [Release notes](https://github.com/docker/metadata-action/releases) - [Upgrade guide](https://github.com/docker/metadata-action/blob/master/UPGRADE.md) - [Commits](docker/metadata-action@v4...v5) Updates `docker/build-push-action` from 3 to 5 - [Release notes](https://github.com/docker/build-push-action/releases) - [Commits](docker/build-push-action@v3...v5) --- updated-dependencies: - dependency-name: actions/checkout dependency-type: direct:production update-type: version-update:semver-major dependency-group: all-actions - dependency-name: actions/setup-python dependency-type: direct:production update-type: version-update:semver-major dependency-group: all-actions - dependency-name: psf/black dependency-type: direct:production update-type: version-update:semver-minor dependency-group: all-actions - dependency-name: github/codeql-action dependency-type: direct:production update-type: version-update:semver-major dependency-group: all-actions - dependency-name: pypa/gh-action-pip-audit dependency-type: direct:production update-type: version-update:semver-patch dependency-group: all-actions - dependency-name: actions/cache dependency-type: direct:production update-type: version-update:semver-major dependency-group: all-actions - dependency-name: docker/setup-buildx-action dependency-type: direct:production update-type: version-update:semver-major dependency-group: all-actions - dependency-name: docker/login-action dependency-type: direct:production update-type: version-update:semver-major dependency-group: all-actions - dependency-name: docker/metadata-action dependency-type: direct:production update-type: version-update:semver-major dependency-group: all-actions - dependency-name: docker/build-push-action dependency-type: direct:production update-type: version-update:semver-major dependency-group: all-actions ... Signed-off-by: dependabot[bot] <[email protected]>
Yes. I'll go over it. I'd like to get this completed. It will keep having merge conflicts. |
LGTM 👍 |
Argh... conflicts to be resolved. Sorry about that. |
Signed-off-by: ff137 <[email protected]>
285e069
to
8822abb
Compare
Quality Gate passedIssues Measures |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM says @jamshale — good enough for me :-)
Main changes are replacing pkg_resources with importlib, in config/logging.py and utils/classloader.py. Looks like a lot! But that's it - resolves PR tests from printing ~2500 warnings, now it's 0 :-) |
HUGE! Thanks! |
Such as:
DeprecationWarning: pkg_resources is deprecated as an API
importlib
RemovedInMarshmallow4Warning: Passing field metadata as keyword arguments is deprecated. Use the explicit
metadata=...argument instead.
DeprecationWarning
sjsonpath-ng
,Markdown
, andrlp
Large batch of pytest related warnings fixed in #2755 and #2764
The following warning is now ignored globally, as set in pyproject toml:
This is because quite a few external dependencies still use the old way of reading versions.
Also, test_admin_server was the primary source of other warnings, thanks to packages: apispec, aiohttp_apispec, and aiohttp_cors. We're on older versions for those packages (only the _cors one seems to not be maintained anymore), and they either raise warnings related to distutils or Marshmallow, or they complain about "NotAppKeyWarning: It is recommended to use web.AppKey instances for keys.". I tried to solve this latter warning, but couldn't quite figure it out. I think it's so minor it's fine to just ignore.
So, you'll notice I added warning ignore conditions to test_admin_server as well. And ... that seems to solve every single warning!
PR test output:
4836 passed, 290 skipped, 6 xfailed in 205.33s (0:03:25)
No more warnings! 🎉