Skip to content

Tests in scripts/ fail on Python 3.12 due to incorrect use of called_once_with #228

Open
@avirajsingh7

Description

@avirajsingh7

Describe the bug
When running tests using Python 3.11, everything passes without issues.
However, when running the same test suite on Python 3.12, all tests inside the scripts/ folder fail with the following error:

scripts/test_test_pre_start.py::test_init_successful_connection - AttributeError: 'called_once_with' is not a valid assertion. Use a spec for the mock if 'called_once_with' is meant to be an attribute.. Did you mean: 'assert_called_once_with'?

To Reproduce
Steps to reproduce the behavior:

  • Run tests using Python 3.12:
cd backend/app/tests
pytest -v scripts
  • Observe that tests fail with AttributeError related to called_once_with.
  • Run the same using Python 3.11 and see that it passes.

Expected behavior
Tests should behave consistently across Python versions.

Screenshots

Running test in python version 3.11

Image

Running test in python version 3.12

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    Projects

    Status

    To Do

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions