From 11fc4a904b004cddbfb9e55d22fa1b218e039b50 Mon Sep 17 00:00:00 2001 From: QuanyiLi Date: Fri, 27 Oct 2023 01:22:01 +0100 Subject: [PATCH] fix test --- .../tests/test_sensors/test_map_visualizer.py | 40 ++++++++++++------- 1 file changed, 25 insertions(+), 15 deletions(-) diff --git a/metadrive/tests/test_sensors/test_map_visualizer.py b/metadrive/tests/test_sensors/test_map_visualizer.py index bc464dc82..bdc956458 100644 --- a/metadrive/tests/test_sensors/test_map_visualizer.py +++ b/metadrive/tests/test_sensors/test_map_visualizer.py @@ -6,20 +6,30 @@ from metadrive.tests.vis_block.vis_block_base import TestBlock -def test_map_visualizer(): +def _test_map_visualizer(): test = TestBlock(window_type="onscreen") + try: + initialize_asset_loader(test) - initialize_asset_loader(test) - - global_network = NodeRoadNetwork() - b = FirstPGBlock(global_network, 3.0, 2, test.render, test.world, 1) - for i in range(1, 13): - tp = Merge if i % 3 == 0 else Split - b = tp(i, b.get_socket(0), global_network, i) - b.construct_block(test.render, test.world) - test.show_bounding_box(global_network) - test.taskMgr.step() - test.taskMgr.step() - test.taskMgr.step() - test.taskMgr.step() - test.taskMgr.step() + global_network = NodeRoadNetwork() + b = FirstPGBlock(global_network, 3.0, 2, test.render, test.world, 1) + for i in range(1, 13): + tp = Merge if i % 3 == 0 else Split + b = tp(i, b.get_socket(0), global_network, i) + b.construct_block(test.render, test.world) + test.show_bounding_box(global_network) + test.taskMgr.step() + test.taskMgr.step() + test.taskMgr.step() + test.taskMgr.step() + test.taskMgr.step() + finally: + import sys + if sys.version_info >= (3, 0): + import builtins + else: + import __builtin__ as builtins + if hasattr(builtins, "base"): + del builtins.base + test.taskMgr.destroy() + test.destroy()