diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index bc9a424..6fee7f9 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -18,7 +18,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: ["3.10", "3.11", "3.12"] + python-version: ["3.11", "3.12", "3.13"] os: [ubuntu-latest, windows-latest, macos-latest] steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 9c6735c..f37b5cd 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -14,9 +14,11 @@ jobs: strategy: fail-fast: false matrix: - python-version: [ "3.11" ] + python-version: [ "3.12" ] steps: - uses: actions/checkout@v4 + with: + fetch-depth: 0 - name: "pip: Python ${{ matrix.python-version }} coverage" uses: actions/setup-python@v5 with: @@ -27,7 +29,7 @@ jobs: python -m pip install pybind11 pytest - name: Build run: | - CFLAGS=-coverage python -m pip install . + CXXFLAGS=-coverage python -m pip install . - name: Test run: | python -m pytest diff --git a/.github/workflows/mpi-test.yml b/.github/workflows/mpi-test.yml index 1b53b90..03d33f4 100644 --- a/.github/workflows/mpi-test.yml +++ b/.github/workflows/mpi-test.yml @@ -14,7 +14,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: ["3.11"] + python-version: ["3.12"] steps: - uses: actions/checkout@v4 - name: "pip: Python ${{ matrix.python-version }}" diff --git a/codecov.yml b/codecov.yml index 0ceb3f5..a48c11f 100644 --- a/codecov.yml +++ b/codecov.yml @@ -6,4 +6,4 @@ coverage: threshold: 1% # leeway patch: default: - target: 80% + target: 75% diff --git a/pyproject.toml b/pyproject.toml index e24153d..39f1650 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -2,7 +2,7 @@ requires = [ "setuptools>=42", "wheel", - "pybind11>=2.6.0", + "pybind11>=2.13", "numpy", "pytest" ] diff --git a/src/Error.cpp b/src/Error.cpp deleted file mode 100644 index 9b32838..0000000 --- a/src/Error.cpp +++ /dev/null @@ -1,21 +0,0 @@ -#include "Error.h" -#include - -const char* no::NotImplementedError::what() const noexcept -{ - return m_msg.c_str(); -} - - -// map error types defined here to python exceptions -void no::exception_translator(std::exception_ptr p) -{ - try - { - if (p) std::rethrow_exception(p); - } - catch (const no::NotImplementedError& e) - { - PyErr_SetString(PyExc_NotImplementedError, e.what()); - } -} diff --git a/src/Error.h b/src/Error.h deleted file mode 100644 index 078284e..0000000 --- a/src/Error.h +++ /dev/null @@ -1,24 +0,0 @@ -#include - -#include - -namespace no { - -// error that gets translated to a python NotImplementedError -class NotImplementedError : public std::exception -{ -public: - explicit NotImplementedError(const char* msg): m_msg(msg) { } - explicit NotImplementedError(const std::string& msg): m_msg(msg) { } - virtual ~NotImplementedError() noexcept { } - - virtual const char* what() const noexcept; - -private: - std::string m_msg; -}; - -// map error types defined here to python exceptions -void exception_translator(std::exception_ptr p); - -} \ No newline at end of file diff --git a/src/Model.cpp b/src/Model.cpp index 49a2b26..910f81d 100644 --- a/src/Model.cpp +++ b/src/Model.cpp @@ -4,7 +4,6 @@ #include "Module.h" #include "Timer.h" #include "Log.h" -#include "Error.h" #include "Helpers.h" #include diff --git a/src/Module.cpp b/src/Module.cpp index e5bb538..f2bf622 100644 --- a/src/Module.cpp +++ b/src/Module.cpp @@ -7,7 +7,6 @@ #include "NPArray.h" #include "DataFrame.h" #include "Log.h" -#include "Error.h" #include "NewOrder.h" @@ -223,6 +222,6 @@ PYBIND11_MODULE(_neworder_core, m) init_env(mpi); // Map custom C++ exceptions to python ones - py::register_exception_translator(no::exception_translator); + //py::register_exception_translator(no::exception_translator); } diff --git a/src/Timeline.cpp b/src/Timeline.cpp index 537b517..824a2e0 100644 --- a/src/Timeline.cpp +++ b/src/Timeline.cpp @@ -1,6 +1,5 @@ #include "Timeline.h" #include "Log.h" -#include "Error.h" #include diff --git a/test/test_model.py b/test/test_model.py index b773562..e23539c 100644 --- a/test/test_model.py +++ b/test/test_model.py @@ -18,6 +18,18 @@ def __init__(self) -> None: with pytest.raises(TypeError): _ = TestModel() +def test_not_implemented() -> None: + + class TestModel(no.Model): + def __init__(self) -> None: + super().__init__(no.NoTimeline()) + + def step(self) -> None: + raise NotImplementedError() + + with pytest.raises(NotImplementedError): + no.run(TestModel()) + def test_default_seeder() -> None: class DefaultModel(no.Model):