Skip to content
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 from test run #6

Open
nigini opened this issue Jul 27, 2024 · 0 comments
Open

Fix deprecation warnings from test run #6

nigini opened this issue Jul 27, 2024 · 0 comments
Labels
upkeeping No changes in functionality: likely improving tests and refactoring to improve code quality
Milestone

Comments

@nigini
Copy link
Member

nigini commented Jul 27, 2024

All tests passed, but there are a bunch of deprecation warnings to be tackled:

========================================================================== warnings summary ===========================================================================
../../VENV/ublog/lib/python3.10/site-packages/pydantic/main.py:1069
tests/test_outbox.py::test_send_create_activity__with_attachment
tests/test_outbox.py::test_send_create_activity__with_attachment
tests/test_outbox.py::test_send_create_activity__no_content_with_cw_and_attachments
  ../../VENV/ublog/lib/python3.10/site-packages/pydantic/main.py:1069: PydanticDeprecatedSince20: The `parse_obj` method is deprecated; use `model_validate` instead. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.6/migration/
    warnings.warn(

app/database.py:26
  /home/./microblog.pub/app/database.py:26: MovedIn20Warning: Deprecated API features detected! These feature(s) are not compatible with SQLAlchemy 2.0. To prevent incompatible upgrades prior to updating applications, ensure requirements files are pinned to "sqlalchemy<2.0". Set environment variable SQLALCHEMY_WARN_20=1 to show all deprecation warnings.  Set environment variable SQLALCHEMY_SILENCE_UBER_WARNING=1 to silence this message. (Background on SQLAlchemy 2.0 at: https://sqlalche.me/e/b8d9)
    Base: Any = declarative_base()

../../VENV/ublog/lib/python3.10/site-packages/pydantic/_internal/_config.py:272
 ../../VENV/ublog/lib/python3.10/site-packages/pydantic/_internal/_config.py:272: PydanticDeprecatedSince20: Support for class-based `config` is deprecated, use ConfigDict instead. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.6/migration/
    warnings.warn(DEPRECATION_MESSAGE, DeprecationWarning)

../../VENV/ublog/lib/python3.10/site-packages/starlette/templating.py:102
  ../../VENV/ublog/lib/python3.10/site-packages/starlette/templating.py:102: DeprecationWarning: Extra environment options are deprecated. Use a preconfigured jinja2.Environment instead.
    warnings.warn(

tests/test_actor.py: 1 warning
tests/test_httpsig.py: 3 warnings
tests/test_ldsig.py: 1 warning
tests/test_process_outgoing_activities.py: 6 warnings
  sys:1: SAWarning: Can't sort tables for DROP; an unresolvable foreign key dependency exists between tables: inbox, outbox; and backend does not support ALTER.  To restore at least a partial sort, apply use_alter=True to ForeignKey and ForeignKeyConstraint objects involved in the cycle to mark these as known cycles that will be ignored.

tests/test_actor.py: 1 warning
tests/test_admin.py: 1 warning
tests/test_emoji.py: 3 warnings
tests/test_httpsig.py: 2 warnings
tests/test_inbox.py: 9 warnings
tests/test_outbox.py: 11 warnings
tests/test_process_outgoing_activities.py: 1 warning
tests/test_public.py: 13 warnings
tests/test_remote_actor_deletion.py: 2 warnings
tests/test_tags.py: 2 warnings
  /home/./microblog.pub/tests/conftest.py:33: SAWarning: Can't sort tables for DROP; an unresolvable foreign key dependency exists between tables: inbox, outbox; and backend does not support ALTER.  To restore at least a partial sort, apply use_alter=True to ForeignKey and ForeignKeyConstraint objects involved in the cycle to mark these as known cycles that will be ignored.
    Base.metadata.drop_all(bind=engine)

tests/test_emoji.py: 1 warning
tests/test_outbox.py: 10 warnings
tests/test_tags.py: 1 warning
  ../../VENV/ublog/lib/python3.10/site-packages/httpx/_client.py:799: DeprecationWarning: Setting per-request cookies=<...> is being deprecated, because the expected behaviour on cookie persistence is ambiguous. Set cookies directly on the client instance instead.
    warnings.warn(message, DeprecationWarning)

tests/test_emoji.py::test_emoji_note_with_emoji
tests/test_public.py::test_index__html
tests/test_public.py::test_followers__html
tests/test_public.py::test_followers__html_hides_followers
tests/test_public.py::test_following__html
tests/test_public.py::test_following__html_hides_following
tests/test_tags.py::test_tags__note_with_tag
  ../../VENV/ublog/lib/python3.10/site-packages/starlette/templating.py:178: DeprecationWarning: The `name` is not the first parameter anymore. The first parameter should be the `Request` instance.
  Replace `TemplateResponse(name, {"request": request})` by `TemplateResponse(request, name)`.
    warnings.warn(

tests/test_process_outgoing_activities.py::test_process_next_outgoing_activity__connect_error
  ../../VENV/ublog/lib/python3.10/site-packages/factory/alchemy.py:127: SAWarning: Identity map already had an identity for (<class 'app.models.OutboxObject'>, (1,), None), replacing it with newly flushed object.   Are there load operations occurring inside of an event handler within the flush?
    session.commit()

tests/test_process_outgoing_activities.py::test_process_next_outgoing_activity__connect_error
  ../../VENV/ublog/lib/python3.10/site-packages/factory/alchemy.py:127: SAWarning: Identity map already had an identity for (<class 'app.models.OutgoingActivity'>, (1,), None), replacing it with newly flushed object.   Are there load operations occurring inside of an event handler within the flush?
    session.commit()

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
@nigini nigini transferred this issue from tinyBlogPub/microblog.pub.old Aug 24, 2024
@nigini nigini added the upkeeping No changes in functionality: likely improving tests and refactoring to improve code quality label Aug 25, 2024
@nigini nigini added this to the v2.1 milestone Aug 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
upkeeping No changes in functionality: likely improving tests and refactoring to improve code quality
Projects
None yet
Development

No branches or pull requests

1 participant