te25son / Swole-V2

API for tracking workouts built with FastAPI, edgedb, and poetry
Apache License 2.0
0 stars 0 forks source link

Pytest Warnings #282

Open te25son opened 8 months ago

te25son commented 8 months ago

There are currently 27 warnings when running pytest.

These need to be investigated and, ideally, removed.

../../Library/Caches/pypoetry/virtualenvs/swole-v2-XOUsbHQA-py3.12/lib/python3.12/site-packages/passlib/utils/__init__.py:854
../../Library/Caches/pypoetry/virtualenvs/swole-v2-XOUsbHQA-py3.12/lib/python3.12/site-packages/passlib/utils/__init__.py:854
../../Library/Caches/pypoetry/virtualenvs/swole-v2-XOUsbHQA-py3.12/lib/python3.12/site-packages/passlib/utils/__init__.py:854
../../Library/Caches/pypoetry/virtualenvs/swole-v2-XOUsbHQA-py3.12/lib/python3.12/site-packages/passlib/utils/__init__.py:854
../../Library/Caches/pypoetry/virtualenvs/swole-v2-XOUsbHQA-py3.12/lib/python3.12/site-packages/passlib/utils/__init__.py:854
  /Users/timothy/Library/Caches/pypoetry/virtualenvs/swole-v2-XOUsbHQA-py3.12/lib/python3.12/site-packages/passlib/utils/__init__.py:854: DeprecationWarning: 'crypt' is deprecated and slated for removal in Python 3.13
    from crypt import crypt as _crypt

tests/unit_tests/test_validators.py::test_check_valid_uuid
tests/api_tests/test_workouts.py::TestWorkouts::test_workout_update_fails_with_params[Test update with incorrectly formatted date fails]
tests/api_tests/test_workouts.py::TestWorkouts::test_add_exercise_fails_when_adding_exercise_from_other_user
tests/api_tests/test_users.py::TestUsers::test_user_create_multiple_succeeds
  /Users/timothy/Library/Caches/pypoetry/virtualenvs/swole-v2-XOUsbHQA-py3.12/lib/python3.12/site-packages/pytest_asyncio/plugin.py:654: DeprecationWarning: There is no current event loop
    old_loop = asyncio.get_event_loop()

tests/api_tests/test_workouts.py::TestWorkouts::test_workout_update_fails_with_params[Test update with incorrectly formatted date fails]
tests/api_tests/test_workouts.py::TestWorkouts::test_add_exercise_fails_when_adding_exercise_from_other_user
tests/api_tests/test_users.py::TestUsers::test_login_with_invalid_creds_fails
tests/api_tests/test_users.py::TestUsers::test_user_create_multiple_succeeds
  /Users/timothy/Library/Caches/pypoetry/virtualenvs/swole-v2-XOUsbHQA-py3.12/lib/python3.12/site-packages/uvloop/__init__.py:31: DeprecationWarning: uvloop.install() is deprecated in favor of uvloop.run() starting with Python 3.12.
    _warnings.warn(

tests/api_tests/test_workouts.py::TestWorkouts::test_workout_update_fails_with_params[Test update with incorrectly formatted date fails]
tests/api_tests/test_workouts.py::TestWorkouts::test_add_exercise_fails_when_adding_exercise_from_other_user
tests/api_tests/test_users.py::TestUsers::test_login_with_invalid_creds_fails
tests/api_tests/test_users.py::TestUsers::test_user_create_multiple_succeeds
  /Users/timothy/Library/Caches/pypoetry/virtualenvs/swole-v2-XOUsbHQA-py3.12/lib/python3.12/site-packages/pytest_asyncio/plugin.py:749: DeprecationWarning: The event_loop fixture provided by pytest-asyncio has been redefined in
  /Users/timothy/Personal/Swole-V2/tests/conftest.py:50
  Replacing the event_loop fixture with a custom implementation is deprecated
  and will lead to errors in the future.
  If you want to request an asyncio event loop with a scope other than function
  scope, use the "scope" argument to the asyncio mark when marking the tests.
  If you want to return different types of event loops, use the event_loop_policy
  fixture.

    warnings.warn(

tests/api_tests/test_users.py::TestUsers::test_login_succeeds
tests/unit_tests/test_auth.py::TestAuth::test_get_current_user_succeeds
tests/unit_tests/test_auth.py::TestAuth::test_get_current_user_fails_with_incorrect_secret
tests/unit_tests/test_auth.py::TestAuth::test_get_current_user_fails_with_non_existing_user
tests/unit_tests/test_auth.py::TestAuth::test_inactive_user_fails
tests/unit_tests/test_auth.py::TestAuth::test_get_current_user_fails_with_invalid_token
  /Users/timothy/Personal/Swole-V2/src/swole_v2/database/repositories/users.py:100: DeprecationWarning: datetime.datetime.utcnow() is deprecated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC: datetime.datetime.now(datetime.UTC).
    to_encode.update({"exp": datetime.utcnow() + timedelta(minutes=self.settings.TOKEN_EXPIRE)})

tests/unit_tests/test_auth.py::TestAuth::test_get_current_user_succeeds
tests/unit_tests/test_auth.py::TestAuth::test_get_current_user_fails_with_non_existing_user
tests/unit_tests/test_auth.py::TestAuth::test_inactive_user_fails
tests/unit_tests/test_auth.py::TestAuth::test_get_current_user_fails_with_invalid_token
  /Users/timothy/Library/Caches/pypoetry/virtualenvs/swole-v2-XOUsbHQA-py3.12/lib/python3.12/site-packages/jose/jwt.py:311: DeprecationWarning: datetime.datetime.utcnow() is deprecated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC: datetime.datetime.now(datetime.UTC).
    now = timegm(datetime.utcnow().utctimetuple())

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
te25son commented 7 months ago

The passlib library using crypt is a known issue. However, there doesn't seem to be much activity in the passlib repo.

https://foss.heptapod.net/python-libs/passlib/-/issues/148