diff --git a/tools/auto-tester/src/TestRailInterface.cpp b/tools/auto-tester/src/TestRailInterface.cpp index e92ef59c77..d8784e5a86 100644 --- a/tools/auto-tester/src/TestRailInterface.cpp +++ b/tools/auto-tester/src/TestRailInterface.cpp @@ -283,7 +283,7 @@ void TestRailInterface::createAddTestCasesPythonScript(const QString& testDirect file.close(); if (QMessageBox::Yes == QMessageBox(QMessageBox::Information, "Python script has been created", "Do you want to run the script and update TestRail?", QMessageBox::Yes | QMessageBox::No).exec()) { - QString command("C:\\Python37\\python"); + QString command(_pythonPath + "/" + pythonExe); QStringList parameters = QStringList() << outputDirectory + "/addTestCases.py"; QProcess* process = new QProcess(); connect( @@ -309,6 +309,18 @@ void TestRailInterface::createTestSuitePython(const QString& testDirectory, const QString& userGitHub, const QString& branchGitHub) { + // First check that Python is available + QProcessEnvironment e = QProcessEnvironment::systemEnvironment(); + QStringList sl = e.toStringList(); + if (QProcessEnvironment::systemEnvironment().contains("PYTHON_PATH")) { + _pythonPath = QProcessEnvironment::systemEnvironment().value("PYTHON_PATH"); + if (!QFile::exists(_pythonPath + "/" + pythonExe)) { + QMessageBox::critical(0, pythonExe, QString("Python executable not found in ") + _pythonPath); + } + } else { + QMessageBox::critical(0, "PYTHON_PATH not defined", "Please set PYTHON_PATH to directory containing the Python executable"); + } + createTestRailDotPyScript(outputDirectory); createStackDotPyScript(outputDirectory); requestDataFromUser(); diff --git a/tools/auto-tester/src/TestRailInterface.h b/tools/auto-tester/src/TestRailInterface.h index 1908c1bbd3..4c094a27f3 100644 --- a/tools/auto-tester/src/TestRailInterface.h +++ b/tools/auto-tester/src/TestRailInterface.h @@ -75,6 +75,10 @@ private: QString _user; QString _password; QString _project; + + QString _pythonPath; + + const QString pythonExe{ "python.exe" }; }; #endif \ No newline at end of file