Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skip remote tests in CI #75

Merged
merged 9 commits into from
Oct 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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
8 changes: 8 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[run]
omit =
# omit template files
.tox/*
.py3*/*
lint/*
coverage/*
.github/*
38 changes: 3 additions & 35 deletions .github/workflows/qiskit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,39 +15,23 @@ jobs:
python-version: "3.9"
steps:
- uses: actions/checkout@v2
- name: Check if Qiskit
run: |
echo "PASS=True" >> $GITHUB_ENV
qiskit=$(cat ecosystem.json | jq .qiskit)

if [[ "${qiskit}" == "false" ]]; then
echo "PASS=False" >> $GITHUB_ENV
echo "::notice file=ecosystem.json::Qiskit is not use here !"
else
echo "::notice file=ecosystem.json::Qiskit is using here !"
fi

- name: Set up Python ${{ env.python-version }}
if: ${{ env.PASS == 'True' }}
uses: actions/setup-python@v1
with:
python-version: ${{ env.python-version }}
- name: Set up tox env
if: ${{ env.PASS == 'True' }}
run: |
pver=${{ env.python-version }}
tox_env="-epy${pver/./}"
echo tox_env
echo TOX_ENV=$tox_env >> $GITHUB_ENV
- name: Install dependencies
if: ${{ env.PASS == 'True' }}
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install -r requirements-dev.txt
pip install qiskit --upgrade
- name: Test using tox envs
if: ${{ env.PASS == 'True' }}
env:
QS_TOKEN: ${{ secrets.QUANTUM_SERVICES_TOKEN }}
run: |
Expand All @@ -59,43 +43,27 @@ jobs:
python-version: "3.9"
steps:
- uses: actions/checkout@v2
- name: Check if Qiskit
run: |
echo "PASS=True" >> $GITHUB_ENV
qiskit=$(cat ecosystem.json | jq .qiskit)

if [[ "${qiskit}" == "false" ]]; then
echo "PASS=False" >> $GITHUB_ENV
echo "::notice file=ecosystem.json::Qiskit is not use here !"
else
echo "::notice file=ecosystem.json::Qiskit is using here !"
fi

- name: Set up Python ${{ env.python-version }}
if: ${{ env.PASS == 'True' }}
uses: actions/setup-python@v1
with:
python-version: ${{ env.python-version }}
- name: Set up tox env
if: ${{ env.PASS == 'True' }}
run: |
pver=${{ env.python-version }}
tox_env="-epy${pver/./}"
echo tox_env
echo TOX_ENV=$tox_env >> $GITHUB_ENV
- name: Install dependencies
if: ${{ env.PASS == 'True' }}
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install -r requirements-dev.txt
git clone https://github.com/Qiskit/qiskit-terra.git
cd qiskit-terra
git clone https://github.com/Qiskit/qiskit.git
cd qiskit
pip install cython
pip uninstall qiskit-terra --yes
pip uninstall qiskit --yes
pip install .
- name: Test using tox envs
if: ${{ env.PASS == 'True' }}
env:
QS_TOKEN: ${{ secrets.QUANTUM_SERVICES_TOKEN }}
run: |
Expand Down
6 changes: 2 additions & 4 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,9 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install tox
#curl https://raw.githubusercontent.com/qiskit-community/ecosystem/main/ecosystem/templates/.pylintrc > .pylintrc
- name: Run styles check
run: tox -elint
json-lint:
ecosystem-lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
Expand All @@ -45,7 +44,7 @@ jobs:
python -m pip install --upgrade pip
pip install tox
- name: Validate ecosystem.json
run: tox -ejson
run: tox -eecosystem
tests:
runs-on: ubuntu-latest
strategy:
Expand Down Expand Up @@ -87,7 +86,6 @@ jobs:
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install -r requirements-dev.txt
curl https://raw.githubusercontent.com/qiskit-community/ecosystem/main/ecosystem/templates/.coveragerc > .coveragerc
- name: Run coverage
env:
QS_TOKEN: ${{ secrets.QUANTUM_SERVICES_TOKEN }}
Expand Down
7 changes: 3 additions & 4 deletions ecosystem.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,13 @@
"versions": ["3.9"]
},
"tests_command": [
"pytest -v q_kernel_ops --skip=q_kernel_ops.workflow"
"pytest -v q_kernel_ops"
],
"styles_check_command": [
"pylint -rn q_kernel_ops tests"
],
"coverages_check_command": [
"coverage3 run -m pytest",
"coverage3 report --fail-under=80"
],
"qiskit": true
"coverage3 report --fail-under=70"
]
}
3 changes: 2 additions & 1 deletion tests/runtime/test_run_runtime.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""Tests for Kernel commands."""
from unittest import TestCase
from unittest import TestCase, skip
from q_kernel_ops.runtime import Runtime
from q_kernel_ops.circuits import circuit_2, circuit_5, kernel_circuit
from tests.test_workflow import authentication
Expand All @@ -8,6 +8,7 @@
class TestUtils(TestCase):
"""Test class for runtime functions."""

@skip("Remote call.")
def test_run_runtime(self):
"""Test for run sampler function."""
authentication()
Expand Down
4 changes: 3 additions & 1 deletion tests/test_workflow.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Tests for CLI commands."""
import os
from unittest import TestCase
from unittest import TestCase, skip
from qiskit_ibm_runtime import QiskitRuntimeService
import pandas as pd
from cvxopt import matrix
Expand All @@ -17,13 +17,15 @@ def authentication():
class TestUtils(TestCase):
"""Test class for Workflow cli."""

@skip("Remote call.")
def test_authentication(self):
"""Test for Authentication command."""
authentication()

service = QiskitRuntimeService()
self.assertTrue(service.active_account()["verify"], True)

@skip("Remote call.")
def test_kernel_flow(self):
"""Test for Kernel flow command."""
authentication()
Expand Down
6 changes: 3 additions & 3 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ commands =
basepython = python3
commands =
coverage3 run -m unittest -v
coverage3 report --fail-under=80
coverage3 report --fail-under=70

[testenv:black]
envdir = .tox/lint
commands = black {posargs} q_kernel_ops tests --check

[testenv:json]
[testenv:ecosystem]
allowlist_externals = /bin/bash
commands =
bash -ec 'cat ecosystem.json | jq empty'
/bin/bash -ec 'cat ecosystem.json | jq empty'
Loading