From 73baaf330ae8c8420a44f7803394f55c343e9e1c Mon Sep 17 00:00:00 2001 From: svlandeg Date: Fri, 28 Aug 2020 10:46:21 +0200 Subject: [PATCH 1/2] update error type --- spacy/tests/test_cli.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/spacy/tests/test_cli.py b/spacy/tests/test_cli.py index 448aaf202..756576be9 100644 --- a/spacy/tests/test_cli.py +++ b/spacy/tests/test_cli.py @@ -1,4 +1,6 @@ import pytest +from click import NoSuchOption + from spacy.gold import docs_to_json, biluo_tags_from_offsets from spacy.gold.converters import iob2docs, conll_ner2docs, conllu2docs from spacy.lang.en import English @@ -375,7 +377,7 @@ def test_parse_config_overrides(args, expected): [["--foo"], ["--x.foo", "bar", "--baz"], ["--x.foo", "bar", "baz"], ["x.foo"]], ) def test_parse_config_overrides_invalid(args): - with pytest.raises(SystemExit): + with pytest.raises(NoSuchOption): parse_config_overrides(args) From 9a8255ffd58658d7d1ff3d2b0b9827216eddfc52 Mon Sep 17 00:00:00 2001 From: svlandeg Date: Fri, 28 Aug 2020 10:50:26 +0200 Subject: [PATCH 2/2] two tests because of different exit type --- spacy/tests/test_cli.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/spacy/tests/test_cli.py b/spacy/tests/test_cli.py index 756576be9..240683f7d 100644 --- a/spacy/tests/test_cli.py +++ b/spacy/tests/test_cli.py @@ -374,13 +374,22 @@ def test_parse_config_overrides(args, expected): @pytest.mark.parametrize( "args", - [["--foo"], ["--x.foo", "bar", "--baz"], ["--x.foo", "bar", "baz"], ["x.foo"]], + [["--foo"], ["--x.foo", "bar", "--baz"]], ) def test_parse_config_overrides_invalid(args): with pytest.raises(NoSuchOption): parse_config_overrides(args) +@pytest.mark.parametrize( + "args", + [["--x.foo", "bar", "baz"], ["x.foo"]], +) +def test_parse_config_overrides_invalid_2(args): + with pytest.raises(SystemExit): + parse_config_overrides(args) + + @pytest.mark.parametrize("lang", ["en", "nl"]) @pytest.mark.parametrize( "pipeline", [["tagger", "parser", "ner"], [], ["ner", "textcat", "sentencizer"]]