Skip to content

Commit

Permalink
Fix archive_datasets tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jochenklar committed Jan 4, 2024
1 parent 446044e commit 8b2e47a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
17 changes: 14 additions & 3 deletions isimip_publisher/tests/test_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,13 +298,24 @@ def test_update_datasets(setup, public_files, db, public_datasets, script_runner
assert response.stderr.strip().startswith('update_datasets')


def test_archive_datasets(setup, db, public_datasets, script_runner):
response = script_runner.run(['isimip-publisher', 'archive_datasets', 'round/product/sector/model'])
def test_archive_datasets_yes(setup, db, mocker, public_datasets, script_runner):
mocker.patch('builtins.input', return_value='yes')

response = script_runner.run('isimip-publisher', 'archive_datasets', 'round/product/sector/model')
assert response.success, response.stderr
assert not response.stdout
assert response.stdout.strip().startswith('Archiving')
assert response.stderr.strip().startswith('archive_datasets')


def test_archive_datasets_no(setup, db, mocker, public_datasets, script_runner):
mocker.patch('builtins.input', return_value='no')

response = script_runner.run(['isimip-publisher', 'archive_datasets', 'round/product/sector/model'])
assert response.success
assert response.stdout.strip().startswith('Archiving')
assert not response.stderr


def test_check(setup, public_files, db, public_datasets, script_runner):
response = script_runner.run(['isimip-publisher', 'check', 'round/product/sector/model'])
assert response.success, response.stderr
Expand Down
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ version = { attr = "isimip_publisher.__version__" }

[tool.pytest.ini_options]
python_files = "test_*.py"
script_launch_mode = "subprocess"

[tool.ruff]
target-version = "py38"
Expand Down

0 comments on commit 8b2e47a

Please sign in to comment.