Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Running gherkin reporter on pytest-bdd tests raises KeyError

Aperta
#271 0 commenti 1 reazione 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
52/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
python
Ambito
testing-qa

Direzione di ricerca

Riproduci il malfunzionamento con il comando pytest mostrato, quindi esamina pytest_bdd/gherkin_terminal_reporter.py in corrispondenza di pytest_runtest_logreport e _format_step_name. Verifica che il test parametrizzato venga completato senza il KeyError e che il report Gherkin espanso gestisca i parametri dell’esempio.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Running below test:

pytest -k 'test_parametrized' --gherkin-terminal-reporter --gherkin-terminal-reporter-expanded

Raises following error:

Feature:
    Scenario: Parametrized given, when, thens
INTERNALERROR> Traceback (most recent call last):
INTERNALERROR>   File "/Users/milosz.sliwinski/.virtualenvs/pytest-bdd/lib/python2.7/site-packages/_pytest/main.py", line 96, in wrap_session
INTERNALERROR>     session.exitstatus = doit(config, session) or 0
INTERNALERROR>   File "/Users/milosz.sliwinski/.virtualenvs/pytest-bdd/lib/python2.7/site-packages/_pytest/main.py", line 131, in _main
INTERNALERROR>     config.hook.pytest_runtestloop(session=session)
INTERNALERROR>   File "/Users/milosz.sliwinski/.virtualenvs/pytest-bdd/lib/python2.7/site-packages/_pytest/vendored_packages/pluggy.py", line 724, in __call__
INTERNALERROR>     return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
INTERNALERROR>   File "/Users/milosz.sliwinski/.virtualenvs/pytest-bdd/lib/python2.7/site-packages/_pytest/vendored_packages/pluggy.py", line 338, in _hookexec
INTERNALERROR>     return self._inner_hookexec(hook, methods, kwargs)
INTERNALERROR>   File "/Users/milosz.sliwinski/.virtualenvs/pytest-bdd/lib/python2.7/site-packages/_pytest/vendored_packages/pluggy.py", line 333, in <lambda>
INTERNALERROR>     _MultiCall(methods, kwargs, hook.spec_opts).execute()
INTERNALERROR>   File "/Users/milosz.sliwinski/.virtualenvs/pytest-bdd/lib/python2.7/site-packages/_pytest/vendored_packages/pluggy.py", line 596, in execute
INTERNALERROR>     res = hook_impl.function(*args)
INTERNALERROR>   File "/Users/milosz.sliwinski/.virtualenvs/pytest-bdd/lib/python2.7/site-packages/_pytest/main.py", line 152, in pytest_runtestloop
INTERNALERROR>     item.config.hook.pytest_runtest_protocol(item=item, nextitem=nextitem)
INTERNALERROR>   File "/Users/milosz.sliwinski/.virtualenvs/pytest-bdd/lib/python2.7/site-packages/_pytest/vendored_packages/pluggy.py", line 724, in __call__
INTERNALERROR>     return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
INTERNALERROR>   File "/Users/milosz.sliwinski/.virtualenvs/pytest-bdd/lib/python2.7/site-packages/_pytest/vendored_packages/pluggy.py", line 338, in _hookexec
INTERNALERROR>     return self._inner_hookexec(hook, methods, kwargs)
INTERNALERROR>   File "/Users/milosz.sliwinski/.virtualenvs/pytest-bdd/lib/python2.7/site-packages/_pytest/vendored_packages/pluggy.py", line 333, in <lambda>
INTERNALERROR>     _MultiCall(methods, kwargs, hook.spec_opts).execute()
INTERNALERROR>   File "/Users/milosz.sliwinski/.virtualenvs/pytest-bdd/lib/python2.7/site-packages/_pytest/vendored_packages/pluggy.py", line 595, in execute
INTERNALERROR>     return _wrapped_call(hook_impl.function(*args), self.execute)
INTERNALERROR>   File "/Users/milosz.sliwinski/.virtualenvs/pytest-bdd/lib/python2.7/site-packages/_pytest/vendored_packages/pluggy.py", line 253, in _wrapped_call
INTERNALERROR>     return call_outcome.get_result()
INTERNALERROR>   File "/Users/milosz.sliwinski/.virtualenvs/pytest-bdd/lib/python2.7/site-packages/_pytest/vendored_packages/pluggy.py", line 279, in get_result
INTERNALERROR>     _reraise(*ex)  # noqa
INTERNALERROR>   File "/Users/milosz.sliwinski/.virtualenvs/pytest-bdd/lib/python2.7/site-packages/_pytest/vendored_packages/pluggy.py", line 264, in __init__
INTERNALERROR>     self.result = func()
INTERNALERROR>   File "/Users/milosz.sliwinski/.virtualenvs/pytest-bdd/lib/python2.7/site-packages/_pytest/vendored_packages/pluggy.py", line 596, in execute
INTERNALERROR>     res = hook_impl.function(*args)
INTERNALERROR>   File "/Users/milosz.sliwinski/.virtualenvs/pytest-bdd/lib/python2.7/site-packages/_pytest/runner.py", line 66, in pytest_runtest_protocol
INTERNALERROR>     runtestprotocol(item, nextitem=nextitem)
INTERNALERROR>   File "/Users/milosz.sliwinski/.virtualenvs/pytest-bdd/lib/python2.7/site-packages/_pytest/runner.py", line 79, in runtestprotocol
INTERNALERROR>     reports.append(call_and_report(item, "call", log))
INTERNALERROR>   File "/Users/milosz.sliwinski/.virtualenvs/pytest-bdd/lib/python2.7/site-packages/_pytest/runner.py", line 137, in call_and_report
INTERNALERROR>     hook.pytest_runtest_logreport(report=report)
INTERNALERROR>   File "/Users/milosz.sliwinski/.virtualenvs/pytest-bdd/lib/python2.7/site-packages/_pytest/vendored_packages/pluggy.py", line 724, in __call__
INTERNALERROR>     return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
INTERNALERROR>   File "/Users/milosz.sliwinski/.virtualenvs/pytest-bdd/lib/python2.7/site-packages/_pytest/vendored_packages/pluggy.py", line 338, in _hookexec
INTERNALERROR>     return self._inner_hookexec(hook, methods, kwargs)
INTERNALERROR>   File "/Users/milosz.sliwinski/.virtualenvs/pytest-bdd/lib/python2.7/site-packages/_pytest/vendored_packages/pluggy.py", line 333, in <lambda>
INTERNALERROR>     _MultiCall(methods, kwargs, hook.spec_opts).execute()
INTERNALERROR>   File "/Users/milosz.sliwinski/.virtualenvs/pytest-bdd/lib/python2.7/site-packages/_pytest/vendored_packages/pluggy.py", line 596, in execute
INTERNALERROR>     res = hook_impl.function(*args)
INTERNALERROR>   File "/Users/milosz.sliwinski/workspace/pytest-bdd/pytest_bdd/gherkin_terminal_reporter.py", line 104, in pytest_runtest_logreport
INTERNALERROR>     step_name = self._format_step_name(step['name'], **report.scenario['example_kwargs'])
INTERNALERROR>   File "/Users/milosz.sliwinski/workspace/pytest-bdd/pytest_bdd/gherkin_terminal_reporter.py", line 122, in _format_step_name
INTERNALERROR>     param_value = example_kwargs[param_name]
INTERNALERROR> KeyError: u'start'
Lingua principale
Python
Stelle
1.5k
Fork
251
Merge medio
43m
PR unite (30g)
2

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di pytest-dev/pytest-bdd

Tutte le issue di pytest-dev/pytest-bdd

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.