Use zoneinfo instead of pytz, mark pytz as banned in ruff (#98613)

Refs #43439, #49643.
This commit is contained in:
Ville Skyttä 2023-08-18 20:10:29 +03:00 committed by GitHub
parent 4073f56c5e
commit 93683cef27
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 5 deletions

View File

@ -488,6 +488,7 @@ select = [
"SIM401", # Use get from dict with default instead of an if block
"T100", # Trace found: {name} used
"T20", # flake8-print
"TID251", # Banned imports
"TRY004", # Prefer TypeError exception for invalid type
"TRY200", # Use raise from to specify exception cause
"TRY302", # Remove exception handler; error is immediately re-raised
@ -531,6 +532,9 @@ voluptuous = "vol"
[tool.ruff.flake8-pytest-style]
fixture-parentheses = false
[tool.ruff.flake8-tidy-imports.banned-api]
"pytz".msg = "use zoneinfo instead"
[tool.ruff.isort]
force-sort-within-sections = true
known-first-party = [

View File

@ -5,7 +5,6 @@ from ipaddress import IPv4Address
from unittest.mock import AsyncMock, Mock, patch
import pytest
import pytz
from pyunifiprotect.data import (
Bootstrap,
Camera,
@ -441,7 +440,7 @@ ONE_MONTH_SIMPLE = (
minute=0,
second=0,
microsecond=0,
tzinfo=pytz.timezone("US/Pacific"),
tzinfo=dt_util.get_time_zone("US/Pacific"),
),
1,
)
@ -454,7 +453,7 @@ TWO_MONTH_SIMPLE = (
minute=0,
second=0,
microsecond=0,
tzinfo=pytz.timezone("US/Pacific"),
tzinfo=dt_util.get_time_zone("US/Pacific"),
),
2,
)
@ -513,7 +512,7 @@ ONE_MONTH_TIMEZONE = (
minute=0,
second=0,
microsecond=0,
tzinfo=pytz.timezone("US/Pacific"),
tzinfo=dt_util.get_time_zone("US/Pacific"),
),
1,
)
@ -526,7 +525,7 @@ TWO_MONTH_TIMEZONE = (
minute=0,
second=0,
microsecond=0,
tzinfo=pytz.timezone("US/Pacific"),
tzinfo=dt_util.get_time_zone("US/Pacific"),
),
2,
)