Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Dec 19, 2024
1 parent 94611ed commit 23ef1b2
Show file tree
Hide file tree
Showing 11 changed files with 67 additions and 67 deletions.
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
4 changes: 2 additions & 2 deletions tests/integration/conftest_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def auth_config(
)


@pytest.fixture()
@pytest.fixture
async def auth_client(
auth_config: PlatformAuthConfig,
) -> AsyncGenerator[AuthClient, None]:
Expand All @@ -63,7 +63,7 @@ def headers(self) -> dict[str, str]:
return {AUTHORIZATION: f"Bearer {self.token}"}


@pytest.fixture()
@pytest.fixture
async def share_job(
auth_client: AuthClient, cluster_name: str
) -> Callable[[_User, _User, str, str], Awaitable[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 @@ -282,7 +282,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[[_User], JobsClient]:
Expand All @@ -292,15 +292,15 @@ def impl(user: _User) -> JobsClient:
return impl


@pytest.fixture()
@pytest.fixture
async def jobs_client(
regular_user1: _User,
jobs_client_factory: Callable[[_User], 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 @@ -314,14 +314,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 @@ -350,17 +350,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 @@ -1366,7 +1366,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
12 changes: 6 additions & 6 deletions tests/integration/test_jobs_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
JobFactory = Callable[..., Awaitable[Job]]


@pytest.fixture()
@pytest.fixture
async def job_factory(
platform_api_client: PlatformApiClient,
) -> AsyncIterator[JobFactory]:
Expand Down Expand Up @@ -59,19 +59,19 @@ async def _factory(

@pytest.mark.usefixtures("cluster_name")
class TestJobsService:
@pytest.fixture()
@pytest.fixture
def user(self, regular_user1: _User) -> User:
return User(name=regular_user1.name, token=regular_user1.token)

@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 platform_api_client(
self, platform_api_config: PlatformApiConfig, user: User
) -> AsyncIterator[PlatformApiClient]:
Expand All @@ -80,7 +80,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

0 comments on commit 23ef1b2

Please sign in to comment.