Backend: fix make test warnings

Open Beginner friendly
#68 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
1/5
Estimated time
Under an hour
Newbie friendliness
78/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Stale
Tech stack
python, sqlalchemy

Research direction

Start in app/api/api_v1/endpoints/source_apis.py at line 33 and review the session call identified by the warning. Run tests/endpoints/test_source_apis.py::test_list_source_apis_deduplication and confirm the test passes without the deprecation warning.

Written by the indexing model from the issue text.

Description

tests/endpoints/test_source_apis.py::test_list_source_apis_deduplication
  /app/app/api/api_v1/endpoints/source_apis.py:33: DeprecationWarning:
          🚨 You probably want to use `session.exec()` instead of `session.execute()`.

          This is the original SQLAlchemy `session.execute()` method that returns objects
          of type `Row`, and that you have to call `scalars()` to get the model objects.

          For example:

          ```Python
          heroes = await session.execute(select(Hero)).scalars().all()
          ```

          instead you could use `exec()`:

          ```Python
          heroes = await session.exec(select(Hero)).all()
          ```

    result = await session.execute(query)

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
Dominant language
TypeScript
Stars
0
Forks
1
Avg merge
1d 2h
Merged PRs (30d)
2

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from pyronear/pyro-annotator

All issues in pyronear/pyro-annotator

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.