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 #957

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
rev: v5.0.0
hooks:
- id: check-added-large-files
- id: check-merge-conflict
Expand All @@ -13,12 +13,12 @@ repos:
- id: trailing-whitespace
# since autofix is enabled, ruff should go before black
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.5.7
rev: v0.8.6
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
- repo: https://github.com/asottile/setup-cfg-fmt
rev: v2.5.0
rev: v2.7.0
hooks:
- id: setup-cfg-fmt
- repo: https://github.com/mrtazz/checkmake.git
Expand Down
26 changes: 13 additions & 13 deletions tests/integration/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def minikube_ip() -> str:
return subprocess.check_output(("minikube", "ip"), text=True).strip()


@pytest.fixture()
@pytest.fixture
async def client() -> AsyncIterator[aiohttp.ClientSession]:
async with aiohttp.ClientSession() as session:
yield session
Expand Down Expand Up @@ -105,7 +105,7 @@ async def wait_for_service(
await asyncio.sleep(interval_s)


@pytest.fixture()
@pytest.fixture
# TODO (A Yushkovskiy, 05-May-2019) This fixture should have scope="session" in order
# to be faster, but it causes mysterious errors `RuntimeError: Event loop is closed`
async def platform_api_config(
Expand All @@ -126,7 +126,7 @@ async def platform_api_config(
)


@pytest.fixture()
@pytest.fixture
async def container_runtime_config(in_minikube: bool) -> ContainerRuntimeConfig: # noqa: FBT001
if in_minikube:
url = URL("http://platform-container-runtime:9000")
Expand All @@ -140,7 +140,7 @@ async def container_runtime_config(in_minikube: bool) -> ContainerRuntimeConfig:
return ContainerRuntimeConfig(port=url.port)


@pytest.fixture()
@pytest.fixture
async def container_runtime_client_registry(
container_runtime_config: ContainerRuntimeConfig,
) -> AsyncIterator[ContainerRuntimeClientRegistry]:
Expand All @@ -150,7 +150,7 @@ async def container_runtime_client_registry(
yield registry


@pytest.fixture()
@pytest.fixture
# TODO (A Yushkovskiy, 05-May-2019) This fixture should have scope="session" in order
# to be faster, but it causes mysterious errors `RuntimeError: Event loop is closed`
async def es_config(
Expand All @@ -173,7 +173,7 @@ async def es_config(
return ElasticsearchConfig(hosts=[es_host])


@pytest.fixture()
@pytest.fixture
async def es_client(
es_config: ElasticsearchConfig,
) -> AsyncIterator[AsyncElasticsearch]:
Expand All @@ -184,7 +184,7 @@ async def es_client(
yield es_client


@pytest.fixture()
@pytest.fixture
def s3_config() -> S3Config:
s3_url = get_service_url(service_name="minio")
return S3Config(
Expand All @@ -196,13 +196,13 @@ def s3_config() -> S3Config:
)


@pytest.fixture()
@pytest.fixture
async def s3_client(s3_config: S3Config) -> AsyncIterator[AioBaseClient]:
async with create_s3_client(s3_config) as client:
yield client


@pytest.fixture()
@pytest.fixture
async def s3_logs_bucket(s3_config: S3Config, s3_client: AioBaseClient) -> str:
try:
await s3_client.create_bucket(Bucket=s3_config.job_logs_bucket_name)
Expand All @@ -212,7 +212,7 @@ async def s3_logs_bucket(s3_config: S3Config, s3_client: AioBaseClient) -> str:
return s3_config.job_logs_bucket_name


@pytest.fixture()
@pytest.fixture
async def registry_config(request: FixtureRequest, in_minikube: bool) -> RegistryConfig: # noqa: FBT001
if in_minikube:
external_url = URL("http://registry.kube-system")
Expand All @@ -224,7 +224,7 @@ async def registry_config(request: FixtureRequest, in_minikube: bool) -> Registr
return RegistryConfig(URL("http://localhost:5000"))


@pytest.fixture()
@pytest.fixture
def config_factory(
auth_config: PlatformAuthConfig,
platform_api_config: PlatformApiConfig,
Expand Down Expand Up @@ -256,12 +256,12 @@ def _f(**kwargs: Any) -> Config:
return _f


@pytest.fixture()
@pytest.fixture
def config(config_factory: Callable[..., Config]) -> Config:
return config_factory()


@pytest.fixture()
@pytest.fixture
def config_s3_storage(
config_factory: Callable[..., Config], s3_config: S3Config
) -> Config:
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/conftest_admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ async def regular_user2(
return await regular_user_factory()


@pytest.fixture()
@pytest.fixture
async def share_job(
auth_client: AuthClient, cluster_name: str
) -> Callable[[ProjectUser, ProjectUser, str, str], Awaitable[None]]:
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/conftest_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def auth_config(
)


@pytest.fixture()
@pytest.fixture
async def auth_client(
auth_config: PlatformAuthConfig,
) -> AsyncGenerator[AuthClient, None]:
Expand Down
6 changes: 3 additions & 3 deletions tests/integration/conftest_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def cluster_token(token_factory: Callable[[str], str]) -> str:
return token_factory("cluster")


@pytest.fixture()
@pytest.fixture
async def platform_config_url(
platform_api_config: PlatformApiConfig,
in_minikube: bool, # noqa: FBT001
Expand All @@ -31,14 +31,14 @@ async def platform_config_url(
return URL(get_service_url("platformconfig", namespace="default"))


@pytest.fixture()
@pytest.fixture
def platform_config(
platform_config_url: URL, token_factory: Callable[[str], str]
) -> PlatformConfig:
return PlatformConfig(url=platform_config_url, token=token_factory("cluster"))


@pytest.fixture()
@pytest.fixture
async def platform_config_client(
platform_config_url: URL, cluster_token: str
) -> AsyncIterator[ConfigClient]:
Expand Down
10 changes: 5 additions & 5 deletions tests/integration/conftest_kube.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ def cert_authority_data_pem(kube_config_cluster_payload: dict[str, Any]) -> str
return None


@pytest.fixture()
@pytest.fixture
async def kube_config(request: FixtureRequest, in_minikube: bool) -> KubeConfig: # noqa: FBT001
if in_minikube:
return KubeConfig(
Expand All @@ -218,7 +218,7 @@ async def kube_config(request: FixtureRequest, in_minikube: bool) -> KubeConfig:
)


@pytest.fixture()
@pytest.fixture
async def kube_client(kube_config: KubeConfig) -> AsyncIterator[MyKubeClient]:
# TODO (A Danshyn 06/06/18): create a factory method
client = MyKubeClient(
Expand All @@ -239,20 +239,20 @@ async def kube_client(kube_config: KubeConfig) -> AsyncIterator[MyKubeClient]:
yield client


@pytest.fixture()
@pytest.fixture
async def _kube_node(kube_client: KubeClient) -> Node:
nodes = await kube_client.get_nodes()
assert len(nodes) == 1, "Should be exactly one minikube node"
return nodes[0]


@pytest.fixture()
@pytest.fixture
async def kube_node_name(_kube_node: Node) -> str:
assert _kube_node.metadata.name
return _kube_node.metadata.name


@pytest.fixture()
@pytest.fixture
async def kube_container_runtime(_kube_node: Node) -> str:
version = _kube_node.status.node_info.container_runtime_version
end = version.find("://")
Expand Down
24 changes: 12 additions & 12 deletions tests/integration/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,14 +168,14 @@ def generate_job_url(self, job_id: str) -> URL:
return self.jobs_base_url / job_id


@pytest.fixture()
@pytest.fixture
async def monitoring_api(config: Config) -> AsyncIterator[MonitoringApiEndpoints]:
app = await create_app(config)
async with create_local_app_server(app, port=8080) as address:
yield MonitoringApiEndpoints(address=address)


@pytest.fixture()
@pytest.fixture
async def monitoring_api_s3_storage(
config_s3_storage: Config,
) -> AsyncIterator[MonitoringApiEndpoints]:
Expand All @@ -184,7 +184,7 @@ async def monitoring_api_s3_storage(
yield MonitoringApiEndpoints(address=address)


@pytest.fixture()
@pytest.fixture
def platform_api(
platform_api_config: PlatformApiConfig,
) -> PlatformApiEndpoints:
Expand Down Expand Up @@ -285,7 +285,7 @@ async def drop_job(self, job_id: str, *, assert_success: bool = True) -> None:
assert response.status == HTTPNoContent.status_code


@pytest.fixture()
@pytest.fixture
def jobs_client_factory(
platform_api: PlatformApiEndpoints, client: aiohttp.ClientSession
) -> Callable[[ProjectUser], JobsClient]:
Expand All @@ -295,15 +295,15 @@ def impl(user: ProjectUser) -> JobsClient:
return impl


@pytest.fixture()
@pytest.fixture
async def jobs_client(
regular_user1: ProjectUser,
jobs_client_factory: Callable[[ProjectUser], JobsClient],
) -> JobsClient:
return jobs_client_factory(regular_user1)


@pytest.fixture()
@pytest.fixture
def job_request_factory() -> Callable[[], dict[str, Any]]:
def _factory() -> dict[str, Any]:
return {
Expand All @@ -317,14 +317,14 @@ def _factory() -> dict[str, Any]:
return _factory


@pytest.fixture()
@pytest.fixture
async def job_submit(
job_request_factory: Callable[[], dict[str, Any]],
) -> dict[str, Any]:
return job_request_factory()


@pytest.fixture()
@pytest.fixture
async def job_factory(
jobs_client: JobsClient,
job_request_factory: Callable[[], dict[str, Any]],
Expand Down Expand Up @@ -353,17 +353,17 @@ async def _f(command: str, name: str = "") -> str:
await jobs_client.wait_job_dematerialized(job_id)


@pytest.fixture()
@pytest.fixture
async def infinite_job(job_factory: Callable[[str], Awaitable[str]]) -> str:
return await job_factory("tail -f /dev/null")


@pytest.fixture()
@pytest.fixture
def job_name() -> str:
return f"test-job-{random_str()}"


@pytest.fixture()
@pytest.fixture
async def named_infinite_job(
job_factory: Callable[[str, str], Awaitable[str]], job_name: str
) -> str:
Expand Down Expand Up @@ -1375,7 +1375,7 @@ async def test_port_forward_cannot_connect(
async with client.get(url, headers=headers) as response:
assert response.status == HTTPBadRequest.status_code, await response.text()

@pytest.mark.minikube()
@pytest.mark.minikube
async def test_port_forward_ok(
self,
monitoring_api: MonitoringApiEndpoints,
Expand Down
14 changes: 7 additions & 7 deletions tests/integration/test_jobs_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ async def create_apolo_client(
await client.close()


@pytest.fixture()
@pytest.fixture
async def job_factory(
apolo_client: JobsClient,
) -> AsyncIterator[JobFactory]:
Expand Down Expand Up @@ -82,19 +82,19 @@ async def _factory(

@pytest.mark.usefixtures("cluster_name")
class TestJobsService:
@pytest.fixture()
@pytest.fixture
async def user(self, regular_user1: ProjectUser) -> ProjectUser:
return regular_user1

@pytest.fixture()
@pytest.fixture
def registry_host(self) -> str:
return "localhost:5000"

@pytest.fixture()
@pytest.fixture
def image_tag(self) -> str:
return str(uuid.uuid4())[:8]

@pytest.fixture()
@pytest.fixture
async def apolo_client(
self, platform_api_config: PlatformApiConfig, regular_user1: ProjectUser
) -> AsyncIterator[JobsClient]:
Expand All @@ -103,7 +103,7 @@ async def apolo_client(
) as client:
yield client

@pytest.fixture()
@pytest.fixture
async def platform_api_client(
self, platform_api_config: PlatformApiConfig, user: ProjectUser
) -> AsyncIterator[ApiClient]:
Expand All @@ -112,7 +112,7 @@ async def platform_api_client(
) as client:
yield client

@pytest.fixture()
@pytest.fixture
async def jobs_service(
self,
platform_config_client: ConfigClient,
Expand Down
Loading
Loading