mirror of
https://github.com/thp/pyotherside.git
synced 2025-01-28 23:52:55 +08:00
Robie Basak
16fc61db5b
Test call_sync with one parameter
Introduce qtquicktests/ with a single test. This allows us to write tests entirely in QML with no C++ component. The single test tests for regressions in issue #49. The qtquicktests framework (supplied by QT/QML upstream) provides only a template expansion that provides a main() function. Therefore, we must generate a new binary as the shim for running the tests, as the public API mechanism doesn't allow us to generate a single binary with the two backends. As qmake supports only one binary per directory (without getting really hacky), we must add a new directory for it. Perhaps now the tests/ directory should be renamed to cpptests/ or something for clarity. Unfortunately "make check" doesn't work, so I've provided a "./run" wrapper you can run manually from inside the qtquicktests/ directory for now. This is because qtquicktests appears to have been designed to test QML apps, not plugins. This isn't much of a problem, except that the test runner is unable to find the in-tree built plugin. The generated binary does support a "-plugins <directory>" option, but it seems to be impossible to get "make check" to use it: * The qmake extension supports an INCLUDESPATH to add a "-includes <directory> option, but no equivalent PLUGINSPATH. * Even though qtquicktests reports "." as being in the plugins path after a failure, it does not appear to actually look there, so symlinking or copying the plugin in to the current directory doesn't work. * qmltestcase.prf uses testcase.prf which allows TESTARGS to be added. However, it reads this from the environment (a Makefile variable) rather than from a qmake variable. There appears to be no way of exporting a Makefile variable from a .pro file (unless its name is to start with EXPORT_). See http://stackoverflow.com/q/35554105/478206. * Copying and modifying mysqltestcase.prf from /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/ to add a PLUGINSPATH configurable option does work, but then you have to run qmake with "QMAKEFEATURES=. qmake" since even though it is documented to look in the project root, that doesn't work (I tried both the top level and inside qtquicktests/). So I gave up trying to get "make check" to work, and resorted to a wrapper around calling qtquicktests with the correct options, which at least works for now.
PyOtherSide: Asynchronous Python 3 Bindings for Qt 5 ==================================================== A Qt 5 QML Plugin that provides access to a Python 3 interpreter from QML. Requirements: Qt >= 5.1.0 Python >= 3.3.0 To build and install the QML plugin: qmake make make install To build against a specific Python version, use: qmake PYTHON_CONFIG=python3.3-config make make install To manually update the qmltypes file on x64 Linux (TODO: make this automated): qmake make make INSTALL_ROOT=$(pwd)/tmp/ qmlplugindump io.thp.pyotherside 1.0 tmp/usr/lib/x86_64-linux-gnu/qt5/qml \ >src/pyotherside.qmltypes To run the included unit tests after building, use: ./tests/tests If you want to link PyOtherSide statically against Python 3, you can include the Python Standard Library in PyOtherSide as Qt Resource and have it extracted automatically on load, for this, zip up the Standard Library and place the .zip file as "pythonlib.zip" into src/ before running qmake. More information: Project page: https://thp.io/2011/pyotherside/ Git repo: http://github.com/thp/pyotherside/ Bug tracker: https://github.com/thp/pyotherside/issues Documentation: http://pyotherside.readthedocs.org/
Languages
C++
83.2%
QML
10.2%
Python
2.7%
QMake
1.8%
C
1.6%
Other
0.5%