hitl_tester.test_cases.conftest

Pytest hooks for modifying tests as they run. Mainly used for modifying the HTML report.

(c) 2020-2024 TurnAround Factor, Inc.

#

CUI DISTRIBUTION CONTROL

Controlled by: DLA J68 R&D SBIP

CUI Category: Small Business Research and Technology

Distribution/Dissemination Controls: PROTECTED BY SBIR DATA RIGHTS

POC: GOV SBIP Program Manager Denise Price, 571-767-0111

Distribution authorized to U.S. Government Agencies only, to protect information not owned by the

U.S. Government and protected by a contractor’s ‘limited rights’ statement, or received with the understanding that

it is not routinely transmitted outside the U.S. Government (determination made September 14, 2024). Other requests

for this document shall be referred to ACOR DLA Logistics Operations (J-68), 8725 John J. Kingman Rd., Suite 4317,

Fort Belvoir, VA 22060-6221

#

SBIR DATA RIGHTS

Contract No.:SP4701-23-C-0083

Contractor Name: TurnAround Factor, Inc.

Contractor Address: 10365 Wood Park Ct. Suite 313 / Ashland, VA 23005

Expiration of SBIR Data Rights Period: September 24, 2029

The Government's rights to use, modify, reproduce, release, perform, display, or disclose technical data or computer

software marked with this legend are restricted during the period shown as provided in paragraph (b)(4) of the Rights

in Noncommercial Technical Data and Computer Software--Small Business Innovative Research (SBIR) Program clause

contained in the above identified contract. No restrictions apply after the expiration date shown above. Any

reproduction of technical data, computer software, or portions thereof marked with this legend must also reproduce

the markings.

 1"""
 2Pytest hooks for modifying tests as they run. Mainly used for modifying the HTML report.
 3
 4# (c) 2020-2024 TurnAround Factor, Inc.
 5#
 6# CUI DISTRIBUTION CONTROL
 7# Controlled by: DLA J68 R&D SBIP
 8# CUI Category: Small Business Research and Technology
 9# Distribution/Dissemination Controls: PROTECTED BY SBIR DATA RIGHTS
10# POC: GOV SBIP Program Manager Denise Price, 571-767-0111
11# Distribution authorized to U.S. Government Agencies only, to protect information not owned by the
12# U.S. Government and protected by a contractor’s ‘limited rights’ statement, or received with the understanding that
13# it is not routinely transmitted outside the U.S. Government (determination made September 14, 2024). Other requests
14# for this document shall be referred to ACOR DLA Logistics Operations (J-68), 8725 John J. Kingman Rd., Suite 4317,
15# Fort Belvoir, VA 22060-6221
16#
17# SBIR DATA RIGHTS
18# Contract No.:SP4701-23-C-0083
19# Contractor Name: TurnAround Factor, Inc.
20# Contractor Address: 10365 Wood Park Ct. Suite 313 / Ashland, VA 23005
21# Expiration of SBIR Data Rights Period: September 24, 2029
22# The Government's rights to use, modify, reproduce, release, perform, display, or disclose technical data or computer
23# software marked with this legend are restricted during the period shown as provided in paragraph (b)(4) of the Rights
24# in Noncommercial Technical Data and Computer Software--Small Business Innovative Research (SBIR) Program clause
25# contained in the above identified contract. No restrictions apply after the expiration date shown above. Any
26# reproduction of technical data, computer software, or portions thereof marked with this legend must also reproduce
27# the markings.
28"""
29
30import pytest
31from hitl_tester.modules.logger import logger
32
33
34@pytest.hookimpl(trylast=True)
35def pytest_terminal_summary(terminalreporter):
36    """Log report name."""
37    terminalreporter.currentfspath = 1  # Force newline
38    terminalreporter.ensure_newline()
39    terminalreporter.write_line(f"- Generated directory report: {pytest.flags.report_filename.parent}")
40
41
42def pytest_runtest_logreport(report):
43    """Log stderr / stdout."""
44    if report.capstdout:
45        logger.write_debug_to_report(f"STDOUT:\n{report.capstdout}")
46    if report.capstderr:
47        logger.write_debug_to_report(f"STDERR:\n{report.capstderr}")
48
49
50def pytest_exception_interact(report):
51    """Log exceptions."""
52    logger.write_error_to_report(f"Test exception:\n{report.longreprtext}")
@pytest.hookimpl(trylast=True)
def pytest_terminal_summary(terminalreporter):
35@pytest.hookimpl(trylast=True)
36def pytest_terminal_summary(terminalreporter):
37    """Log report name."""
38    terminalreporter.currentfspath = 1  # Force newline
39    terminalreporter.ensure_newline()
40    terminalreporter.write_line(f"- Generated directory report: {pytest.flags.report_filename.parent}")

Log report name.

def pytest_runtest_logreport(report):
43def pytest_runtest_logreport(report):
44    """Log stderr / stdout."""
45    if report.capstdout:
46        logger.write_debug_to_report(f"STDOUT:\n{report.capstdout}")
47    if report.capstderr:
48        logger.write_debug_to_report(f"STDERR:\n{report.capstderr}")

Log stderr / stdout.

def pytest_exception_interact(report):
51def pytest_exception_interact(report):
52    """Log exceptions."""
53    logger.write_error_to_report(f"Test exception:\n{report.longreprtext}")

Log exceptions.