# Path: calliope/test/common/util.py
# def build_test_model(
#     override_dict=None,
#     scenario=None,
#     model_file="model.yaml",
#     timeseries_dataframes=None,
# ):
#     return calliope.Model(
#         os.path.join(os.path.dirname(__file__), "test_model", model_file),
#         override_dict=override_dict,
#         scenario=scenario,
#         timeseries_dataframes=timeseries_dataframes,
#     )


import pytest
import calliope
from pytest import approx
from calliope.test.common.util import build_test_model as build_model
                "techs.heat_pipes.constraints.force_asynchronous_prod_con": True,
                "run.solver_options.mipgap": 0.05,
                "run.zero_threshold": 1e-6,
            }
        )
        m_bin.run()
        _prod = _get_prod_con(m_bin, "prod")
        _con = _get_prod_con(m_bin, "con")
        assert any(((_con < 0) & (_prod > 0)).any()) is False


class TestModelSettings:
    @pytest.fixture
    def run_model(self):
        def _run_model(feasibility, cap_val):
            override_dict = {
                "nodes.a.techs": {"test_supply_elec": {}, "test_demand_elec": {}},
                "links.a,b.exists": False,
                # pick a time subset where demand is uniformally -10 throughout
                "model.subset_time": ["2005-01-01 06:00:00", "2005-01-01 08:00:00"],
                "run.ensure_feasibility": feasibility,
                "run.bigM": 1e3,
                # Allow setting resource and energy_cap_max/equals to force infeasibility
                "techs.test_supply_elec.constraints": {
                    "resource": cap_val,
                    "energy_eff": 1,
                    "energy_cap_equals": 15,
                },
                "techs.test_supply_elec.switches.force_resource": True,
            }

# Path: calliope/test/common/util.py
# def build_test_model(
#     override_dict=None,
#     scenario=None,
#     model_file="model.yaml",
#     timeseries_dataframes=None,
# ):
#     return calliope.Model(
#         os.path.join(os.path.dirname(__file__), "test_model", model_file),
#         override_dict=override_dict,
#         scenario=scenario,
#         timeseries_dataframes=timeseries_dataframes,
#     )


# Path: calliope/test/test_constraint_results.py
import pytest
import calliope
from pytest import approx
from calliope.test.common.util import build_test_model as build_model

                "techs.heat_pipes.constraints.force_asynchronous_prod_con": True,
                "run.solver_options.mipgap": 0.05,
                "run.zero_threshold": 1e-6,
            }
        )
        m_bin.run()
        _prod = _get_prod_con(m_bin, "prod")
        _con = _get_prod_con(m_bin, "con")
        assert any(((_con < 0) & (_prod > 0)).any()) is False


class TestModelSettings:
    @pytest.fixture
    def run_model(self):
        def _run_model(feasibility, cap_val):
            override_dict = {
                "nodes.a.techs": {"test_supply_elec": {}, "test_demand_elec": {}},
                "links.a,b.exists": False,
                # pick a time subset where demand is uniformally -10 throughout
                "model.subset_time": ["2005-01-01 06:00:00", "2005-01-01 08:00:00"],
                "run.ensure_feasibility": feasibility,
                "run.bigM": 1e3,
                # Allow setting resource and energy_cap_max/equals to force infeasibility
                "techs.test_supply_elec.constraints": {
                    "resource": cap_val,
                    "energy_eff": 1,
                    "energy_cap_equals": 15,
                },
                "techs.test_supply_elec.switches.force_resource": True,
            }

            model = build_model(