MCPcopy Create free account
hub / github.com/NVIDIA/cuda-quantum / startUpMockServer

Function startUpMockServer

python/tests/backends/test_OQC.py:34–60  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

32
33@pytest.fixture(scope="session", autouse=True)
34def startUpMockServer():
35
36 cudaq.set_random_seed(13)
37
38 os.environ["OQC_AUTH_TOKEN"] = "fake_auth_token"
39 os.environ["OQC_DEVICE"] = "qpu:uk:-1:1234567890"
40 os.environ["OQC_URL"] = f"http://localhost:{port}"
41
42 # Launch the Mock Server
43 p = Process(target=startServer, args=(port,))
44 p.start()
45
46 if not check_server_connection(port):
47 p.terminate()
48 pytest.exit("Mock server did not start in time, skipping tests.",
49 returncode=1)
50
51 # Set the targeted QPU
52 cudaq.set_target('oqc',
53 url=f'http://localhost:{port}',
54 auth_token="fake_auth_token")
55 yield "Running the tests."
56
57 # Kill the server, remove the file
58 p.terminate()
59
60 cudaq.reset_target()
61
62
63def test_OQC_sample():

Callers

nothing calls this directly

Calls 3

check_server_connectionFunction · 0.90
exitMethod · 0.80
startMethod · 0.45

Tested by

no test coverage detected