Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Analyzedir command #95

Merged
merged 5 commits into from
Apr 6, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
test for analyzedir --force parameter (and make it a proper boolean f…
…lag)
  • Loading branch information
osma committed Apr 6, 2018
commit 995071ace004ecc7c6e0eccfc7db855be4382c6f
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