File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ ARTIFACT_DIR := $(if $(ARTIFACT_DIR ) ,$(ARTIFACT_DIR ) ,tests/test_results)
12PATH_TO_PLANTUML := ~/bin
23
34
45run : # # Run the service locally
56 python src/lightspeed-stack.py
67
8+ test-unit : # # Run the unit tests
9+ @echo " Running unit tests..."
10+ @echo " Reports will be written to ${ARTIFACT_DIR} "
11+ COVERAGE_FILE=" ${ARTIFACT_DIR} /.coverage.unit" pdm run pytest tests/unit --cov=src --cov-report term-missing --cov-report " json:${ARTIFACT_DIR} /coverage_unit.json" --junit-xml=" ${ARTIFACT_DIR} /junit_unit.xml" --cov-fail-under=60
12+
13+ test-integration : # # Run integration tests tests
14+ @echo " Running integration tests..."
15+ @echo " Reports will be written to ${ARTIFACT_DIR} "
16+ COVERAGE_FILE=" ${ARTIFACT_DIR} /.coverage.integration" pdm run pytest tests/integration --cov=src --cov-report term-missing --cov-report " json:${ARTIFACT_DIR} /coverage_integration.json" --junit-xml=" ${ARTIFACT_DIR} /junit_integration.xml" --cov-fail-under=60
17+
718check-types : # # Checks type hints in sources
819 MYPYPATH=src pdm run mypy --namespace-packages --explicit-package-bases --strict --disallow-untyped-calls --disallow-untyped-defs --disallow-incomplete-defs .
920
Original file line number Diff line number Diff line change @@ -22,8 +22,17 @@ distribution = true
2222
2323[dependency-groups ]
2424dev = [
25- " black>=25.1.0"
26- ]
25+ " black>=25.1.0" ,
26+ " pytest>=8.3.2" ,
27+ " pytest-cov>=5.0.0" ,
28+ ]
2729
2830[tool .pdm .scripts ]
2931start = " pdm run make run"
32+ test-unit = " pdm run make test-unit"
33+ test-integration = " pdm run make test-integration"
34+
35+ [tool .pytest .ini_options ]
36+ pythonpath = [
37+ " src"
38+ ]
Original file line number Diff line number Diff line change 1+ """Unit tests for functions defined in src/configuration.py."""
2+
3+ from src .configuration import configuration
4+
5+
6+ def test_default_configuration ():
7+ cfg = configuration
8+ assert cfg is not None
Original file line number Diff line number Diff line change 1+ """Unit tests for functions defined in src/log.py."""
2+
3+ from src .log import get_logger
4+
5+
6+ def test_get_logger ():
7+ """Check the function to retrieve logger."""
8+ logger_name = "foo"
9+ logger = get_logger (logger_name )
10+ assert logger is not None
11+ assert logger .name == logger_name
12+
13+ # at least one handler need to be set
14+ assert len (logger .handlers ) >= 1
You can’t perform that action at this time.
0 commit comments