diff --git a/pyproject.toml b/pyproject.toml index 91cd3922..cc60f3f7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -53,10 +53,10 @@ Changelog = "https://github.com/e2nIEE/pandapipes/blob/develop/CHANGELOG.rst" [project.optional-dependencies] docs = ["numpydoc", "sphinx", "sphinx_rtd_theme", "sphinxcontrib.bibtex", "sphinx-pyproject"] plotting = ["plotly", "igraph"] -test = ["pytest", "pytest-xdist", "nbmake", "setuptools; python_version >= '3.12'"] +test = ["pytest", "pytest-xdist", "nbmake"] all = [ "numpydoc", "sphinx", "sphinx_rtd_theme", "sphinxcontrib.bibtex", - "plotly", "igraph", "pytest", "pytest-xdist", "nbmake", "setuptools; python_version >= '3.12'" + "plotly", "igraph", "pytest", "pytest-xdist", "nbmake" ] [tool.setuptools.packages.find] diff --git a/src/pandapipes/test/test_imports.py b/src/pandapipes/test/test_imports.py index ce19339d..88693190 100644 --- a/src/pandapipes/test/test_imports.py +++ b/src/pandapipes/test/test_imports.py @@ -8,11 +8,28 @@ import pytest from pandapipes import pp_dir -from setuptools import find_packages +try: + from setuptools import find_packages + SETUPTOOLS_AVAILABLE = True +except ImportError: + SETUPTOOLS_AVAILABLE = False def test_import_packages(): - all_packages = find_packages(pp_dir) + if SETUPTOOLS_AVAILABLE: + all_packages = find_packages(pp_dir) + else: + all_packages = [] + for root, dirs, files in os.walk(pp_dir): + for file in files: + if file != "__init__.py": + continue + path = os.path.relpath(root, pp_dir) + if path == ".": + continue + pck = path.replace(os.sep, ".") + all_packages.append(pck) + for pck in all_packages: spec = importlib.util.find_spec(os.path.split(pp_dir)[-1] + "." + pck) new_module = importlib.util.module_from_spec(spec)