Skip to content

Commit

Permalink
Merge pull request #194 from xylar/improve-tests
Browse files Browse the repository at this point in the history
Improve tests
  • Loading branch information
xylar authored Sep 24, 2024
2 parents 84936cc + 39586ca commit f24de1f
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build_workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ jobs:
conda activate mache_dev
pip check
mache sync diags --help
python conda/run_test.py
pytest tests
- if: ${{ steps.skip_check.outputs.should_skip != 'true' }}
name: Build Sphinx Docs
Expand Down
4 changes: 0 additions & 4 deletions .github/workflows/docs_workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,16 +54,12 @@ jobs:
run: |
set -e
conda activate mache_dev
pip check
mache sync diags --help
cd docs
sphinx-multiversion . _build/html
- name: Copy Docs and Commit
run: |
set -e
conda activate mache_dev
pip check
mache sync diags --help
cd docs
# gh-pages branch must already exist
git clone https://github.com/E3SM-Project/mache.git --branch gh-pages --single-branch gh-pages
Expand Down
4 changes: 4 additions & 0 deletions conda/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,17 @@ requirements:
- rsync

test:
source_files:
- tests
requires:
- pip
- pytest
imports:
- mache
commands:
- mache sync diags --help
- pip check
- pytest tests

about:
home: https://github.com/E3SM-Project/mache
Expand Down
11 changes: 0 additions & 11 deletions conda/run_test.py

This file was deleted.

Empty file added tests/__init__.py
Empty file.
21 changes: 21 additions & 0 deletions tests/test_machine_info.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
from mache import MachineInfo, discover_machine


def test_discover_machine():
discover_machine()


def test_machine_info():
machine = 'anvil'
machinfo = MachineInfo(machine=machine)
assert machinfo.machine == machine
assert machinfo.e3sm_supported
config = machinfo.config
assert config.get('sync', 'hostname') == 'blues.lcrc.anl.gov'
print(machinfo)

machine = 'unknown'
machinfo = MachineInfo(machine=machine)
assert machinfo.machine == machine
assert not machinfo.e3sm_supported
print(machinfo)

0 comments on commit f24de1f

Please sign in to comment.