Skip to content

Commit

Permalink
Bump mypy from 1.13.0 to 1.14.0 in the minor-patch-dependencies group (
Browse files Browse the repository at this point in the history
…#1525)

* Bump mypy from 1.13.0 to 1.14.0 in the minor-patch-dependencies group

Bumps the minor-patch-dependencies group with 1 update: [mypy](https://github.com/python/mypy).


Updates `mypy` from 1.13.0 to 1.14.0
- [Changelog](https://github.com/python/mypy/blob/master/CHANGELOG.md)
- [Commits](python/mypy@v1.13.0...v1.14.0)

---
updated-dependencies:
- dependency-name: mypy
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: minor-patch-dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>

* Working on fixing types, removing old code for python 3.8.

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Alex Cottner <acottner@mozilla.com>
  • Loading branch information
dependabot[bot] and alexcottner authored Dec 23, 2024
1 parent 55f2558 commit 1f8c309
Show file tree
Hide file tree
Showing 18 changed files with 96 additions and 127 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ __pycache__
.env
.mypy_cache
.install.stamp
.vscode/
72 changes: 36 additions & 36 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ google-cloud-bigquery = "^3.27.0"
pytest = "^8.3.4"
aioresponses = "^0.7.7"
pytest-aiohttp = "^1.0.5"
mypy = "^1.13"
mypy = "^1.14"
pytest-cov = "^6.0.0"
bandit = "^1.8.0"
responses = "^0.25.3"
Expand Down
2 changes: 1 addition & 1 deletion telescope/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def __init__(

async def run(
self, cache=None, events=None, force=False
) -> Tuple[Any, bool, Any, int]:
) -> Tuple[Any, bool, Any, float]:
identifier = f"{self.project}/{self.name}"

# Caution: the cache key may contain secrets and should never be exposed.
Expand Down
5 changes: 2 additions & 3 deletions tests/checks/remotesettings/test_certificates_expiration.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

from checks.remotesettings.certificates_expiration import run
from telescope.utils import utcnow
from tests.utils import patch_async


CERT = """
Expand Down Expand Up @@ -75,7 +74,7 @@ async def test_positive(mock_responses):
)

module = "checks.remotesettings.certificates_expiration"
with patch_async(f"{module}.fetch_certs", return_value=[fake_cert]) as mocked:
with mock.patch(f"{module}.fetch_certs", return_value=[fake_cert]) as mocked:
status, data = await run(server_url, min_remaining_days=29)
mocked.assert_called_with("http://fake-x5u")

Expand All @@ -89,7 +88,7 @@ async def test_negative(mock_responses):
mock_http_calls(mock_responses, server_url)

module = "checks.remotesettings.certificates_expiration"
with patch_async(f"{module}.fetch_text", return_value=CERT) as mocked:
with mock.patch(f"{module}.fetch_text", return_value=CERT) as mocked:
status, data = await run(server_url, min_remaining_days=30)
mocked.assert_called_with("http://fake-x5u")

Expand Down
11 changes: 6 additions & 5 deletions tests/checks/remotesettings/test_collections_consistency.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from unittest import mock

from checks.remotesettings.collections_consistency import has_inconsistencies, run
from tests.utils import patch_async


FAKE_AUTH = "Bearer abc"
Expand Down Expand Up @@ -219,8 +220,8 @@ async def test_positive(mock_responses):
server_url = "http://fake.local/v1"

module = "checks.remotesettings.collections_consistency"
with patch_async(f"{module}.fetch_signed_resources", return_value=RESOURCES):
with patch_async(f"{module}.has_inconsistencies", return_value=None):
with mock.patch(f"{module}.fetch_signed_resources", return_value=RESOURCES):
with mock.patch(f"{module}.has_inconsistencies", return_value=None):
status, data = await run(server_url, FAKE_AUTH)

assert status is True
Expand All @@ -231,8 +232,8 @@ async def test_negative(mock_responses):
server_url = "http://fake.local/v1"

m = "checks.remotesettings.collections_consistency"
with patch_async(f"{m}.fetch_signed_resources", return_value=RESOURCES):
with patch_async(f"{m}.has_inconsistencies", return_value="Some error"):
with mock.patch(f"{m}.fetch_signed_resources", return_value=RESOURCES):
with mock.patch(f"{m}.has_inconsistencies", return_value="Some error"):
status, data = await run(server_url, FAKE_AUTH)

assert status is False
Expand Down
7 changes: 4 additions & 3 deletions tests/checks/remotesettings/test_latest_approvals.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
from unittest import mock

from checks.remotesettings.latest_approvals import get_latest_approvals, run
from checks.remotesettings.utils import KintoClient
from telescope.utils import utcnow
from tests.utils import patch_async


FAKE_AUTH = ""
Expand Down Expand Up @@ -91,8 +92,8 @@ async def test_positive(mock_responses):
"source": {"bucket": "bid", "collection": "cid"},
}
]
with patch_async(f"{module}.fetch_signed_resources", return_value=resources):
with patch_async(f"{module}.get_latest_approvals", return_value=INFOS):
with mock.patch(f"{module}.fetch_signed_resources", return_value=resources):
with mock.patch(f"{module}.get_latest_approvals", return_value=INFOS):
status, data = await run({}, server_url, FAKE_AUTH)

assert status is True
Expand Down
7 changes: 3 additions & 4 deletions tests/checks/remotesettings/test_push_timestamp.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

from checks.remotesettings.push_timestamp import BROADCAST_ID, get_push_timestamp, run
from telescope.utils import utcfromtimestamp
from tests.utils import patch_async


MODULE = "checks.remotesettings.push_timestamp"
Expand All @@ -24,7 +23,7 @@ async def test_positive(mock_responses):
},
)

with patch_async(f"{MODULE}.get_push_timestamp", return_value="1573086234731"):
with mock.patch(f"{MODULE}.get_push_timestamp", return_value="1573086234731"):
status, data = await run(
remotesettings_server="http://server.local/v1", push_server=""
)
Expand Down Expand Up @@ -58,7 +57,7 @@ async def test_positive_with_margin(mock_responses):
)

with mock.patch(f"{MODULE}.utcnow", return_value=server_datetime):
with patch_async(f"{MODULE}.get_push_timestamp", return_value=42):
with mock.patch(f"{MODULE}.get_push_timestamp", return_value=42):
status, _ = await run(
remotesettings_server="http://server.local/v1", push_server=""
)
Expand All @@ -76,7 +75,7 @@ async def test_negative(mock_responses):
},
)

with patch_async(f"{MODULE}.get_push_timestamp", return_value="2573086234731"):
with mock.patch(f"{MODULE}.get_push_timestamp", return_value="2573086234731"):
status, data = await run(
remotesettings_server="http://server.local/v1", push_server=""
)
Expand Down
9 changes: 4 additions & 5 deletions tests/checks/remotesettings/test_signatures_age.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

from checks.remotesettings.signatures_age import get_signature_age_hours, run
from checks.remotesettings.utils import KintoClient
from tests.utils import patch_async


FAKE_AUTH = "Bearer abc"
Expand Down Expand Up @@ -42,8 +41,8 @@ async def test_get_signature_age_hours(mock_responses):
async def test_positive(mock_responses):
server_url = "http://fake.local/v1"
module = "checks.remotesettings.signatures_age"
with patch_async(f"{module}.fetch_signed_resources", return_value=RESOURCES):
with patch_async(f"{module}.get_signature_age_hours", return_value=3):
with mock.patch(f"{module}.fetch_signed_resources", return_value=RESOURCES):
with mock.patch(f"{module}.get_signature_age_hours", return_value=3):
status, data = await run(server_url, FAKE_AUTH, max_age=4)

assert status is True
Expand All @@ -52,8 +51,8 @@ async def test_positive(mock_responses):

async def test_negative(mock_responses):
server_url = "http://fake.local/v1"
with patch_async(f"{MODULE}.fetch_signed_resources", return_value=RESOURCES):
with patch_async(f"{MODULE}.get_signature_age_hours", return_value=5):
with mock.patch(f"{MODULE}.fetch_signed_resources", return_value=RESOURCES):
with mock.patch(f"{MODULE}.get_signature_age_hours", return_value=5):
status, data = await run(server_url, FAKE_AUTH, max_age=4)

assert status is False
Expand Down
5 changes: 2 additions & 3 deletions tests/checks/remotesettings/test_total_approvals.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
from checks.remotesettings.total_approvals import get_approvals, run
from checks.remotesettings.utils import KintoClient
from telescope.utils import utcnow
from tests.utils import patch_async


FAKE_AUTH = "Bearer abc"
Expand Down Expand Up @@ -52,8 +51,8 @@ async def test_positive(mock_responses):
"cfr": 5,
}
with mock.patch(f"{module}.utcnow", return_value=datetime(1982, 5, 8)):
with patch_async(f"{module}.fetch_signed_resources", return_value=resources):
with patch_async(f"{module}.get_approvals", return_value=totals):
with mock.patch(f"{module}.fetch_signed_resources", return_value=resources):
with mock.patch(f"{module}.get_approvals", return_value=totals):
status, data = await run(server_url, FAKE_AUTH, period_days=1)

assert status is True
Expand Down
Loading

0 comments on commit 1f8c309

Please sign in to comment.