Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pre-commit.ci] pre-commit autoupdate #744

Merged
merged 2 commits into from
Oct 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: 'v4.3.0'
rev: 'v4.5.0'
hooks:
- id: check-merge-conflict
exclude: "rst$"
- repo: https://github.com/asottile/yesqa
rev: v1.3.0
rev: v1.5.0
hooks:
- id: yesqa
- repo: https://github.com/sondrelg/pep585-upgrade
Expand All @@ -15,7 +15,7 @@ repos:
args:
- --futures=true
- repo: https://github.com/Zac-HD/shed
rev: 0.10.1
rev: 2023.6.1
hooks:
- id: shed
args:
Expand All @@ -26,11 +26,11 @@ repos:
- markdown
- rst
- repo: https://github.com/PyCQA/flake8
rev: 4.0.1
rev: 6.1.0
hooks:
- id: flake8
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: 'v4.3.0'
rev: 'v4.5.0'
hooks:
- id: check-case-conflict
- id: check-json
Expand All @@ -44,7 +44,7 @@ repos:
- id: debug-statements
# Another entry is required to apply file-contents-sorter to another file
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: 'v4.3.0'
rev: 'v4.5.0'
hooks:
- id: file-contents-sorter
files: |
Expand All @@ -56,7 +56,7 @@ repos:
# - id: actionlint-docker
# args: ["-ignore", "SC2155:", "-ignore", "SC2086:"]
- repo: https://github.com/sirosen/check-jsonschema
rev: 0.17.1
rev: 0.27.0
hooks:
- id: check-github-actions
- id: check-github-workflows
Expand Down
4 changes: 1 addition & 3 deletions tests/integration/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,9 +246,7 @@ def _f(**kwargs: Any) -> Config:
platform_api=platform_api_config,
platform_config=platform_config,
s3=s3_config,
logs=LogsConfig(
storage_type=LogsStorageType.S3, cleanup_interval_sec=0.5
),
logs=LogsConfig(storage_type=LogsStorageType.S3, cleanup_interval_sec=0.5),
kube=kube_config,
registry=registry_config,
container_runtime=container_runtime_config,
Expand Down
3 changes: 2 additions & 1 deletion tests/integration/conftest_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,12 @@ async def _wait_for_platform_api_config(
) -> None:
while True:
import warnings

with warnings.catch_warnings():
warnings.filterwarnings("ignore", category=DeprecationWarning)
try:
async with create_platform_api_client(
platform_api_config.url, platform_api_config.token
platform_api_config.url, platform_api_config.token
):
return
except Exception:
Expand Down
1 change: 0 additions & 1 deletion tests/integration/conftest_kube.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@


class MyKubeClient(KubeClient):

# TODO (A Yushkovskiy, 30-May-2019) delete pods automatically

async def create_pod(self, job_pod_descriptor: dict[str, Any]) -> str:
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -1037,7 +1037,8 @@ async def test_attach_forbidden(
async with client.ws_connect(url):
pass
except WSServerHandshakeError as e:
assert e.headers and e.headers.get("X-Error")
assert e.headers
assert e.headers.get("X-Error")
assert e.message == "Invalid response status"
assert e.status == HTTPUnauthorized.status_code

Expand Down Expand Up @@ -1401,7 +1402,6 @@ async def test_kill(
jobs_client: JobsClient,
infinite_job: str,
) -> None:

headers = jobs_client.headers

url = monitoring_api.generate_kill_url(infinite_job)
Expand Down
3 changes: 2 additions & 1 deletion tests/integration/test_jobs_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,8 @@ async def test_save_commit_fails_with_exception(

async def test_get_available_jobs_count(self, jobs_service: JobsService) -> None:
result = await jobs_service.get_available_jobs_counts()
assert result and "cpu-small" in result
assert result
assert "cpu-small" in result

async def test_mark_logs_dropped(
self,
Expand Down
8 changes: 4 additions & 4 deletions tests/integration/test_kube.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from contextlib import AbstractAsyncContextManager
from datetime import datetime, timedelta, timezone
from pathlib import Path
from typing import Any, Union
from typing import Any
from unittest import mock
from uuid import uuid4

Expand Down Expand Up @@ -1189,7 +1189,7 @@ async def stop_func() -> bool:
def run_log_reader(
name: str, delay: float = 0, timeout_s: float = 60.0
) -> None:
async def coro() -> Union[bytes, Exception]:
async def coro() -> bytes | Exception:
await asyncio.sleep(delay)
try:
async with timeout(timeout_s):
Expand Down Expand Up @@ -1271,7 +1271,7 @@ async def stop_func() -> bool:
def run_log_reader(
name: str, delay: float = 0, timeout_s: float = 60.0
) -> None:
async def coro() -> Union[bytes, Exception]:
async def coro() -> bytes | Exception:
await asyncio.sleep(delay)
try:
async with timeout(timeout_s):
Expand Down Expand Up @@ -1358,7 +1358,7 @@ async def stop_func() -> bool:
def run_log_reader(
name: str, delay: float = 0, timeout_s: float = 60.0
) -> None:
async def coro() -> Union[bytes, Exception]:
async def coro() -> bytes | Exception:
await asyncio.sleep(delay)
try:
async with timeout(timeout_s):
Expand Down
9 changes: 5 additions & 4 deletions tests/unit/test_logs.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import json
from collections.abc import AsyncIterator, Callable, Sequence
from datetime import datetime, timezone, timedelta
from datetime import datetime, timedelta, timezone
from typing import Any
from unittest import mock

Expand Down Expand Up @@ -37,19 +37,19 @@ def setup_s3_key_content(
s3_client: mock.Mock,
) -> Callable[[dict[str, list[str]]], None]:
def _setup(content: dict[str, list[str]]) -> None:
async def get_object(
Key: str, *args: Any, **kwargs: Any
) -> dict[str, Any]:
async def get_object(Key: str, *args: Any, **kwargs: Any) -> dict[str, Any]:
async def _iter() -> AsyncIterator[str]:
for line in content[Key]:
yield line

body = mock.AsyncMock()
body.iter_lines = mock.MagicMock()
body.iter_lines.return_value = mock.AsyncMock()
body.iter_lines.return_value.__aiter__.side_effect = _iter
return {"ContentType": "", "Body": body}

s3_client.get_object = get_object

return _setup

@pytest.fixture
Expand Down Expand Up @@ -100,6 +100,7 @@ async def test_iterate_log_chunks(

def later_iso(sec: int = 0) -> str:
return (now + timedelta(seconds=sec)).isoformat()

stored_lines = []
for i, line in enumerate(log_lines):
stored_line = {"time": later_iso(i)}
Expand Down
Loading