Skip to content

Commit

Permalink
added the missing direcotry path for ui_session (#13212)
Browse files Browse the repository at this point in the history
  • Loading branch information
omkarkhatavkar committed Nov 29, 2023
1 parent 10eed19 commit 678a3b7
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions tests/foreman/conftest.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""Configurations for py.test runner"""
import pytest

from robottelo.hosts import Satellite
from robottelo.logging import collection_logger


Expand Down Expand Up @@ -40,3 +41,31 @@ def pytest_collection_modifyitems(session, items, config):

config.hook.pytest_deselected(items=deselected_items)
items[:] = [item for item in items if item not in deselected_items]


@pytest.fixture(autouse=True)
def ui_session_record_property(request, record_property):
"""
Autouse fixture to set the record_property attribute for Satellite instances in the test.
This fixture iterates over all fixtures in the current test node
(excluding the current fixture) and sets the record_property attribute
for instances of the Satellite class.
Args:
request: The pytest request object.
record_property: The value to set for the record_property attribute.
"""
test_directories = [
'tests/foreman/destructive',
'tests/foreman/ui',
'tests/foreman/sanity',
'tests/foreman/virtwho',
]
test_file_path = request.node.fspath.strpath
if any(directory in test_file_path for directory in test_directories):
for fixture in request.node.fixturenames:
if request.fixturename != fixture:
if isinstance(request.getfixturevalue(fixture), Satellite):
sat = request.getfixturevalue(fixture)
sat.record_property = record_property

0 comments on commit 678a3b7

Please sign in to comment.