mirror of
https://github.com/simonw/datasette.git
synced 2026-11-06 10:18:32 +01:00
Merge a25c656e83 into c435a80030
This commit is contained in:
commit
01d180ccc4
4 changed files with 69 additions and 1 deletions
|
|
@ -213,6 +213,48 @@ def test_install_requirements(run_module, tmpdir):
|
|||
assert sys.argv == ["pip", "install", "-r", str(path)]
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"flag,expected_arg",
|
||||
[
|
||||
("--pre", "--pre"),
|
||||
("--force-reinstall", "--force-reinstall"),
|
||||
("--no-cache-dir", "--no-cache-dir"),
|
||||
],
|
||||
)
|
||||
@mock.patch("datasette.cli.run_module")
|
||||
def test_install_flags(run_module, flag, expected_arg):
|
||||
runner = CliRunner()
|
||||
runner.invoke(cli, ["install", flag, "datasette-mock-plugin"])
|
||||
run_module.assert_called_once_with("pip", run_name="__main__")
|
||||
assert sys.argv == ["pip", "install", expected_arg, "datasette-mock-plugin"]
|
||||
|
||||
|
||||
@mock.patch("datasette.cli.run_module")
|
||||
def test_install_multiple_options(run_module):
|
||||
runner = CliRunner()
|
||||
runner.invoke(
|
||||
cli,
|
||||
[
|
||||
"install",
|
||||
"--pre",
|
||||
"--force-reinstall",
|
||||
"--no-cache-dir",
|
||||
"-U",
|
||||
"datasette-mock-plugin",
|
||||
],
|
||||
)
|
||||
run_module.assert_called_once_with("pip", run_name="__main__")
|
||||
assert sys.argv == [
|
||||
"pip",
|
||||
"install",
|
||||
"--upgrade",
|
||||
"--pre",
|
||||
"--force-reinstall",
|
||||
"--no-cache-dir",
|
||||
"datasette-mock-plugin",
|
||||
]
|
||||
|
||||
|
||||
def test_install_error_if_no_packages():
|
||||
runner = CliRunner()
|
||||
result = runner.invoke(cli, ["install"])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue