use system-independent commands (#12693)

This commit is contained in:
Sofie Van Landeghem 2023-06-08 11:43:36 +02:00 committed by GitHub
parent 0f9d2b01fb
commit d65e3c31a6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 11 deletions

View File

@ -103,6 +103,8 @@ def test_debug_data_trainable_lemmatizer_cli(en_vocab):
# project tests # project tests
CFG_FILE = "myconfig.cfg"
SAMPLE_PROJECT = { SAMPLE_PROJECT = {
"title": "Sample project", "title": "Sample project",
"description": "This is a project for testing", "description": "This is a project for testing",
@ -128,13 +130,8 @@ SAMPLE_PROJECT = {
{ {
"name": "create", "name": "create",
"help": "make a file", "help": "make a file",
"script": ["touch abc.txt"], "script": [f"python -m spacy init config {CFG_FILE}"],
"outputs": ["abc.txt"], "outputs": [f"{CFG_FILE}"],
},
{
"name": "clean",
"help": "remove test file",
"script": ["rm abc.txt"],
}, },
], ],
} }
@ -175,7 +172,7 @@ def test_project_assets(project_dir):
def test_project_run(project_dir): def test_project_run(project_dir):
# make sure dry run works # make sure dry run works
test_file = project_dir / "abc.txt" test_file = project_dir / CFG_FILE
result = CliRunner().invoke( result = CliRunner().invoke(
app, ["project", "run", "--dry", "create", str(project_dir)] app, ["project", "run", "--dry", "create", str(project_dir)]
) )
@ -223,14 +220,13 @@ def test_project_push_pull(project_dir):
proj_text = srsly.yaml_dumps(proj) proj_text = srsly.yaml_dumps(proj)
(project_dir / "project.yml").write_text(proj_text) (project_dir / "project.yml").write_text(proj_text)
test_file = project_dir / "abc.txt" test_file = project_dir / CFG_FILE
result = CliRunner().invoke(app, ["project", "run", "create", str(project_dir)]) result = CliRunner().invoke(app, ["project", "run", "create", str(project_dir)])
assert result.exit_code == 0 assert result.exit_code == 0
assert test_file.is_file() assert test_file.is_file()
result = CliRunner().invoke(app, ["project", "push", remote, str(project_dir)]) result = CliRunner().invoke(app, ["project", "push", remote, str(project_dir)])
assert result.exit_code == 0 assert result.exit_code == 0
result = CliRunner().invoke(app, ["project", "run", "clean", str(project_dir)]) test_file.unlink()
assert result.exit_code == 0
assert not test_file.exists() assert not test_file.exists()
result = CliRunner().invoke(app, ["project", "pull", remote, str(project_dir)]) result = CliRunner().invoke(app, ["project", "pull", remote, str(project_dir)])
assert result.exit_code == 0 assert result.exit_code == 0