Skip to content

Commit

Permalink
Merge branch 'main' into issue-38
Browse files Browse the repository at this point in the history
  • Loading branch information
eigenbeam authored Oct 8, 2024
2 parents 13903f8 + eba7fef commit 328c8f3
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 11 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
on:
push:
branches: [main]
pull_request:

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: 3.12

- name: cache poetry install
uses: actions/cache@v4
with:
path: ~/.local
key: poetry-1.8.3-0

- uses: snok/install-poetry@v1
with:
version: 1.8.3
virtualenvs-create: true
virtualenvs-in-project: true

- name: cache deps
id: cache-deps
uses: actions/cache@v4
with:
path: .venv
key: pydeps-${{ hashFiles('**/poetry.lock') }}

- run: poetry install --no-interaction --no-root
if: steps.cache-deps.outputs.cache-hit != 'true'

- run: poetry install --no-interaction

- run: poetry run pytest
17 changes: 6 additions & 11 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,13 @@ def test_info_with_config_summarizes(cli_runner):
for key in ['auth_id', 'data_dir', 'environment', 'local_output_dir', 'kinesis_arn', 'provider', 'ummg_dir', 'version']:
assert key in result.output

def test_process_requires_config(cli_runner):
@patch('nsidc.metgen.metgen.process')
def test_process_requires_config_does_not_call_process(mock, cli_runner):
result = cli_runner.invoke(cli, ['process'])
assert not mock.called
assert result.exit_code != 0

def test_process_with_config(cli_runner):
@patch('nsidc.metgen.metgen.process')
def test_process_with_config_calls_process(mock, cli_runner):
result = cli_runner.invoke(cli, ['process', '--config', './example/modscg.ini'])
assert result.exit_code == 0

@pytest.mark.skip("Need to patch the validation")
@patch('nsidc.metgen.metgen.aws.post_to_kinesis', return_value = True)
def test_process_with_config(mock, cli_runner):
result = cli_runner.invoke(cli, ['process', '--config', './example/modscg.ini'])
assert result.exit_code == 0
assert 'Saved CNM message' in result.output
assert 'Processed granules' in result.output
assert mock.called

0 comments on commit 328c8f3

Please sign in to comment.