From 9912eff0b50a219c817027e044c0b9c429b219ac Mon Sep 17 00:00:00 2001 From: Paul O'Leary McCann Date: Wed, 25 Jan 2023 18:37:55 +0900 Subject: [PATCH] Use a more generic, parametrized test --- spacy/tests/test_cli_app.py | 46 +++++++++++-------------------------- 1 file changed, 13 insertions(+), 33 deletions(-) diff --git a/spacy/tests/test_cli_app.py b/spacy/tests/test_cli_app.py index 6d4ac1f00..3838b3406 100644 --- a/spacy/tests/test_cli_app.py +++ b/spacy/tests/test_cli_app.py @@ -92,7 +92,7 @@ dropout = 0.1 accumulate_gradient = 1 patience = 1600 max_epochs = 0 -max_steps = 20000 +max_steps = 100 eval_frequency = 200 frozen_components = [] annotating_components = [] @@ -200,44 +200,24 @@ def noop_config(): yield cfg -def test_multi_code_debug_config(code_paths, data_paths, noop_config): +@pytest.mark.parametrize( + "cmd", + [ + ["debug", "config"], + ["debug", "data"], + ["train"], + ], +) +def test_multi_code(cmd, code_paths, data_paths, noop_config): # check that it fails without the code arg - result = subprocess.run( - ["python", "-m", "spacy", "debug", "config", str(noop_config), *data_paths] - ) + cmd = ["python", "-m", "spacy"] + cmd + result = subprocess.run([*cmd, str(noop_config), *data_paths]) assert result.returncode == 1 # check that it succeeds with the code arg result = subprocess.run( [ - "python", - "-m", - "spacy", - "debug", - "config", - str(noop_config), - *data_paths, - *code_paths, - ] - ) - assert result.returncode == 0 - - -def test_multi_code_debug_data(code_paths, data_paths, noop_config): - # check that it fails without the code arg - result = subprocess.run( - ["python", "-m", "spacy", "debug", "data", str(noop_config), *data_paths] - ) - assert result.returncode == 1 - - # check that it succeeds with the code arg - result = subprocess.run( - [ - "python", - "-m", - "spacy", - "debug", - "data", + *cmd, str(noop_config), *data_paths, *code_paths,