I have this function that I'm trying to test. In cli.py I have
import myfunction
import click
@click.command(name="run")
@click.option("--param", required=True, type=int)
@click.option("--plot", required=False, default=False)
def run(param, plot):
myfunction(param, plot)
In my test_cli.py
from click.testing import CliRunner
from cli import run
def test_cli():
kwargs = {"int": 5, "plot": False}
runner = CliRunner()
result = runner.invoke(run, args=kwargs)
assert resutlts.output == ""
I get the following error:
Missing option --param
--intyour test code has got out of sync (should useparamnotint). And there's a typo resultlts -> results