Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Pytest-html hook help
#6
One should NOT change __doc__ for this purpose, it is the docstring of the function
__dict__ contains function attributes, i.e. the information you want to pass, should be supplied as argument
you can use mark decorator to mark your tests
something like

import pytest

@pytest.mark.servername(server='my_server_name')
def test_function():
    # do your test
then in conftest.py (only makereport hook)
@pytest.mark.hookwrapper
def pytest_runtest_makereport(item, call):
    outcome = yield
    report = outcome.get_result()
    report.server_name = item.keywords['servername'].kwargs['server']
Reply


Messages In This Thread
Pytest-html hook help - by flashnet1 - Jan-18-2018, 07:00 AM
RE: Pytest-html hook help - by buran - Jan-18-2018, 08:10 AM
RE: Pytest-html hook help - by buran - Jan-18-2018, 10:05 AM
RE: Pytest-html hook help - by flashnet1 - Jan-18-2018, 11:54 AM
RE: Pytest-html hook help - by flashnet1 - Jan-19-2018, 12:47 PM
RE: Pytest-html hook help - by buran - Jan-19-2018, 01:52 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  I am trying to run pytest and getting error that doesn't show up when running pytest. uobouhb 1 2,063 May-20-2022, 02:19 AM
Last Post: uobouhb
  HTML multi select HTML listbox with Flask/Python rfeyer 0 4,684 Mar-14-2021, 12:23 PM
Last Post: rfeyer
  [split] Pytest-html add screenshots help rafiPython1 1 8,038 Apr-30-2020, 07:16 PM
Last Post: Gourav
  Python3 + BeautifulSoup4 + lxml (HTML -> CSV) - How to loop to next HTML/new CSV Row BrandonKastning 0 2,391 Mar-22-2020, 06:10 AM
Last Post: BrandonKastning
  Mocks with pytest Vector22 1 2,519 May-21-2018, 10:45 AM
Last Post: Vector22

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020