Skip to content

gh-114058: Fix flaky globals to constant test #115423

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

Merged
merged 4 commits into from
Feb 14, 2024

Conversation

Fidget-Spinner
Copy link
Member

@Fidget-Spinner Fidget-Spinner commented Feb 13, 2024

The optimizer does not optimize global loads if the builtins dictionary has been modified more than 3 times. In this case, I suspect some other test is modifying the builtins dictionary before test_capi.test_opt is run. So the test for the optimizer fails if tests are run sequentially.

The solution is to run the test in the subprocess so it's not subject to shenanigans that other tests do :).

@bedevere-app bedevere-app bot added the tests Tests in the Lib/test dir label Feb 13, 2024
@Fidget-Spinner
Copy link
Member Author

Easy reproducer: thanks to @Eclips4

./python -m test test___all__ test__locale test__opcode test__osx_support test__xxinterpchannels test__xxsubinterpreters  test_abc test_abstract_numbers  test_argparse  test_array test_asdl_parser test_ast test_asyncgen test_atexit test_audit test_augassign  test_augassign test_baseexception  test_bdb  test_bigaddrspace  test_bigmem  test_binascii  test_binop  test_bisect  test_bool  test_buffer test_bufio  test_builtin  test_bytes  test_bz2  test_c_locale_coercion  test_calendar  test_call  test_capi

@Eclips4
Copy link
Member

Eclips4 commented Feb 13, 2024

Easy reproducer: thanks to @Eclips4

./python -m test test___all__ test__locale test__opcode test__osx_support test__xxinterpchannels test__xxsubinterpreters  test_abc test_abstract_numbers  test_argparse  test_array test_asdl_parser test_ast test_asyncgen test_atexit test_audit test_augassign  test_augassign test_baseexception  test_bdb  test_bigaddrspace  test_bigmem  test_binascii  test_binop  test_bisect  test_bool  test_buffer test_bufio  test_builtin  test_bytes  test_bz2  test_c_locale_coercion  test_calendar  test_call  test_capi

I found the more easier reproducer:

./python -m test test_argparse test_ast test_asyncgen test_capi

@Eclips4
Copy link
Member

Eclips4 commented Feb 13, 2024

macOS failure is unrelated, see #115383 for more information

Co-authored-by: Victor Stinner <vstinner@python.org>
@Yhg1s Yhg1s merged commit 57e4c81 into python:main Feb 14, 2024
fsc-eriker pushed a commit to fsc-eriker/cpython that referenced this pull request Feb 14, 2024
Co-authored-by: Victor Stinner <vstinner@python.org>
@Fidget-Spinner Fidget-Spinner deleted the fix-globals-constants-test branch February 14, 2024 18:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
skip news tests Tests in the Lib/test dir
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants