File tree Expand file tree Collapse file tree 1 file changed +12
-5
lines changed
Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Original file line number Diff line number Diff line change 11import json
22import logging
33import os
4+ import sys
45from pathlib import Path
56
67import pytest
78
8- import tests .utils as oh_testutils
9-
109
1110BASELINE_DIRECTORY = Path (__file__ ).parent .resolve () / Path ("tests" ) / Path ("baselines" ) / Path ("fixture" )
1211
@@ -123,11 +122,19 @@ def pytest_sessionstart(session):
123122 # use "gaudi1" since this is used in tests, baselines, etc.
124123 device = "gaudi1"
125124
126- oh_testutils .OH_DEVICE_CONTEXT = device
125+ from tests import utils
126+
127+ utils .OH_DEVICE_CONTEXT = device
128+ session .config .stash ["device-context" ] = device
129+
130+ # WA: delete the imported top-level tests module so we don't overshadow
131+ # tests/transformers/tests module.
132+ # This fixes python -m pytest tests/transformers/tests/models/ -s -v
133+ del sys .modules ["tests" ]
127134
128135
129- def pytest_report_header ():
130- return [f"device context: { oh_testutils . OH_DEVICE_CONTEXT } " ]
136+ def pytest_report_header (config ):
137+ return [f"device context: { config . stash [ 'device-context' ] } " ]
131138
132139
133140def pytest_sessionfinish (session ):
You can’t perform that action at this time.
0 commit comments