-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
80376f0
commit 92cbc39
Showing
5 changed files
with
60 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
from ref_celery.cli import app | ||
from typer.testing import CliRunner | ||
|
||
runner = CliRunner() | ||
|
||
|
||
def test_cli_help(): | ||
result = runner.invoke(app, ["--help"]) | ||
assert result.exit_code == 0 | ||
|
||
|
||
def test_cli_spawns_worker(mocker): | ||
mock_app = mocker.patch("ref_celery.cli.create_celery_app") | ||
result = runner.invoke(app, ["--package", "ref-metrics-example"]) | ||
assert result.exit_code == 0 | ||
|
||
mock_app().worker_main.assert_called_once() | ||
|
||
|
||
def test_cli_wrong_package(): | ||
result = runner.invoke(app, ["--package", "missing"]) | ||
assert result.exit_code == 1 | ||
|
||
print(result.output) | ||
assert "Package 'missing' not found" in result.output | ||
|
||
|
||
def test_cli_missing_provider(): | ||
result = runner.invoke(app, ["--package", "pandas"]) | ||
assert result.exit_code == 1 | ||
|
||
print(result.output) | ||
assert "The package must define a 'provider' variable" in result.output |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# TODO: add tests for executing tasks |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.