Skip to content

Opt-out configuration for collecting local constants #4627

Description

@mroeschke

Over in pandas we use hypothesis seldomly in a pytest test suite, and I noticed that one of our hypothesis tests is consistently our slowest running test on a particular CI build

============================= slowest 30 durations =============================
8.37s call     pandas/tests/io/sas/test_byteswap.py::test_int_byteswap[True-uint16]
6.40s teardown pandas/tests/io/parser/dtypes/test_dtypes_basic.py::test_dtype_all_columns[python-False-str]
...

Using AI to help profile test_int_byteswap, a significant amount of time is spent in constants_from_module trying to extract local constants. pandas does have few locally defined constants, but IMO they are not generally applicable to test in a hypothesis context. This feature request is echoing @oscarbenjamin's suggestion in #4364 (comment) to allow a flag to opt out of scanning the source tree for local constants.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    performancego faster! use less memory!questionnot sure it's a bug? questions welcome

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions