Skip to content

Commit 7b2f764

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 7894ef9 commit 7b2f764

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

viz.py

+10-3
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,31 @@
55
import pytest
66
from mesa.visualization import SolaraViz
77

8+
89
def get_viz_files(directory):
910
viz_files = []
1011
for root, dirs, files in os.walk(directory):
1112
for file in files:
12-
if file in ['app.py', 'viz.py']:
13+
if file in ["app.py", "viz.py"]:
1314
module_name = os.path.relpath(os.path.join(root, file[:-3])).replace(
1415
os.sep, "."
1516
)
1617
viz_files.append(module_name)
1718
return viz_files
1819

20+
1921
@pytest.mark.parametrize("module_name", get_viz_files("examples"))
2022
def test_solara_viz(module_name):
2123
# Add the 'examples' directory to the Python path
22-
examples_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', 'examples'))
24+
examples_dir = os.path.abspath(
25+
os.path.join(os.path.dirname(__file__), "..", "examples")
26+
)
2327
sys.path.insert(0, examples_dir)
2428

2529
# Add the parent directory of the module to the Python path
26-
module_parent_dir = os.path.abspath(os.path.join(examples_dir, os.path.dirname(module_name.replace('.', os.sep))))
30+
module_parent_dir = os.path.abspath(
31+
os.path.join(examples_dir, os.path.dirname(module_name.replace(".", os.sep)))
32+
)
2733
if module_parent_dir not in sys.path:
2834
sys.path.insert(0, module_parent_dir)
2935

@@ -83,6 +89,7 @@ def test_solara_viz(module_name):
8389
if module_parent_dir in sys.path:
8490
sys.path.remove(module_parent_dir)
8591

92+
8693
# Run the tests
8794
if __name__ == "__main__":
8895
pytest.main([__file__, "-v"])

0 commit comments

Comments
 (0)