Skip to content

Commit

Permalink
use any_client instead of client
Browse files Browse the repository at this point in the history
  • Loading branch information
korgan00 committed Dec 10, 2024
1 parent 27ad061 commit c1bc4fe
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions tests/docker/test_docker.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@ def simple_function(self):
)

@mark.order(1)
def test_simple_function(self, client: BaseClient, simple_function: QiskitFunction):
def test_simple_function(self, any_client: BaseClient, simple_function: QiskitFunction):
"""Integration test function uploading."""

runnable_function = client.upload(simple_function)
runnable_function = any_client.upload(simple_function)

assert runnable_function is not None

runnable_function = client.function(simple_function.title)
runnable_function = any_client.function(simple_function.title)

assert runnable_function is not None

Expand All @@ -48,7 +48,7 @@ def test_simple_function(self, client: BaseClient, simple_function: QiskitFuncti
assert job.status() == "DONE"
assert isinstance(job.logs(), str)

def test_function_with_arguments(self, client: BaseClient):
def test_function_with_arguments(self, any_client: BaseClient):
"""Integration test for Functions with arguments."""
circuit = QuantumCircuit(2)
circuit.h(0)
Expand All @@ -62,7 +62,7 @@ def test_function_with_arguments(self, client: BaseClient):
working_dir=resources_path,
)

runnable_function = client.upload(arguments_function)
runnable_function = any_client.upload(arguments_function)

job = runnable_function.run(circuit=circuit)

Expand All @@ -71,7 +71,7 @@ def test_function_with_arguments(self, client: BaseClient):
assert job.status() == "DONE"
assert isinstance(job.logs(), str)

def test_dependencies_function(self, client: BaseClient):
def test_dependencies_function(self, any_client: BaseClient):
"""Integration test for Functions with dependencies."""
function = QiskitFunction(
title="pattern-with-dependencies",
Expand All @@ -80,7 +80,7 @@ def test_dependencies_function(self, client: BaseClient):
dependencies=["pendulum"],
)

runnable_function = client.upload(function)
runnable_function = any_client.upload(function)

job = runnable_function.run()

Expand All @@ -89,7 +89,7 @@ def test_dependencies_function(self, client: BaseClient):
assert job.status() == "DONE"
assert isinstance(job.logs(), str)

def test_distributed_workloads(self, client: BaseClient):
def test_distributed_workloads(self, any_client: BaseClient):
"""Integration test for Functions for distributed workloads."""

circuits = [random_circuit(2, 2) for _ in range(3)]
Expand All @@ -101,7 +101,7 @@ def test_distributed_workloads(self, client: BaseClient):
entrypoint="pattern_with_parallel_workflow.py",
working_dir=resources_path,
)
runnable_function = client.upload(function)
runnable_function = any_client.upload(function)

job = runnable_function.run(circuits=circuits)

Expand All @@ -110,7 +110,7 @@ def test_distributed_workloads(self, client: BaseClient):
assert job.status() == "DONE"
assert isinstance(job.logs(), str)

def test_multiple_runs(self, client: BaseClient):
def test_multiple_runs(self, any_client: BaseClient):
"""Integration test for run functions multiple times."""

circuits = [random_circuit(2, 2) for _ in range(3)]
Expand All @@ -122,7 +122,7 @@ def test_multiple_runs(self, client: BaseClient):
entrypoint="pattern.py",
working_dir=resources_path,
)
runnable_function = client.upload(function)
runnable_function = any_client.upload(function)

job1 = runnable_function.run()
job2 = runnable_function.run()
Expand All @@ -132,16 +132,16 @@ def test_multiple_runs(self, client: BaseClient):

assert job1.job_id != job2.job_id

retrieved_job1 = client.job(job1.job_id)
retrieved_job2 = client.job(job2.job_id)
retrieved_job1 = any_client.job(job1.job_id)
retrieved_job2 = any_client.job(job2.job_id)

assert retrieved_job1.result() is not None
assert retrieved_job2.result() is not None

assert isinstance(retrieved_job1.logs(), str)
assert isinstance(retrieved_job2.logs(), str)

def test_error(self, client: BaseClient):
def test_error(self, any_client: BaseClient):
"""Integration test to force an error."""

description = """
Expand All @@ -160,7 +160,7 @@ def test_error(self, client: BaseClient):
description=description,
)

runnable_function = client.upload(function_with_custom_image)
runnable_function = any_client.upload(function_with_custom_image)

job = runnable_function.run(message="Argument for the custum function")

Expand Down

0 comments on commit c1bc4fe

Please sign in to comment.