Skip to content
This repository has been archived by the owner on Jun 17, 2024. It is now read-only.

Commit

Permalink
chore: fix integration test
Browse files Browse the repository at this point in the history
  • Loading branch information
miwurster committed Nov 16, 2023
1 parent 3a98baf commit 647963a
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 14 deletions.
12 changes: 6 additions & 6 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ dependencies:
- pip>=21.1.3
- pydantic=1.9.0
- pip:
# dev dependencies
## dev dependencies
- qiskit==0.44.1
- qiskit-ibm-runtime==0.14.0
- setuptools
Expand All @@ -17,13 +17,13 @@ dependencies:
- busypie
- retrying
- python-dotenv
# prod dependencies
## prod dependencies
- requests
## aws braket
#we need the latest dev version as this fixes the issue with the Rigetti's qubit ids
# aws braket
# we need the latest dev version as this fixes the issue with the Rigetti's qubit ids
- git+https://github.com/qiskit-community/qiskit-braket-provider.git@main
## azure quantum
# azure quantum
- azure-quantum[qiskit]==0.28.*
- qiskit-ionq==0.4.4
## dwave
# dwave
- dwave-ocean-sdk==6.4.1
2 changes: 1 addition & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
### This file is used to configure pytest
# This file is used to configure pytest

def pytest_collection_modifyitems(config, items):
"""
Expand Down
11 changes: 5 additions & 6 deletions tests/integration/test_credentials.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import os
import unittest.mock

from planqk.qiskit import PlanqkQuantumProvider


Expand All @@ -9,18 +10,16 @@ def setUp(self):
if "SERVICE_EXECUTION_TOKEN" in os.environ:
del os.environ["SERVICE_EXECUTION_TOKEN"]


def test_should_use_user_provided_token(self):
access_token = "user_access_token"
planqk_provider = PlanqkQuantumProvider(
access_token)
planqk_provider = PlanqkQuantumProvider(access_token)
self.assertEqual(planqk_provider.get_access_token(), access_token)

def test_env_provided_token_priority(self):
access_token = "service_access_token"
os.environ["SERVICE_EXECUTION_TOKEN"] = access_token

planqk_provider = PlanqkQuantumProvider(
"user_access_token")
planqk_provider = PlanqkQuantumProvider("user_access_token")

# env set token must have priority to access token set by user
self.assertEqual(access_token, planqk_provider.get_access_token())
self.assertEqual("user_access_token", planqk_provider.get_access_token())
3 changes: 3 additions & 0 deletions tests/unit/planqk/client_mocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
"avg_queue_time": 10,
"unknown_attr": "yes",
}

oqc_lucy_mock = {
"id": "aws.oqc.lucy",
"internal_id": "mock_internal_id_2",
Expand Down Expand Up @@ -91,6 +92,7 @@
"updated_at": "2023-07-12T12:00:00",
"avg_queue_time": 20
}

job_mock = {
"backend_id": "aws.rigetti.aspen",
"provider": "AWS",
Expand All @@ -110,6 +112,7 @@
"unknown_attr": "yes",
"tags": {"tag1", "tag2"}
}

job_result_mock = {
"counts": {
"100": 2,
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/planqk/test_credentials.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from planqk.credentials import ConfigFileCredential


class CredentialProviderTestSuite(unittest.TestCase):
class CredentialsTestSuite(unittest.TestCase):

def test_should_get_access_token_from_config_file(self):
provider = ConfigFileCredential()
Expand Down

0 comments on commit 647963a

Please sign in to comment.