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

Selfhosted GPU tests restricted to GPU backends only #1579

Merged
merged 5 commits into from
Feb 7, 2025
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
2 changes: 1 addition & 1 deletion selfhosted
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ cp -r tests $tmpdir
cp pyproject.toml $tmpdir
cd $tmpdir/tests
source /nfs/users/github/actions-runner/_work/qibo/qibo/testenv/bin/activate
pytest
pytest --gpu-only
pytest_status=$?
if [[ $pytest_status -ne 0 ]]
then
Expand Down
15 changes: 14 additions & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,16 @@

from qibo.backends import _Global, construct_backend


def pytest_addoption(parser):
parser.addoption(
"--gpu-only",
action="store_true",
default=False,
help="Run on GPU backends only.",
)


# backends to be tested
BACKENDS = [
"numpy",
Expand Down Expand Up @@ -71,7 +81,10 @@ def pytest_configure(config):


@pytest.fixture
def backend(backend_name):
def backend(backend_name, request):
if request.config.getoption("--gpu-only"): # pragma: no cover
if backend_name not in ("cupy", "cuquantum"):
pytest.skip("Skipping non-gpu backend.")
yield get_backend(backend_name)


Expand Down