Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Temporally disabled OSMnx tests due to the breaking change 2.0.0 #162

Merged
merged 1 commit into from
Nov 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions tests/test_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"example_14en_multiple_signals_Deep_Reinforcement_Learning_pytorch.py", #takes too much time. DQN can be tested by example_12en_* as well.
"example_17en_result_GUI_viewer_sioux_falls.py", #GUI viewer is not testable in Github Actions
"example_18en_result_GUI_viewer_grid.py", #GUI viewer is not testable in Github Actions
"example_16en_import_from_OpenStreetMap.py", #inconsist with OSMnx 2.0.0. TODO: fix
]

# Dynamically generate test cases for each example script
Expand Down
51 changes: 26 additions & 25 deletions tests/test_other_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,34 +77,35 @@ def test_analyzer():

assert True

@pytest.mark.filterwarnings("ignore::UserWarning")
def test_osm_import():
from uxsim.OSMImporter import OSMImporter

W = World(
name="",
deltan=5,
tmax=7200,
print_mode=1, save_mode=1, show_mode=0,
random_seed=0
)

#Tokyo highway
nodes, links = OSMImporter.import_osm_data(bbox=(35.817, 35.570, 139.881, 139.583), custom_filter='["highway"~"motorway"]')
nodes, links = OSMImporter.osm_network_postprocessing(nodes, links, node_merge_threshold=0.005, node_merge_iteration=5, enforce_bidirectional=True) # merge threshold distance: 0.005 degree ~= 500 m. `enforce_bidirectional` makes all links bidirectional, so that network is not fragmented (but the original network topology is not preserved rigorously).
OSMImporter.osm_network_visualize(nodes, links, show_link_name=0, show_mode=0, save_mode=0)
OSMImporter.osm_network_to_World(W, nodes, links, default_jam_density=0.2, coef_degree_to_meter=111000)
W.show_network()
#inconsist with OSMnx 2.0.0. TODO: fix
# @pytest.mark.filterwarnings("ignore::UserWarning")
# def test_osm_import():
# from uxsim.OSMImporter import OSMImporter

# W = World(
# name="",
# deltan=5,
# tmax=7200,
# print_mode=1, save_mode=1, show_mode=0,
# random_seed=0
# )

# #Tokyo highway
# nodes, links = OSMImporter.import_osm_data(bbox=(35.817, 35.570, 139.881, 139.583), custom_filter='["highway"~"motorway"]')
# nodes, links = OSMImporter.osm_network_postprocessing(nodes, links, node_merge_threshold=0.005, node_merge_iteration=5, enforce_bidirectional=True) # merge threshold distance: 0.005 degree ~= 500 m. `enforce_bidirectional` makes all links bidirectional, so that network is not fragmented (but the original network topology is not preserved rigorously).
# OSMImporter.osm_network_visualize(nodes, links, show_link_name=0, show_mode=0, save_mode=0)
# OSMImporter.osm_network_to_World(W, nodes, links, default_jam_density=0.2, coef_degree_to_meter=111000)
# W.show_network()

# set demand to central Tokyo from surroundings
W.adddemand_area2area(139.70, 35.60, 0, 139.75, 35.68, 0.05, 0, 3600, volume=5000)
W.adddemand_area2area(139.65, 35.70, 0, 139.75, 35.68, 0.05, 0, 3600, volume=5000)
W.adddemand_area2area(139.75, 35.75, 0, 139.75, 35.68, 0.05, 0, 3600, volume=5000)
W.adddemand_area2area(139.85, 35.70, 0, 139.75, 35.68, 0.05, 0, 3600, volume=5000)
# # set demand to central Tokyo from surroundings
# W.adddemand_area2area(139.70, 35.60, 0, 139.75, 35.68, 0.05, 0, 3600, volume=5000)
# W.adddemand_area2area(139.65, 35.70, 0, 139.75, 35.68, 0.05, 0, 3600, volume=5000)
# W.adddemand_area2area(139.75, 35.75, 0, 139.75, 35.68, 0.05, 0, 3600, volume=5000)
# W.adddemand_area2area(139.85, 35.70, 0, 139.75, 35.68, 0.05, 0, 3600, volume=5000)

W.exec_simulation()
# W.exec_simulation()

assert equal_tolerance(len(W.VEHICLES), 5000*4/5)
# assert equal_tolerance(len(W.VEHICLES), 5000*4/5)

def test_readme():
import re, requests
Expand Down