From a468510bcc966a4137636eee72241002b11aa230 Mon Sep 17 00:00:00 2001 From: Jonathan Wren Date: Sat, 4 Feb 2023 11:07:36 -0800 Subject: [PATCH] fix first test (inject command fixture to request) --- tests/lib/fixtures.py | 10 ++++++++++ tests/lib/when_steps.py | 6 +++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/tests/lib/fixtures.py b/tests/lib/fixtures.py index 3f012e96..74630a02 100644 --- a/tests/lib/fixtures.py +++ b/tests/lib/fixtures.py @@ -201,6 +201,16 @@ def input_method(): return "" +@fixture +def all_input(): + return "" + + +@fixture +def command(): + return "" + + @fixture def cache_dir(): return {"exists": False, "path": ""} diff --git a/tests/lib/when_steps.py b/tests/lib/when_steps.py index 38ea4ab1..d0eb3c08 100644 --- a/tests/lib/when_steps.py +++ b/tests/lib/when_steps.py @@ -7,6 +7,7 @@ from contextlib import ExitStack from pytest_bdd import when from pytest_bdd.parsers import parse from pytest_bdd.parsers import re +from pytest_bdd.steps import inject_fixture from jrnl.main import run @@ -31,11 +32,14 @@ all_input = '("(?P[^"]*)")' @when(re(f'we run "jrnl ?{command}" and {input_method} {all_input}')) @when(parse('we run "jrnl {command}"')) @when('we run "jrnl"') -def we_run_jrnl(cli_run, capsys, keyring): +def we_run_jrnl(cli_run, capsys, keyring, request, command, input_method, all_input): from keyring import set_keyring set_keyring(keyring) + # fixture injection (pytest-bdd >=6.0) + inject_fixture(request, "command", command) + with ExitStack() as stack: mocks = cli_run["mocks"] factories = cli_run["mock_factories"]