Skip to content

Commit

Permalink
WA: conftest do not overshadow tests/transformers/tests
Browse files Browse the repository at this point in the history
Signed-off-by: U. Artie Eoff <[email protected]>
  • Loading branch information
uartie committed Mar 3, 2025
1 parent 2691f25 commit bf8d71b
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions conftest.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import json
import logging
import os
import sys
from pathlib import Path

import pytest

import tests.utils as oh_testutils


BASELINE_DIRECTORY = Path(__file__).parent.resolve() / Path("tests") / Path("baselines") / Path("fixture")

Expand Down Expand Up @@ -123,11 +122,19 @@ def pytest_sessionstart(session):
# use "gaudi1" since this is used in tests, baselines, etc.
device = "gaudi1"

oh_testutils.OH_DEVICE_CONTEXT = device
from tests import utils

utils.OH_DEVICE_CONTEXT = device
session.config.stash["device-context"] = device

# WA: delete the imported top-level tests module so we don't overshadow
# tests/transformers/tests module.
# This fixes python -m pytest tests/transformers/tests/models/ -s -v
del sys.modules["tests"]


def pytest_report_header():
return [f"device context: {oh_testutils.OH_DEVICE_CONTEXT}"]
def pytest_report_header(config):
return [f"device context: {config.stash['device-context']}"]


def pytest_sessionfinish(session):
Expand Down

0 comments on commit bf8d71b

Please sign in to comment.