Skip to content

Commit

Permalink
move ocpapi to integration tests (#736)
Browse files Browse the repository at this point in the history
* move to integration tests

* remove code cov for integration

* move integration to separate workflow

* add change to see if integration test triggers

* remove skip markers

* change to on pull request

* add test back, remove continue-on-error
  • Loading branch information
rayg1234 authored Jun 21, 2024
1 parent 929e58a commit 5576623
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 5 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/integration-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: integration-test

on:
pull_request:
paths: # this will only trigger on changes to the demo directory, add more here if required
- 'src/fairchem/demo/**'
workflow_call:

jobs:
test:
runs-on: ubuntu-latest # TODO add macos tests too
strategy:
max-parallel: 10
matrix:
python_version: ['3.9', '3.11']

steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python_version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python_version }}

- name: Cache pip
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
${{ runner.os }}-
- name: Install core dependencies and package
run: |
python -m pip install --upgrade pip
if [ -f packages/requirements.txt ]; then pip install -r packages/requirements.txt; fi
if [ -f packages/requirements-optional.txt ]; then pip install -r packages/requirements-optional.txt; fi
pip install -e packages/fairchem-core[dev]
pip install -e packages/fairchem-data-oc[dev]
pip install -e packages/fairchem-demo-ocpapi[dev]
pip install -e packages/fairchem-applications-cattsunami
- name: Integration tests
run: | # skip-ocpapi-integration skips expensive tests with the tag "@pytest.mark.ocpapi_integration_test"
pytest tests/demo/ocpapi/tests/integration/ --skip-ocpapi-integration -c ./packages/fairchem-core/pyproject.toml
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 --skip-ocpapi-integration --cov-report=xml --cov=fairchem -c ./packages/fairchem-core/pyproject.toml
pytest tests -vv --ignore=tests/demo/ocpapi/tests/integration/ --cov-report=xml --cov=fairchem -c ./packages/fairchem-core/pyproject.toml
- if: ${{ matrix.python_version == '3.11' }}
name: codecov-report
Expand Down
2 changes: 1 addition & 1 deletion src/fairchem/demo/ocpapi/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ write("POSCAR", ase_atoms, "vasp")

## Citing `fairchem-demo-ocpapi`

If you use `fairchem-demo-ocpapi` in your research, please consider citing the [AdsorbML paper](https://www.nature.com/articles/s41524-023-01121-5) (in addition to the relevant datasets / models used):
If you use `fairchem-demo-ocpapi` in your research , please consider citing the [AdsorbML paper](https://www.nature.com/articles/s41524-023-01121-5) (in addition to the relevant datasets / models used):

```bibtex
@article{lan2023adsorbml,
Expand Down
3 changes: 0 additions & 3 deletions tests/demo/ocpapi/tests/integration/client/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,6 @@ 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 @@ -363,7 +362,6 @@ 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 @@ -390,7 +388,6 @@ 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
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from typing import List
from unittest import IsolatedAsyncioTestCase

import pytest
import requests

from fairchem.demo.ocpapi.client import AdsorbateSlabConfigs, Client, Status
Expand Down Expand Up @@ -70,6 +71,7 @@ async def test_wait_for_adsorbate_slab_relaxations(self) -> None:
# when there is a poor connection or the server is busy
self.assertLess(took, 5)

@pytest.mark.ocpapi_integration_test
async def test_find_adsorbate_binding_sites(self) -> None:
# Run an end-to-end test to find adsorbate binding sites on the
# surface of a bulk material.
Expand Down

0 comments on commit 5576623

Please sign in to comment.