Testing application built with meson-python #659
-
I am working on an application that is Python-based (so it has a bunch of Python files). However, the application also implements a Python extension and some shared libraries. The Python files import the Python extension as a module, which, in-turn, opens the shared libraries with I am not clear on how to test my application. When building the extension and libraries, they all get built into I also tried to run the application with How do I test my application? Thank you. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
In order for a python project to be importable when it consists of both .py files and compiled extensions, you have to do one of:
meson-python supports editable installation, so you can install it that way and then iterate on that for your tests. For a more in-depth approach, you can take a look at:
|
Beta Was this translation helpful? Give feedback.
Editable installs will create a hook loader that ensures that any time you import the project, regardless of current directory and regardless of $PYTHONPATH, you get the version you installed via the editable install. It also has some nice tricks such as automatically reloading any time you modify a source file -- because it will then run ninja to rebuild the C extensions before proceeding with the import, so you can edit source files and rerun your code / tests / interactive interpreter without manually re…