diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 8712233..3856173 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -2,7 +2,7 @@ default_language_version: python: python3 files: | (?x)^( - dehb| + src| tests )/.*\.py$ repos: diff --git a/pyproject.toml b/pyproject.toml index 261fe68..e598cb7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ [tool.pytest.ini_options] testpaths = ["tests"] # path to the test directory minversion = "3.8" -addopts = "--cov=dehb --cov-report=lcov" # Should be package name +addopts = "--cov=src --cov-report=lcov" # Should be package name pythonpath = [ "." ] diff --git a/tests/test_imports.py b/tests/test_imports.py index 4bd1c5e..9263028 100644 --- a/tests/test_imports.py +++ b/tests/test_imports.py @@ -1,28 +1,27 @@ import importlib +import pytest + + class TestImports(): - """This class bundles all import tests for the DEHB project. - """ + """This class bundles all import tests for the DEHB project.""" def test_dehb_import(self): - """Test if DEHB can be imported properly. - """ + """Test if DEHB can be imported properly.""" try: importlib.import_module("src.dehb.optimizers.dehb") except ImportError as e: - assert False, f"Failed to import dehb: {e}" + pytest.fail(f"Failed to import dehb: {e}") def test_de_import(self): - """Test if DE can be imported properly. - """ + """Test if DE can be imported properly.""" try: importlib.import_module("src.dehb.optimizers.de") except ImportError as e: - assert False, f"Failed to import de: {e}" + pytest.fail(f"Failed to import de: {e}") def test_utils_import(self): - """Test if BracketManager can be imported properly. - """ + """Test if BracketManager can be imported properly.""" try: importlib.import_module("src.dehb.utils") except ImportError as e: - assert False, f"Failed to import dehb: {e}" \ No newline at end of file + pytest.fail(f"Failed to import utils: {e}") \ No newline at end of file