Skip to content

Commit

Permalink
Merge pull request #1423 from dandi/gh-1422
Browse files Browse the repository at this point in the history
Xfail flaky ontobee tests, unless running daily tests
  • Loading branch information
yarikoptic authored Mar 25, 2024
2 parents 21ef19d + 6e33659 commit 74897b4
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
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

0 comments on commit 74897b4

Please sign in to comment.