Skip to content

Commit

Permalink
skip ocpapi integration tests in default test workflow (#696)
Browse files Browse the repository at this point in the history
* skip ocpapi integration tests

* missed conftest include
  • Loading branch information
misko authored May 15, 2024
1 parent 0bda75a commit 2715160
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
- name: Test core with pytest
run: |
pytest tests -vv --cov-report=xml --cov=fairchem -c ./packages/fairchem-core/pyproject.toml
pytest tests -vv --skip-ocpapi-integration --cov-report=xml --cov=fairchem -c ./packages/fairchem-core/pyproject.toml
- if: ${{ matrix.python_version == '3.11' }}
name: codecov-report
Expand Down
22 changes: 22 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# conftest.py

import pytest


def pytest_addoption(parser):
parser.addoption(
"--skip-ocpapi-integration", action="store_true", default=False, help="skip ocpapi integration tests"
)


def pytest_configure(config):
config.addinivalue_line("markers", "ocpapi_integration: ocpapi integration test")


def pytest_collection_modifyitems(config, items):
if config.getoption("--skip-ocpapi-integration"):
skip_ocpapi_integration = pytest.mark.skip(reason="skipping ocpapi integration")
for item in items:
if "ocpapi_integration_test" in item.keywords:
item.add_marker(skip_ocpapi_integration)
return
5 changes: 5 additions & 0 deletions tests/demo/ocpapi/tests/integration/client/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ async def test_get_adsorbate_slab_configs(self) -> None:

self.assertGreater(len(response.adsorbate_configs), 10)

@pytest.mark.ocpapi_integration_test
async def test_submit_adsorbate_slab_relaxations__gemnet_oc(self) -> None:
# Make sure that a relaxation can be started for an adsorbate
# placement on a slab with the gemnet oc model
Expand Down Expand Up @@ -257,6 +258,7 @@ async def test_submit_adsorbate_slab_relaxations__gemnet_oc(self) -> None:
self.assertNotEqual(response.system_id, "")
self.assertEqual(len(response.config_ids), 1)

@pytest.mark.ocpapi_integration_test
async def test_submit_adsorbate_slab_relaxations__equiformer_v2(self) -> None:
# Make sure that a relaxation can be started for an adsorbate
# placement on a slab with the equiformer v2 model
Expand Down Expand Up @@ -348,6 +350,7 @@ async def test_submit_adsorbate_slab_relaxations__equiformer_v2(self) -> None:
self.assertNotEqual(response.system_id, "")
self.assertEqual(len(response.config_ids), 1)

@pytest.mark.ocpapi_integration_test
async def test_get_adsorbate_slab_relaxations_request(self) -> None:
# Make sure the original request can be fetched for an already-
# submitted system.
Expand All @@ -360,6 +363,7 @@ async def test_get_adsorbate_slab_relaxations_request(self) -> None:
# of the expected fields was returned
self.assertEqual(response.adsorbate, "*CO")

@pytest.mark.ocpapi_integration_test
async def test_get_adsorbate_slab_relaxations_results__all_fields_and_configs(
self,
) -> None:
Expand All @@ -386,6 +390,7 @@ async def test_get_adsorbate_slab_relaxations_results__all_fields_and_configs(
config_ids = {c.config_id for c in response.configs}
self.assertEqual(config_ids, set(range(59)))

@pytest.mark.ocpapi_integration_test
async def test_get_adsorbate_slab_relaxations_results__limited_fields_and_configs(
self,
) -> None:
Expand Down

0 comments on commit 2715160

Please sign in to comment.