File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -46,6 +46,9 @@ fbcode_target(_kind = python_pytest,
4646 srcs = [
4747 "generic_tests/test_quantizer.py" ,
4848 ],
49+ resources = [
50+ "generic_tests/conftest.py" ,
51+ ],
4952 deps = [
5053 "//executorch/backends/nxp:quantizer" ,
5154 "//caffe2:torch" ,
Original file line number Diff line number Diff line change 1+ # Copyright (c) Meta Platforms, Inc. and affiliates.
2+ # All rights reserved.
3+ #
4+ # This source code is licensed under the BSD-style license found in the
5+ # LICENSE file in the root directory of this source tree.
6+
7+ # Tests comparing against the TFLite reference are marked `@requires_tflite`
8+ # (a `skipif` on `tflite is None`). Where the tflite/tensorflow interpreter is
9+ # not importable, deselect them rather than letting the `skipif` skip them:
10+ # internal CI (TestX) flags a consistently-skipping test as broken/disabled,
11+ # while a deselected test produces no signal at all.
12+
13+ # Must stay in sync with the `reason=` of `requires_tflite` in test_quantizer.py.
14+ _REQUIRES_TFLITE_REASON = "tensorflow/tflite not available"
15+
16+
17+ def _is_tflite_gated_and_unavailable (item ) -> bool :
18+ for marker in item .iter_markers (name = "skipif" ):
19+ condition = marker .args [0 ] if marker .args else False
20+ if condition and marker .kwargs .get ("reason" ) == _REQUIRES_TFLITE_REASON :
21+ return True
22+ return False
23+
24+
25+ def pytest_collection_modifyitems (config , items ):
26+ selected = []
27+ deselected = []
28+ for item in items :
29+ if _is_tflite_gated_and_unavailable (item ):
30+ deselected .append (item )
31+ else :
32+ selected .append (item )
33+ if deselected :
34+ config .hook .pytest_deselected (items = deselected )
35+ items [:] = selected
You can’t perform that action at this time.
0 commit comments