coryan commented on a change in pull request #11888:
URL: https://github.com/apache/arrow/pull/11888#discussion_r765431174
##########
File path: cpp/src/arrow/filesystem/gcsfs_test.cc
##########
@@ -78,11 +78,24 @@ class GcsIntegrationTest : public ::testing::Test {
// Initialize a PRNG with a small amount of entropy.
generator_ = std::mt19937_64(std::random_device()());
port_ = std::to_string(GetListenPort());
- auto exe_path = bp::search_path("python3");
- ASSERT_THAT(exe_path, Not(IsEmpty()));
-
- server_process_ = bp::child(boost::this_process::environment(), exe_path,
"-m",
- "testbench", "--port", port_, group_);
+ std::vector<std::string> names{"python3", "python"};
+ // If the build script or application developer provides a value in the
PYTHON
+ // environment variable, then just use that.
+ if (const auto* env = std::getenv("PYTHON")) {
+ names = {env};
+ }
+ for (const auto& interpreter : names) {
+ auto exe_path = bp::search_path(interpreter);
+ if (exe_path.empty()) continue;
+
+ server_process_ = bp::child(boost::this_process::environment(),
exe_path, "-m",
+ "testbench", "--port", port_, group_);
+ if (server_process_.valid() && server_process_.running()) break;
+ server_process_.terminate();
+ server_process_.wait();
+ }
+ ASSERT_TRUE(server_process_.valid());
Review comment:
It depends. I fixed the code to print a better message when the python
interpreter is not found or fails to start. The python interpreter itself
prints a better error message when it manages to run.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]