CMake: Python bindings
On my Mac, I have Python 3.12.2 installed with the following packages (in case it matters): alabaster Babel charset-normalizer idna imagesize iniconfig Jinja2 MarkupSafe packaging pip pluggy Pygments pytest requests snowballstemmer Sphinx sphinx-copybutton sphinx_inline_tabs sphinxcontrib-applehelp sphinxcontrib-devhelp sphinxcontrib-htmlhelp sphinxcontrib-jsmath sphinxcontrib-qthelp sphinxcontrib-serializinghtml tabulate urllib3 wheel
Now, I do the following from a terminal:
cd <libCellML>
mkdir build
cd build
cmake -G Ninja ..
ninja
ninja test
As expected, everything works fine, i.e. both the C++ and Python tests run fine.
Now, if I create a virtual Python environment using python3 -m venv ~/venv/libCellML (i.e. Python 3.12.2 and pip list only returns the pip package) and then do the following:
source ~/venv/libCellML/bin/activate
cd <libCellML>
mkdir build
cd build
cmake -G Ninja ..
ninja
ninja test
then the python_test_docstrings test fails. If I try to run it "manually" using PYTHONPATH=/Users/Alan/libCellML/build/src/bindings/python python3 ./tests/bindings/python/test_docstrings.py then I get:
E
======================================================================
ERROR: test_docstrings (__main__.DocstringTestCase.test_docstrings)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Users/Alan/Work/Programming/libCellML/build/./tests/bindings/python/test_docstrings.py", line 30, in test_docstrings
raise Exception(
Exception: Missing (1) docstrings, for: libcellml.CellmlElementType
----------------------------------------------------------------------
Ran 1 test in 0.023s
FAILED (errors=1)
I tried to pip install all the packages that are on my system Python, but no difference.
So, at this stage, if I try to use a virtual Python environment, I am not able to successfully run the Python tests.