File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2121 from t4_devkit .typing import NDArrayFloat
2222
2323
24+ def pytest_addoption (parser : pytest .Parser ) -> None :
25+ """Add pytest options."""
26+ parser .addoption (
27+ "--spawn-viewer" ,
28+ action = "store_true" ,
29+ help = "Whether to spawn viewer for unit tests." ,
30+ )
31+
32+
33+ @pytest .fixture (scope = "session" )
34+ def spawn_viewer (pytestconfig ) -> bool :
35+ """Indicate whether to spawn viewer for unit tests."""
36+ return pytestconfig .getoption ("spawn_viewer" )
37+
38+
2439@pytest .fixture (scope = "module" )
2540def label2id () -> dict [str , int ]:
2641 return {"car" : 0 , "bicycle" : 1 , "pedestrian" : 2 }
Original file line number Diff line number Diff line change 66
77
88@pytest .fixture (scope = "module" )
9- def dummy_viewer (label2id ) -> RerunViewer :
9+ def dummy_viewer (spawn_viewer , label2id ) -> RerunViewer :
1010 """Return a dummy viewer.
1111
1212 Returns:
@@ -15,5 +15,5 @@ def dummy_viewer(label2id) -> RerunViewer:
1515 return RerunViewer (
1616 "test_viewer" ,
1717 cameras = ["camera" ],
18- spawn = False , # set this to True for debugging
18+ spawn = spawn_viewer , # set this to True for debugging
1919 ).with_labels (label2id = label2id )
You can’t perform that action at this time.
0 commit comments