PyPSA / linopy

Linear optimization with N-D labeled arrays in Python
https://linopy.readthedocs.io
MIT License
155 stars 43 forks source link

Use os.makedirs to create parent dirs for solution_fn #203

Closed dannyopts closed 8 months ago

dannyopts commented 8 months ago

Before this fix the tests fail cbc does not work on OSx.

On OSx mknod requires privledged access (need to run as sudo) https://stackoverflow.com/questions/32115715/os-mknod-fails-on-macos, but even when running as sudo, the test still fails with an invalid argument error.

I assume the mknod is there incase the parent dir of the solution_fn is not present, so I created a test for this case and found that glpk also fails if the solution_fn's parent dir does not exist so I added a fix for this.

codecov[bot] commented 8 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Comparison is base (e642a1f) 89.23% compared to head (5e3daec) 87.76%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #203 +/- ## ========================================== - Coverage 89.23% 87.76% -1.47% ========================================== Files 15 15 Lines 3343 3343 Branches 768 767 -1 ========================================== - Hits 2983 2934 -49 - Misses 248 299 +51 + Partials 112 110 -2 ``` | [Files](https://app.codecov.io/gh/PyPSA/linopy/pull/203?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=PyPSA) | Coverage Δ | | |---|---|---| | [linopy/solvers.py](https://app.codecov.io/gh/PyPSA/linopy/pull/203?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=PyPSA#diff-bGlub3B5L3NvbHZlcnMucHk=) | `79.18% <100.00%> (-10.00%)` | :arrow_down: |

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.