Skip to content

Commit

Permalink
fixed windows test fails
Browse files Browse the repository at this point in the history
  • Loading branch information
santacodes committed Jun 21, 2024
1 parent 5374988 commit 46b7ca3
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions tests/test_entry_points.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@
import glob
import importlib.util
import sys
from pathlib import Path

def test_entry_points():
"""Testing if the entry points are loading right"""

entry_points = list(pybamm_cookiecutter.parameter_sets)
parameter_sets = glob.glob("src/pybamm_cookiecutter/parameters/input/*.py")
parameter_sets = glob.glob(str(Path("src/pybamm_cookiecutter/parameters/input/*.py")))
# Making a list Parameter sets in the parameters/input directory
parameter_sets = [x.split('/')[-1].split('.py')[0] for x in parameter_sets]

Expand All @@ -19,7 +20,7 @@ def test_entry_point_load():
# Loading parameter_sets through entry points
parameters = pybamm_cookiecutter.parameter_sets['Chen2020']
# Loading parameter sets through the source file by dynamically loading Chen2020.py as a module
spec = importlib.util.spec_from_file_location("Chen2020mod", "src/pybamm_cookiecutter/parameters/input/Chen2020.py")
spec = importlib.util.spec_from_file_location("Chen2020mod", Path("src/pybamm_cookiecutter/parameters/input/Chen2020.py"))
chen_module = importlib.util.module_from_spec(spec)
sys.modules["Chen2020mod"] = chen_module
spec.loader.exec_module(chen_module)
Expand Down

0 comments on commit 46b7ca3

Please sign in to comment.