Skip to content

Commit

Permalink
Add a simple async CLI test in CI
Browse files Browse the repository at this point in the history
  • Loading branch information
ml-evs committed May 25, 2022
1 parent 3d60102 commit 8251d4f
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,32 @@ jobs:
OPTIMADE_DATABASE_BACKEND: 'mongodb'
OPTIMADE_INSERT_TEST_DATA: false # Must be specified as previous steps will have already inserted the test data

- name: Run the OPTIMADE Client CLI
if: matrix.python-version == 3.8
run: |
coverage run --append --source optimade optimade/client/cli.py \
--filter 'nsites = 1' \
--output-file test_get_async.json \
https://optimade.herokuapp.com
test test_get_async.json
coverage run --append --source optimade optimade/client/cli.py \
--filter 'nsites = 1' \
--count \
--output-file test_count.json \
https://optimade.herokuapp.com
test test_count.json
coverage run --append --source optimade optimade/client/cli.py \
--no-async \
--filter 'nsites = 1' \
--count \
--output-file test_count_no_async.json \
https://optimade.herokuapp.com
test test_count_no_async.json
diff test_count_no-async.json test_count.json
- name: Upload coverage to Codecov
if: matrix.python-version == 3.8 && github.repository == 'Materials-Consortia/optimade-python-tools'
uses: codecov/codecov-action@v3
Expand Down
4 changes: 4 additions & 0 deletions optimade/client/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,3 +132,7 @@ def _get(
if output_file:
with open(output_file, "w") as f:
json.dump(results, f, indent=2, default=lambda _: _.dict())


if __name__ == "__main__":
get()

0 comments on commit 8251d4f

Please sign in to comment.