35#ifndef PYTHON_TEST_HELPER_H
36#define PYTHON_TEST_HELPER_H
109#define GUARD_PYTHON(available, reason) \
111 if (!(available)) { \
112 if (UTILSLIB::PythonTestHelper::isPythonRequired()) \
113 QFAIL(qPrintable(QString("HARD FAIL (MNE_REQUIRE_PYTHON=true): %1").arg(reason))); \
114 QSKIP(qPrintable(QString("SKIP: %1").arg(reason))); \
124#define GUARD_PYTHON_PACKAGE(helper, packageName) \
125 GUARD_PYTHON((helper).hasPackage(packageName), \
126 QString("Python package '%1' not available").arg(packageName))
161 bool hasPackage(
const QString& packageName)
const;
184 double evalDouble(
const QString& code,
bool* ok =
nullptr,
int timeoutMs = 30000)
const;
197 Eigen::VectorXd
evalVector(
const QString& code,
bool* ok =
nullptr,
int timeoutMs = 60000)
const;
210 Eigen::MatrixXd
evalMatrix(
const QString& code,
bool* ok =
nullptr,
int timeoutMs = 60000)
const;
223 const QStringList& args = {},
224 int timeoutMs = 120000)
const;
256 static bool writeMatrix(
const QString& filePath,
const Eigen::MatrixXd& mat);
268 static Eigen::MatrixXd
readMatrix(
const QString& filePath,
bool* ok =
nullptr);
297 const QString& outputFilePath,
299 int timeoutMs = 120000)
const;
PythonRunner class declaration — standardized interface for calling Python scripts.
utils library export/import macros.
#define UTILSSHARED_EXPORT
Shared utilities (I/O helpers, spectral analysis, layout management, warp algorithms).
Script execution result container.
Python script launcher with logging and progress support.
Eigen::VectorXd evalVector(const QString &code, bool *ok=nullptr, int timeoutMs=60000) const
static bool writeMatrix(const QString &filePath, const Eigen::MatrixXd &mat)
double evalDouble(const QString &code, bool *ok=nullptr, int timeoutMs=30000) const
PythonRunnerResult runScript(const QString &scriptPath, const QStringList &args={}, int timeoutMs=120000) const
static QString testDataPath()
Eigen::MatrixXd evalMatrixViaFile(const QString &code, const QString &outputFilePath, bool *ok=nullptr, int timeoutMs=120000) const
bool isPythonAvailable() const
bool hasPackage(const QString &packageName) const
PythonRunnerResult eval(const QString &code, int timeoutMs=30000) const
static bool isPythonRequired()
static Eigen::MatrixXd readMatrix(const QString &filePath, bool *ok=nullptr)
Eigen::MatrixXd evalMatrix(const QString &code, bool *ok=nullptr, int timeoutMs=60000) const