Skip to content

Commit

Permalink
Separate out expected failing tests from expected passing tests - the
Browse files Browse the repository at this point in the history
pytest.mark.flaky() decorator seems to work fine on my local machine but
is causing CI issues - not quite sure why
  • Loading branch information
charles-turner-1 committed Feb 3, 2025
1 parent bf7f452 commit fd60ed4
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions tests/test_tutorial.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@
import intake_esm
from intake_esm.tutorial import DEFAULT_CATALOGS

tutorial_cats = list(zip(DEFAULT_CATALOGS.keys(), DEFAULT_CATALOGS.values())) + [
pytest.param('bad_key', 'bad_url', marks=pytest.mark.xfail)
]
tutorial_cats = list(zip(DEFAULT_CATALOGS.keys(), DEFAULT_CATALOGS.values()))


@pytest.mark.parametrize('name,url', tutorial_cats)
Expand All @@ -17,6 +15,13 @@ def test_get_url(name, url):
assert cat_url == url


@pytest.mark.xfail
def test_get_url_xfail():
cat_url = intake_esm.tutorial.get_url('bad_key')
assert isinstance(cat_url, str)
assert 'bad_url' == 'bad_url'


@pytest.mark.network
@pytest.mark.parametrize('name,url', tutorial_cats)
@pytest.mark.flaky(max_runs=3, min_passes=1) # Cold start related failures
Expand All @@ -27,6 +32,15 @@ def test_open_from_url(name, url):
assert cat == intake.open_esm_datastore(url)


@pytest.mark.network
@pytest.mark.xfail
def test_open_from_url_xfail():
cat_url = intake_esm.tutorial.get_url('bad_url')
cat = intake.open_esm_datastore(cat_url)
assert isinstance(cat.esmcat, intake_esm.cat.ESMCatalogModel)
assert cat == intake.open_esm_datastore('bad_url')


def test_get_available_cats():
cats = intake_esm.tutorial.get_available_cats()
assert cats == list(DEFAULT_CATALOGS.keys())

0 comments on commit fd60ed4

Please sign in to comment.