Skip to content

Commit e8f3046

Browse files
improve coverage
1 parent 7bfe885 commit e8f3046

File tree

6 files changed

+31
-7
lines changed

6 files changed

+31
-7
lines changed

.github/workflows/CI.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -137,11 +137,12 @@ jobs:
137137
- name: Run tests
138138
run: |
139139
export PYTHONPATH="$PWD/build"
140-
mpirun -np 1 ${{ matrix.MPIEXEC_PREFLAGS }} python3 -m pytest tests --ignore=tests/test_hmatrix.py
141-
mpirun -np 2 ${{ matrix.MPIEXEC_PREFLAGS }} python3 -m pytest tests --ignore=tests/test_hmatrix.py
142-
mpirun -np 3 ${{ matrix.MPIEXEC_PREFLAGS }} python3 -m pytest tests --ignore=tests/test_hmatrix.py
143-
mpirun -np 4 ${{ matrix.MPIEXEC_PREFLAGS }} python3 -m pytest tests --ignore=tests/test_hmatrix.py
140+
mpirun -np 1 ${{ matrix.MPIEXEC_PREFLAGS }} python3 -m pytest tests --ignore=tests/test_hmatrix.py --ignore=tests/test_logger.py
141+
mpirun -np 2 ${{ matrix.MPIEXEC_PREFLAGS }} python3 -m pytest tests --ignore=tests/test_hmatrix.py --ignore=tests/test_logger.py
142+
mpirun -np 3 ${{ matrix.MPIEXEC_PREFLAGS }} python3 -m pytest tests --ignore=tests/test_hmatrix.py --ignore=tests/test_logger.py
143+
mpirun -np 4 ${{ matrix.MPIEXEC_PREFLAGS }} python3 -m pytest tests --ignore=tests/test_hmatrix.py --ignore=tests/test_logger.py
144144
python3 -m pytest tests/test_hmatrix.py
145+
python3 -m pytest tests/test_logger.py
145146
146147
- name: Check format
147148
if: matrix.CODE_COVERAGE == 'ON'

src/htool/hmatrix/interfaces/virtual_low_rank_generator.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ class VirtualLowRankGeneratorPython : public VirtualLowRankGenerator<Coefficient
4545
}
4646

4747
bool copy_low_rank_approximation(int M, int N, const int *const rows, const int *const cols, int reqrank, LowRankMatrix<CoefficientPrecision> &lrmat) const override {
48-
Logger::get_instance().log(LogLevel::ERROR, "copy_low_rank_approximation with required rank is not implemented in the python interface.");
49-
return false;
48+
Logger::get_instance().log(LogLevel::ERROR, "copy_low_rank_approximation with required rank is not implemented in the python interface."); // LCOV_EXCL_LINE
49+
return false; // LCOV_EXCL_LINE
5050
}
5151

5252
// lcov does not see it because of trampoline I assume

src/htool/main.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,12 @@
3535
#include "matplotlib/cluster.hpp"
3636
#include "matplotlib/hmatrix.hpp"
3737
#include "misc/logger.hpp"
38+
#include "misc/testing.hpp"
3839

3940
PYBIND11_MODULE(Htool, m) {
4041
// Delegate logging to python logging module
4142
htool::Logger::get_instance().set_current_writer(std::make_shared<PythonLoggerWriter>());
43+
m.def("test_logger", &test_logger);
4244

4345
#ifdef HAVE_MPI
4446
// import the mpi4py API

src/htool/misc/testing.hpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#ifndef HTOOL_PYTHON_MISC_TESTING_CPP
2+
#define HTOOL_PYTHON_MISC_TESTING_CPP
3+
#include <htool/misc/logger.hpp>
4+
5+
void test_logger() {
6+
htool::Logger::get_instance().log(htool::LogLevel::CRITICAL, "Critical message");
7+
htool::Logger::get_instance().log(htool::LogLevel::ERROR, "Error message");
8+
htool::Logger::get_instance().log(htool::LogLevel::WARNING, "Warning message");
9+
htool::Logger::get_instance().log(htool::LogLevel::DEBUG, "Debug message");
10+
htool::Logger::get_instance().log(htool::LogLevel::INFO, "Info message");
11+
}
12+
13+
#endif

tests/test_logger.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import logging
2+
3+
import Htool
4+
5+
6+
def test_logger():
7+
logging.basicConfig(level=logging.DEBUG)
8+
Htool.test_logger()

0 commit comments

Comments
 (0)