Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

record start_time property workaround #8122

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions tests/foreman/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from pytest_reportportal import RPLogger, RPLogHandler
except ImportError:
pass
from _pytest.junitxml import xml_key
from robottelo.config import settings
from robottelo.decorators import setting_is_set

Expand Down Expand Up @@ -44,7 +45,13 @@ def pytest_report_header(config):
shared_function_enabled, scope, storage
)
)

# workaround for https://github.com/pytest-dev/pytest/issues/7767
# remove if resolved and set autouse=True for record_testsuite_timestamp_xml fixture
if config.pluginmanager.hasplugin("junitxml"):
now = datetime.datetime.utcnow()
xml = config._store.get(xml_key, None)
if xml:
xml.add_global_property('start_time', now)
return messages


Expand Down Expand Up @@ -137,7 +144,7 @@ def pytest_collection_modifyitems(session, items, config):
items[:] = [item for item in items if item not in deselected_items]


@pytest.fixture(autouse=True, scope="session")
@pytest.fixture(autouse=False, scope="session")
def record_testsuite_timestamp_xml(record_testsuite_property):
now = datetime.datetime.utcnow()
record_testsuite_property("start_time", now.strftime("%Y-%m-%dT%H:%M:%S"))
Expand Down