Skip to content

GH-46728: [Python] Skip test_gdb.py tests if PyArrow wasn't built debug #46755

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

dinse
Copy link

@dinse dinse commented Jun 9, 2025

Rationale for this change

As mentioned in #46728, if Arrow C++ was built debug, and PyArrow wasn't, test_gdb.py runs tests that fail.

What changes are included in this PR?

The CMAKE_BUILD_TYPE environment variable is propagated from build into PyArrow, where it's checked to skip unit tests.

Are these changes tested?

Yes. I have built PyArrow in release, debug, and relwithdebinfo and observed the new behavior. Because CMakeLists.txt was changed, I built PyArrow twice via setup.py and pip install, and checked the new function.

Are there any user-facing changes?

No changes except for devs running unit tests.

@dinse dinse requested review from AlenkaF, raulcd and rok as code owners June 9, 2025 22:31
Copy link

github-actions bot commented Jun 9, 2025

Thanks for opening a pull request!

If this is not a minor PR. Could you open an issue for this pull request on GitHub? https://github.com/apache/arrow/issues/new/choose

Opening GitHub issues ahead of time contributes to the Openness of the Apache Arrow project.

Then could you also rename the pull request title in the following format?

GH-${GITHUB_ISSUE_ID}: [${COMPONENT}] ${SUMMARY}

or

MINOR: [${COMPONENT}] ${SUMMARY}

See also:

@dinse dinse changed the title Arrow 46728 - Skip test_gdb.py tests if PyArrow wasn't built debug GH-46728: [Python] Skip test_gdb.py tests if PyArrow wasn't built debug Jun 9, 2025
Copy link

github-actions bot commented Jun 9, 2025

⚠️ GitHub issue #46728 has been automatically assigned in GitHub to PR creator.

Copy link
Member

@pitrou pitrou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for doing this. Here is a bunch of suggestions, but obviously this is a good fix.

Comment on lines +101 to +103
Returns the PyArrow build type (debug, minsizerel, release,
relwithdebinfo). The default build type is release, regardless of if C++
was built in debug mode.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we keep using the summary line + longer description convention?

@@ -96,6 +96,15 @@ def is_threading_enabled() -> bool:
return libarrow_python.IsThreadingEnabled()


def get_pybuild_type() -> str:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The function name is awkward and restrictive. Perhaps we want a function def build_info() -> dict that returns various pieces of information about the build and, more importantly, that we can extend in the future?


# Write out compile-time configuration constants
string(TOLOWER ${CMAKE_BUILD_TYPE} LOWERCASE_PYBUILD_TYPE)
configure_file("${PYARROW_CPP_SOURCE_DIR}/pybuild_type.h.cmake" "${PYARROW_CPP_SOURCE_DIR}/pybuild_type.h" ESCAPE_QUOTES)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not make this something like config.h.cmake? We may want to add other constants there in the future.

Comment on lines +503 to +509
namespace {
const std::string kPyBuildType = PYARROW_CYTHON_BUILD_TYPE;
}

std::string GetPyBuildType() {
return kPyBuildType;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The separate constant seems a bit pointless to me? This will return a copy anyway.

Suggested change
namespace {
const std::string kPyBuildType = PYARROW_CYTHON_BUILD_TYPE;
}
std::string GetPyBuildType() {
return kPyBuildType;
}
std::string GetPyBuildType() {
return PYARROW_CYTHON_BUILD_TYPE;
}

// specific language governing permissions and limitations
// under the License.

#define PYARROW_CYTHON_BUILD_TYPE "@LOWERCASE_PYBUILD_TYPE@"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would simply call it PYARROW_BUILD_TYPE, because this is not related to Cython.

@@ -25,6 +25,7 @@
import pytest

import pyarrow as pa
from pyarrow.lib import get_pybuild_type
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You don't need to import it explicitly, just call pa.get_pybuild_type? (and make sure this is exposed in the top-level pyarrow namespace)

@@ -23,6 +23,7 @@

import pyarrow as pa
from pyarrow.lib import ArrowInvalid
from pyarrow.lib import get_pybuild_type
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants