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

Trying to remove shared.py #4401

Draft
wants to merge 3 commits into
base: develop
Choose a base branch
from
Draft
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
23 changes: 23 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import pytest
from tests.shared import (
SpatialMethodForTesting,
get_mesh_for_testing,
)
import pybamm


@pytest.fixture(scope="module")
def get_discretisation_for_testing(
xpts=None, rpts=10, mesh=None, cc_method=SpatialMethodForTesting
):
if mesh is None:
mesh = get_mesh_for_testing(xpts=xpts, rpts=rpts)
spatial_methods = {
"macroscale": SpatialMethodForTesting(),
"negative particle": SpatialMethodForTesting(),
"positive particle": SpatialMethodForTesting(),
"negative particle size": SpatialMethodForTesting(),
"positive particle size": SpatialMethodForTesting(),
"current collector": cc_method(),
}
return pybamm.Discretisation(mesh, spatial_methods)
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
# Tests for the electrode-electrolyte interface equations for lead-acid models
#
import pybamm
from tests import get_discretisation_for_testing
import pytest


Expand Down Expand Up @@ -75,7 +74,7 @@ def test_set_parameters_main_reaction(self):
for x in j0_p.pre_order():
assert not isinstance(x, pybamm.Parameter)

def test_discretisation_main_reaction(self):
def test_discretisation_main_reaction(self, get_discretisation_for_testing):
# With intercalation
param = pybamm.LeadAcidParameters()
model_n = pybamm.interface.BaseInterface(
Expand All @@ -88,7 +87,7 @@ def test_discretisation_main_reaction(self):
j0_p = model_p._get_exchange_current_density(self.variables)
# Process parameters and discretise
parameter_values = pybamm.lead_acid.BaseModel().default_parameter_values
disc = get_discretisation_for_testing()
disc = get_discretisation_for_testing
mesh = disc.mesh
disc.set_variable_slices([self.c_e])
j0_n = disc.process_symbol(parameter_values.process_symbol(j0_n))
Expand Down
Loading