diff --git a/poetry.lock b/poetry.lock index fad3770..d08a5b0 100644 --- a/poetry.lock +++ b/poetry.lock @@ -557,6 +557,38 @@ files = [ {file = "defusedxml-0.7.1.tar.gz", hash = "sha256:1bb3032db185915b62d7c6209c5a8792be6a32ab2fedacc84e01b52c51aa3e69"}, ] +[[package]] +name = "energyid" +version = "0.0.17" +description = "A python API wrapper for EnergyID" +optional = false +python-versions = "*" +files = [ + {file = "EnergyID-0.0.17-py3-none-any.whl", hash = "sha256:430ba3a48443b4f89171a9f7449b6195e9d8a518167589c6614e3ef3b2a3883f"}, + {file = "EnergyID-0.0.17.tar.gz", hash = "sha256:cfc88561acfb0840d2a8fda7304cb2d9cda190ec009dfc5c406bce2f262d11bc"}, +] + +[package.dependencies] +pandas = "*" +requests = "*" + +[[package]] +name = "entsoe-py" +version = "0.6.8" +description = "A python API wrapper for ENTSO-E" +optional = false +python-versions = "*" +files = [ + {file = "entsoe_py-0.6.8-py3-none-any.whl", hash = "sha256:5c92072a7e36493f55c0c6f5c8c311fb5c5851612209fd27a03e53f60bae5d85"}, + {file = "entsoe_py-0.6.8.tar.gz", hash = "sha256:c9e657e29541ffded8da9cbb6d3724b58fb2e130d6456a4972ca6d65dd39f8ba"}, +] + +[package.dependencies] +beautifulsoup4 = ">=4.11.1" +pandas = ">=2.2.0" +pytz = "*" +requests = "*" + [[package]] name = "exceptiongroup" version = "1.2.2" @@ -742,6 +774,17 @@ files = [ {file = "idna-3.7.tar.gz", hash = "sha256:028ff3aadf0609c1fd278d8ea3089299412a7a8b9bd005dd08b9f8285bcb5cfc"}, ] +[[package]] +name = "iniconfig" +version = "2.0.0" +description = "brain-dead simple config-ini parsing" +optional = false +python-versions = ">=3.7" +files = [ + {file = "iniconfig-2.0.0-py3-none-any.whl", hash = "sha256:b6a85871a79d2e3b22d2d1b94ac2824226a63c6b741c88f7ae975f18b6778374"}, + {file = "iniconfig-2.0.0.tar.gz", hash = "sha256:2d91e135bf72d31a410b17c16da610a82cb55f6b0477d1a902134b24a455b8b3"}, +] + [[package]] name = "ipykernel" version = "6.29.5" @@ -1920,6 +1963,21 @@ docs = ["furo (>=2023.9.10)", "proselint (>=0.13)", "sphinx (>=7.2.6)", "sphinx- test = ["appdirs (==1.4.4)", "covdefaults (>=2.3)", "pytest (>=7.4.3)", "pytest-cov (>=4.1)", "pytest-mock (>=3.12)"] type = ["mypy (>=1.8)"] +[[package]] +name = "pluggy" +version = "1.5.0" +description = "plugin and hook calling mechanisms for python" +optional = false +python-versions = ">=3.8" +files = [ + {file = "pluggy-1.5.0-py3-none-any.whl", hash = "sha256:44e1ad92c8ca002de6377e165f3e0f1be63266ab4d554740532335b9d75ea669"}, + {file = "pluggy-1.5.0.tar.gz", hash = "sha256:2cffa88e94fdc978c4c574f15f9e59b7f4201d439195c3715ca9e2486f1d0cf1"}, +] + +[package.extras] +dev = ["pre-commit", "tox"] +testing = ["pytest", "pytest-benchmark"] + [[package]] name = "prometheus-client" version = "0.20.0" @@ -2164,6 +2222,28 @@ files = [ [package.extras] diagrams = ["jinja2", "railroad-diagrams"] +[[package]] +name = "pytest" +version = "8.3.2" +description = "pytest: simple powerful testing with Python" +optional = false +python-versions = ">=3.8" +files = [ + {file = "pytest-8.3.2-py3-none-any.whl", hash = "sha256:4ba08f9ae7dcf84ded419494d229b48d0903ea6407b030eaec46df5e6a73bba5"}, + {file = "pytest-8.3.2.tar.gz", hash = "sha256:c132345d12ce551242c87269de812483f5bcc87cdbb4722e48487ba194f9fdce"}, +] + +[package.dependencies] +colorama = {version = "*", markers = "sys_platform == \"win32\""} +exceptiongroup = {version = ">=1.0.0rc8", markers = "python_version < \"3.11\""} +iniconfig = "*" +packaging = "*" +pluggy = ">=1.5,<2" +tomli = {version = ">=1", markers = "python_version < \"3.11\""} + +[package.extras] +dev = ["argcomplete", "attrs (>=19.2)", "hypothesis (>=3.56)", "mock", "pygments (>=2.7.2)", "requests", "setuptools", "xmlschema"] + [[package]] name = "python-dateutil" version = "2.9.0.post0" @@ -2651,6 +2731,27 @@ dev = ["cython-lint (>=0.12.2)", "doit (>=0.36.0)", "mypy (==1.10.0)", "pycodest doc = ["jupyterlite-pyodide-kernel", "jupyterlite-sphinx (>=0.13.1)", "jupytext", "matplotlib (>=3.5)", "myst-nb", "numpydoc", "pooch", "pydata-sphinx-theme (>=0.15.2)", "sphinx (>=5.0.0)", "sphinx-design (>=0.4.0)"] test = ["Cython", "array-api-strict", "asv", "gmpy2", "hypothesis (>=6.30)", "meson", "mpmath", "ninja", "pooch", "pytest", "pytest-cov", "pytest-timeout", "pytest-xdist", "scikit-umfpack", "threadpoolctl"] +[[package]] +name = "seaborn" +version = "0.13.2" +description = "Statistical data visualization" +optional = false +python-versions = ">=3.8" +files = [ + {file = "seaborn-0.13.2-py3-none-any.whl", hash = "sha256:636f8336facf092165e27924f223d3c62ca560b1f2bb5dff7ab7fad265361987"}, + {file = "seaborn-0.13.2.tar.gz", hash = "sha256:93e60a40988f4d65e9f4885df477e2fdaff6b73a9ded434c1ab356dd57eefff7"}, +] + +[package.dependencies] +matplotlib = ">=3.4,<3.6.1 || >3.6.1" +numpy = ">=1.20,<1.24.0 || >1.24.0" +pandas = ">=1.2" + +[package.extras] +dev = ["flake8", "flit", "mypy", "pandas-stubs", "pre-commit", "pytest", "pytest-cov", "pytest-xdist"] +docs = ["ipykernel", "nbconvert", "numpydoc", "pydata_sphinx_theme (==0.10.0rc2)", "pyyaml", "sphinx (<6.0.0)", "sphinx-copybutton", "sphinx-design", "sphinx-issues"] +stats = ["scipy (>=1.7)", "statsmodels (>=0.12)"] + [[package]] name = "send2trash" version = "1.8.3" @@ -2996,4 +3097,4 @@ files = [ [metadata] lock-version = "2.0" python-versions = "^3.10" -content-hash = "08b6cab6a5c0758ea809a30d204e0e94ec845d478ca67e10ace1ab65a84565de" +content-hash = "9b91e30da369a6b50c7c952867658b7ee31e671b1af2962cc76752d084095864" diff --git a/pyproject.toml b/pyproject.toml index 5d5b515..319e248 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -60,3 +60,6 @@ matplotlib = "^3.9.1" jupyter = "^1.0.0" ipykernel = "^6.29.5" seaborn = "^0.13.2" +pytest = "^8.3.2" +entsoe-py = "^0.6.8" +energyid = "^0.0.17" diff --git a/requirements-dev.txt b/requirements-dev.txt index b192daa..7017ef5 100644 Binary files a/requirements-dev.txt and b/requirements-dev.txt differ diff --git a/requirements.txt b/requirements.txt index fe649d2..06b0cb0 100644 Binary files a/requirements.txt and b/requirements.txt differ diff --git a/tests/nb.py b/tests/nb.py new file mode 100644 index 0000000..8d7ab74 --- /dev/null +++ b/tests/nb.py @@ -0,0 +1,38 @@ +import pytest +import nbformat +from nbconvert.preprocessors import ExecutePreprocessor +import os + + +def run_notebook(notebook_path): + with open(notebook_path) as f: + nb = nbformat.read(f, as_version=4) + + ep = ExecutePreprocessor(timeout=600, kernel_name="python3") + + try: + ep.preprocess(nb, {"metadata": {"path": os.path.dirname(notebook_path)}}) + return True + except Exception as e: + print(f"Error executing notebook {notebook_path}: {str(e)}") + return False + + +@pytest.mark.parametrize( + "notebook", + [ + "demo_capacity_analysis.ipynb", + "demo_dyntar_analysis.ipynb", + "demo_energiedelen.ipynb", + "demo_energyid_download.ipynb", + "demo_mvlr.ipynb", + "download_prices.ipynb", + ], +) +def test_notebooks(notebook): + notebook_path = os.path.abspath(os.path.join(os.path.dirname(__file__), "..", notebook)) + assert run_notebook(notebook_path), f"Notebook {notebook} failed to execute" + + +if __name__ == "__main__": + pytest.main([__file__])