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

Xfail flaky ontobee tests, unless running daily tests #1423

Merged
merged 2 commits into from
Mar 25, 2024
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
4 changes: 4 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,10 @@ jobs:
echo HOME=/tmp/nfsmount/home >> "$GITHUB_ENV"
echo DANDI_DEVEL_INSTRUMENT_REQUESTS_SUPERLEN=1 >> "$GITHUB_ENV"

- name: Use scheduled test configuration
if: github.event_name == 'schedule'
run: echo PYTEST_ADDOPTS=--schedule >> "$GITHUB_ENV"

- name: Run all tests
if: matrix.mode != 'dandi-api'
run: |
Expand Down
6 changes: 6 additions & 0 deletions dandi/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ def pytest_addoption(parser: Parser) -> None:
default=False,
help="Only run tests of the new Django Dandi API",
)
parser.addoption(
"--scheduled",
action="store_true",
default=False,
help="Use configuration for a scheduled daily test run",
)


def pytest_collection_modifyitems(items: list[Item], config: Config) -> None:
Expand Down
11 changes: 11 additions & 0 deletions dandi/tests/test_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
from dateutil.tz import tzutc
from pydantic import ByteSize
import pytest
import requests
from semantic_version import Version

from .fixtures import SampleDandiset
Expand All @@ -53,6 +54,13 @@

METADATA_DIR = Path(__file__).with_name("data") / "metadata"

mark_xfail_ontobee = pytest.mark.xfail(
condition="not config.getoption('--scheduled')",
reason="Flaky ontobee site",
strict=False,
raises=requests.RequestException,
)


def test_get_metadata(simple1_nwb: Path, simple1_nwb_metadata: dict[str, Any]) -> None:
target_metadata = simple1_nwb_metadata.copy()
Expand Down Expand Up @@ -234,6 +242,7 @@ def test_timedelta2duration(td: timedelta, duration: str) -> None:
assert timedelta2duration(td) == duration


@mark_xfail_ontobee
@mark.skipif_no_network
@pytest.mark.parametrize(
"filename, metadata",
Expand Down Expand Up @@ -459,6 +468,7 @@ def test_time_extract_gest() -> None:
)


@mark_xfail_ontobee
@mark.skipif_no_network
@pytest.mark.obolibrary
@pytest.mark.parametrize(
Expand Down Expand Up @@ -489,6 +499,7 @@ def test_parseobourl(url, value):
assert parse_purlobourl(url) == value


@mark_xfail_ontobee
@pytest.mark.obolibrary
@mark.skipif_no_network
def test_species():
Expand Down
Loading