Skip to content

GH-104584: Fix test_capi.test_counter_optimizer() when run twice - #106171

Merged
vstinner merged 1 commit into
python:mainfrom
vstinner:test_counter_optimizer
Jun 28, 2023
Merged

vstinner merged 1 commit into
python:mainfrom
vstinner:test_counter_optimizer

Conversation

@vstinner

@vstinner vstinner commented Jun 28, 2023 •

Copy link
Copy Markdown
Member

test_counter_optimizer() and test_long_loop() of test_capi now create a new function at each call. Otherwise, the optimizer counters are not the expected values when the test is run more than once.

test_counter_optimizer() and test_long_loop() of test_capi now create
a new function at each call. Otherwise, the optimizer counters are
not the expected values when the test is run more than once.
@bedevere-bot bedevere-bot added awaiting core review tests Tests in the Lib/test dir labels Jun 28, 2023
@vstinner vstinner added skip news and removed tests Tests in the Lib/test dir awaiting core review labels Jun 28, 2023
@vstinner

Copy link
Copy Markdown
Member Author

test_capi currently fails on the Refleaks buildbots:

0:45:19 load avg: 1.15 Re-running test_capi in verbose mode (matching: test_counter_optimizer, test_long_loop)
beginning 6 repetitions
123456
test_counter_optimizer (test.test_capi.test_misc.TestOptimizerAPI.test_counter_optimizer) ... ok
test_long_loop (test.test_capi.test_misc.TestOptimizerAPI.test_long_loop)
Check that we aren't confused by EXTENDED_ARG ... ok

----------------------------------------------------------------------
Ran 2 tests in 0.001s

OK
test_counter_optimizer (test.test_capi.test_misc.TestOptimizerAPI.test_counter_optimizer) ... FAIL
test_long_loop (test.test_capi.test_misc.TestOptimizerAPI.test_long_loop)
Check that we aren't confused by EXTENDED_ARG ... FAIL

======================================================================
FAIL: test_counter_optimizer (test.test_capi.test_misc.TestOptimizerAPI.test_counter_optimizer)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL8-x86_64.refleak/build/Lib/test/test_capi/test_misc.py", line 2386, in test_counter_optimizer
    self.assertEqual(opt.get_count(), 1000)
AssertionError: 0 != 1000

======================================================================
FAIL: test_long_loop (test.test_capi.test_misc.TestOptimizerAPI.test_long_loop)
Check that we aren't confused by EXTENDED_ARG
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL8-x86_64.refleak/build/Lib/test/test_capi/test_misc.py", line 2408, in test_long_loop
    self.assertEqual(opt.get_count(), 10)
AssertionError: 0 != 10

----------------------------------------------------------------------
Ran 2 tests in 0.005s

FAILED (failures=2)
.test test_capi failed

cc @markshannon

@vstinner

vstinner commented Jun 28, 2023 •

Copy link
Copy Markdown
Member Author

Reproduce the issue with: ./python -m test -m test_counter_optimizer -m test_long_loop -v test_capi test_capi command.

@vstinner
vstinner merged commit adaacf2 into python:main Jun 28, 2023
@vstinner
vstinner deleted the test_counter_optimizer branch June 28, 2023 02:41
@vstinner

Copy link
Copy Markdown
Member Author

Note: Python 3.12 is not affected.

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

2 participants