Skip to content

Commit

Permalink
Fix precommit and coverage pipeline according to folder structure change
Browse files Browse the repository at this point in the history
  • Loading branch information
Bronzila committed Jul 22, 2023
1 parent 7eeb951 commit 1b34694
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ default_language_version:
python: python3
files: |
(?x)^(
dehb|
src|
tests
)/.*\.py$
repos:
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
"."
]
Expand Down
21 changes: 10 additions & 11 deletions tests/test_imports.py
Original file line number Diff line number Diff line change
@@ -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}"
pytest.fail(f"Failed to import utils: {e}")

0 comments on commit 1b34694

Please sign in to comment.