Skip to content

Commit

Permalink
test for analyzedir --force parameter (and make it a proper boolean f…
Browse files Browse the repository at this point in the history
…lag)
  • Loading branch information
osma committed Apr 6, 2018
1 parent 37d56b8 commit 995071a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion annif/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ def run_analyze(project_id, limit, threshold, backend_param):
@click.argument('project_id')
@click.argument('directory')
@click.option('--suffix', default='.annif')
@click.option('--force', default=False)
@click.option('--force/--no-force', default=False)
@click.option('--limit', default=10)
@click.option('--threshold', default=0.0)
@click.option('--backend-param', '-b', multiple=True)
Expand Down
8 changes: 8 additions & 0 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,14 @@ def test_analyzedir(tmpdir):
assert result.exit_code == 0
assert "Not overwriting" in result.output

# check that the --force parameter forces overwriting
result = runner.invoke(
annif.cli.cli, ['analyzedir', 'dummy-fi', '--force', str(tmpdir)])
assert tmpdir.join('doc1.annif').exists()
assert "Not overwriting" not in result.output
assert tmpdir.join('doc1.annif').read_text(
'utf-8') == "<http:https://example.org/dummy>\tdummy\t1.0\n"


def test_eval_label(tmpdir):
keyfile = tmpdir.join('dummy.key')
Expand Down

0 comments on commit 995071a

Please sign in to comment.