linopy icon indicating copy to clipboard operation
linopy copied to clipboard

Add test mode that mocks solving

Open irr-github opened this issue 8 months ago • 0 comments

Problem statement

  • testing Pypsa workflows such as pypsa-eur with snakemake is difficult. Pytests doesn't integrate well with it for example. This is because snakemake jobs are subprocesses and tests conditions can't easily be passed to the subprocess
  • in a pure python package, the pypsa network solve step would be mocked (e.g. return q_nom_opt = q_nom)

Request and possible implementation

  • it would be great to have an "is_test" or "mock" flag. In this case the unoptimised network would be returned with mocked opt values (linopy would not run at all)
  • the argument is_test could be passed to linopy as a kwarg in network.optimize if network.optimize already takes kwargs.

Thanks!

irr-github avatar Feb 20 '25 10:02 irr-github