Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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: 4 additions & 2 deletions .ado/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ schedules:
variables:
- name: QSHARP_PYTHON_TELEMETRY
value: none # Disable usage telemetry for internal test pipelines
- name: PYTEST_MAX_PARALLEL_TESTS
value: 'auto'

jobs:
- job: "Build_Azure_Quantum_Python"
Expand Down Expand Up @@ -58,7 +60,7 @@ jobs:
displayName: Set Python version

- script: |
pip install pytest pytest-azurepipelines pytest-cov pytest-regressions
pip install pytest pytest-azurepipelines pytest-cov pytest-xdist
displayName: Install pytest dependencies

- script: |
Expand All @@ -68,7 +70,7 @@ jobs:
- script: |
cd $(Build.SourcesDirectory)/azure-quantum
pip install .[qiskit,cirq,qsharp,dev]
pytest --cov-report term --cov=azure.quantum --junitxml test-output-azure-quantum.xml $(Build.SourcesDirectory)/azure-quantum
pytest --numprocesses $(PYTEST_MAX_PARALLEL_TESTS) --cov-report term --cov=azure.quantum --junitxml test-output-azure-quantum.xml $(Build.SourcesDirectory)/azure-quantum
displayName: Run azure-quantum unit tests

- task: PublishTestResults@2
Expand Down
6 changes: 4 additions & 2 deletions .ado/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ variables:
value: 'xiou'
- name: QSHARP_PYTHON_TELEMETRY
value: none # Disable usage telemetry for internal test pipelines
- name: PYTEST_MAX_PARALLEL_TESTS
value: 'auto'

resources:
repositories:
Expand Down Expand Up @@ -108,7 +110,7 @@ extends:
displayName: Set Python version

- script: |
pip install pytest pytest-azurepipelines pytest-cov pytest-regressions
pip install pytest pytest-azurepipelines pytest-cov pytest-xdist
displayName: Install pytest dependencies

- script: |
Expand All @@ -118,7 +120,7 @@ extends:
- script: |
cd $(Build.SourcesDirectory)/azure-quantum
pip install .[qiskit,cirq,qsharp,dev]
pytest --cov-report term --cov=azure.quantum --junitxml test-output-azure-quantum.xml $(Build.SourcesDirectory)/azure-quantum
pytest --numprocesses $(PYTEST_MAX_PARALLEL_TESTS) --cov-report term --cov=azure.quantum --junitxml test-output-azure-quantum.xml $(Build.SourcesDirectory)/azure-quantum
displayName: Run Unit-tests

- task: PublishTestResults@2
Expand Down
14 changes: 14 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"pythonTestExplorer.testFramework": "pytest",
"pythonTestExplorer.outputs.showOutputsOnRun": true,
"testExplorer.useNativeTesting": false,
"testExplorer.showOnRun": true,
"testExplorer.addToEditorContextMenu": true,
"python.testing.pytestArgs": [
"./azure-quantum/tests/unit",
"-n",
"4"
],
"python.testing.unittestEnabled": false,
"python.testing.pytestEnabled": true
}
7 changes: 0 additions & 7 deletions azure-quantum/.vscode/settings.json

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ def get_credential_or_default(self) -> Any:
or defaults to a new DefaultAzureCredential.
"""
return (self.credential
or DefaultAzureCredential())
or DefaultAzureCredential(exclude_interactive_browser_credential=False))

def get_auth_policy(self) -> Any:
"""
Expand Down
1 change: 1 addition & 0 deletions azure-quantum/requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
pytest>=7.1.2
pytest-xdist>=3.8.0,<4.0
vcrpy>=4.3.1 # fixes https://github.com/kevin1024/vcrpy/issues/688
azure-devtools>=1.2.0,<2.0
graphviz>=0.20.1
2 changes: 1 addition & 1 deletion azure-quantum/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ azure-identity>=1.17,<2.0
# More than one match for "https://mystorage.blob.core.windows.net/.../rawOutputData"
azure-storage-blob==12.20
msrest>=0.7.1,<1.0
numpy>=1.21.0,<2.0
numpy>=1.21.0,<3.0
deprecated>=1.2.12,<2.0
Markdown>=3.4.1
python-markdown-math>=0.8
9 changes: 7 additions & 2 deletions azure-quantum/tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,16 @@ This will force the recording files to be deleted before running the tests.

To run the tests in recording or live mode, make sure:

- You have installed [Azure CLI](https://learn.microsoft.com/en-us/cli/azure/install-azure-cli?view=azure-cli-latest).
- You're logged into your Azure Entra ID Tenant in the Azure CLI - `az login` (or `az login --tenant <tenantId>`).
- You have a client app registered in Microsoft Entra ID (formerly Azure Active Directory)
- The client app is configured with [certificate-based authentication](https://learn.microsoft.com/en-us/entra/identity/authentication/how-to-certificate-based-authentication)
- The client app has "Contributor" permissions to your Azure Quantum Workspace
- You have "Quantum Workspace Owner" or "Quantum Workspace Data Contributor" or "Contributor" role on the Azure Quantum Workspace against which you would like to capture the recordings.
- You have all necessary Providers added to the Azure Quantum Workspace.
- The following environment variables are set:
- `AZURE_CLIENT_ID` - application (client) ID from Microsoft Entra ID
- `AZURE_TENANT_ID` - directory (tenant) ID from Microsoft Entra ID
- `AZURE_CLIENT_CERTIFICATE_PATH` - path to PEM or PKCS12 certificate file (including the private key) that is configured for the client app
- `AZURE_CLIENT_SEND_CERTIFICATE_CHAIN=True` - prompts Azure.Identity to set X5C header (specifying certificate chain) required to support SNI authentication
- `AZURE_QUANTUM_SUBSCRIPTION_ID` - ID of the Subscription where Azure Quantum Workspace is deployed
- `AZURE_QUANTUM_WORKSPACE_RG` - name of the Resource Group where Azure Quantum Workspace is deployed
- `AZURE_QUANTUM_WORKSPACE_NAME` - name of the Azure Quantum Workspace
Expand Down
4 changes: 2 additions & 2 deletions azure-quantum/tests/unit/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
)
from azure.quantum import Job
from azure.quantum.target import Target
from azure.identity import ClientSecretCredential, AzureCliCredential
from azure.identity import ClientSecretCredential, EnvironmentCredential


ZERO_UID = "00000000-0000-0000-0000-000000000000"
Expand Down Expand Up @@ -304,7 +304,7 @@ def create_workspace(
client_secret=PLACEHOLDER)

workspace = Workspace(
credential=credential if credential else AzureCliCredential(),
credential=credential if credential else EnvironmentCredential(),
subscription_id=connection_params.subscription_id,
resource_group=connection_params.resource_group,
name=connection_params.workspace_name,
Expand Down
Loading
Loading