Skip to content

Save report.html in custom generated directory #577

Answered by snuufkiin
snuufkiin asked this question in Q&A
Discussion options

You must be logged in to vote

sure thing - apologize for not doing this right away.

log = logging.getLogger(__name__)

default_formatter = logging.Formatter(
    datefmt="%d.%m.%Y %H:%M:%S",
    fmt="%(asctime)s.%(msecs)03d   %(levelname)-9s %(name)s %(message)s",
)

_DATETIME_NOW: Final = datetime.datetime.now()
_SESSION_DATA_DIR: Final = (
    pathlib.Path() / "test_session" / _DATETIME_NOW.strftime("%Y-%m-%dT%H.%M.%S.%f%z")
)


@pytest.hookimpl(  # type: ignore[misc]  # required until decorator gets typed in pytest
    tryfirst=True  # has to be called BEFORE the pytest-html plugin hook
)
def pytest_configure(config: pytest.Config) -> None:
    """Configure HTML reporting."""
    global _SESSION_DATA_DIR
    if config

Replies: 1 comment 6 replies

Comment options

You must be logged in to vote
6 replies
@snuufkiin
Comment options

@snuufkiin
Comment options

@BeyondEvil
Comment options

@snuufkiin
Comment options

Answer selected by snuufkiin
@RaakeshRaja
Comment options

@snuufkiin
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants