1111import shutil
1212import subprocess
1313import sys
14- from enum import auto , Enum
1514from typing import Any
1615
1716import pytest
2221"""
2322
2423
25- class arm_test_options (Enum ):
26- quantize_io = auto ()
27- corstone_fvp = auto ()
28- fast_fvp = auto ()
29-
30-
31- _test_options : dict [arm_test_options , Any ] = {}
32-
3324# ==== Pytest hooks ====
3425
3526
3627def pytest_configure (config ):
28+ pytest ._test_options = {}
29+
3730 if config .option .arm_quantize_io :
3831 _load_libquantized_ops_aot_lib ()
39- _test_options [arm_test_options . quantize_io ] = True
32+ pytest . _test_options [" quantize_io" ] = True
4033 if config .option .arm_run_corstoneFVP :
4134 corstone300_exists = shutil .which ("FVP_Corstone_SSE-300_Ethos-U55" )
4235 corstone320_exists = shutil .which ("FVP_Corstone_SSE-320" )
4336 if not (corstone300_exists and corstone320_exists ):
4437 raise RuntimeError (
4538 "Tests are run with --arm_run_corstoneFVP but corstone FVP is not installed."
4639 )
47- _test_options [arm_test_options . corstone_fvp ] = True
48- _test_options [arm_test_options . fast_fvp ] = config .option .fast_fvp
40+ pytest . _test_options [" corstone_fvp" ] = True
41+ pytest . _test_options [" fast_fvp" ] = config .option .fast_fvp
4942 logging .basicConfig (level = logging .INFO , stream = sys .stdout )
5043
5144
@@ -131,9 +124,7 @@ def expectedFailureOnFVP(test_item):
131124# ==== End of Custom Pytest decorators =====
132125
133126
134- def is_option_enabled (
135- option : str | arm_test_options , fail_if_not_enabled : bool = False
136- ) -> bool :
127+ def is_option_enabled (option : str , fail_if_not_enabled : bool = False ) -> bool :
137128 """
138129 Returns whether an option is successfully enabled, i.e. if the flag was
139130 given to pytest and the necessary requirements are available.
@@ -144,10 +135,8 @@ def is_option_enabled(
144135 The optional parameter 'fail_if_not_enabled' makes the function raise
145136 a RuntimeError instead of returning False.
146137 """
147- if isinstance (option , str ):
148- option = arm_test_options [option .lower ()]
149138
150- if option in _test_options and _test_options [option ]:
139+ if option in pytest . _test_options and pytest . _test_options [option ]:
151140 return True
152141 else :
153142 if fail_if_not_enabled :
@@ -156,15 +145,15 @@ def is_option_enabled(
156145 return False
157146
158147
159- def get_option (option : arm_test_options ) -> Any | None :
148+ def get_option (option : str ) -> Any | None :
160149 """
161150 Returns the value of an pytest option if it is set, otherwise None.
162151
163152 Args:
164- option (arm_test_options ): The option to check for.
153+ option (str ): The option to check for.
165154 """
166- if option in _test_options :
167- return _test_options [option ]
155+ if option in pytest . _test_options :
156+ return pytest . _test_options [option ]
168157 return None
169158
170159
0 commit comments