Skip to content
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

gh-106584: Fix exit code for unittest in Python 3.12 #106588

Merged

Conversation

EliseevEgor
Copy link
Contributor

@EliseevEgor EliseevEgor commented Jul 10, 2023

Increase the number of running tests only if a test hasn't been skipped.

@bedevere-bot
Copy link

Most changes to Python require a NEWS entry.

Please add it using the blurb_it web app or the blurb command-line tool.

@cpython-cla-bot
Copy link

cpython-cla-bot bot commented Jul 10, 2023

All commit authors signed the Contributor License Agreement.
CLA signed

@bedevere-bot
Copy link

Most changes to Python require a NEWS entry.

Please add it using the blurb_it web app or the blurb command-line tool.

@EliseevEgor EliseevEgor force-pushed the egoreliseev/Issue-106584_move_start_test branch from 2b0b119 to 9efdf58 Compare July 10, 2023 12:48
@bedevere-bot
Copy link

Most changes to Python require a NEWS entry.

Please add it using the blurb_it web app or the blurb command-line tool.

Increase the number of running tests only if it hasn't been skipped.
@EliseevEgor EliseevEgor force-pushed the egoreliseev/Issue-106584_move_start_test branch from 9efdf58 to 6e1be71 Compare July 10, 2023 12:51
@bedevere-bot
Copy link

Most changes to Python require a NEWS entry.

Please add it using the blurb_it web app or the blurb command-line tool.

Copy link
Member

@sobolevn sobolevn left a comment

Choose a reason for hiding this comment

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

LGTM, but please add a NEWS entry!

Lib/unittest/case.py Outdated Show resolved Hide resolved
@sunmy2019 sunmy2019 added the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Jul 11, 2023
@bedevere-bot
Copy link

🤖 New build scheduled with the buildbot fleet by @sunmy2019 for commit 9779a2b 🤖

If you want to schedule another build, you need to add the 🔨 test-with-buildbots label again.

@bedevere-bot bedevere-bot removed the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Jul 11, 2023
Co-authored-by: sunmy2019 <59365878+sunmy2019@users.noreply.github.com>
Copy link
Member

@sobolevn sobolevn left a comment

Choose a reason for hiding this comment

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

No need to specify the version info in the NEWS.

@sunmy2019 sunmy2019 added the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Jul 11, 2023
@bedevere-bot
Copy link

🤖 New build scheduled with the buildbot fleet by @sunmy2019 for commit 6313c98 🤖

If you want to schedule another build, you need to add the 🔨 test-with-buildbots label again.

@bedevere-bot bedevere-bot removed the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Jul 11, 2023
@sunmy2019
Copy link
Member

We got some failed tests. Most are unrelated, but we might need to rule them out.

felixxm added a commit to felixxm/django that referenced this pull request Oct 16, 2023
…ss_db_feature() test on Python 3.12.1+.

Python 3.12.1+ no longer includes skipped tests in the number of
running tests. Check out:

python/cpython#110890 (comment)
python/cpython#106588
felixxm added a commit to django/django that referenced this pull request Oct 16, 2023
…ss_db_feature() test on Python 3.12.1+.

Python 3.12.1+ no longer includes skipped tests in the number of
running tests. Check out:

python/cpython#110890 (comment)
python/cpython#106588
felixxm added a commit to django/django that referenced this pull request Oct 16, 2023
…ass_unless_db_feature() test on Python 3.12.1+.

Python 3.12.1+ no longer includes skipped tests in the number of
running tests. Check out:

python/cpython#110890 (comment)
python/cpython#106588
Backport of 20b7aac from main
felixxm added a commit to django/django that referenced this pull request Oct 16, 2023
…ass_unless_db_feature() test on Python 3.12.1+.

Python 3.12.1+ no longer includes skipped tests in the number of
running tests. Check out:

python/cpython#110890 (comment)
python/cpython#106588
Backport of 20b7aac from main
@exarkun
Copy link
Contributor

exarkun commented Dec 18, 2023

It doesn't seem like this ought to have been backported. It includes an incompatible change in the long-established protocol between a test runner and a test results object. One consequence is that it has broken trial's multiprocess test runner (twisted/twisted#12052).

mtreinish added a commit to mtreinish/testtools that referenced this pull request Jan 5, 2024
In Python 3.12.1 python/cpython#106588 was backported which changed the
execution behavior of the unittest runner. After python/cpython#106588
startTest() is no longer being called if a test is skipped. This causes
knock-on effects in testtools because the test result subclasses were
assuming that startTest() was always called when stopTest() was called.
To handle this change in behavior when running with Python 3.12.1 this
commit adds a check to only deal with tags if they exist (when
startTest() is run).
@yilei
Copy link
Contributor

yilei commented Jan 11, 2024

FYI-- This also broke absl.testing where it tracks test runtime with startTest and stopTest: https://github.com/abseil/abseil-py/blob/2af184bfcdaa6156a5a098923a9561bc4b7d988c/absl/testing/xml_reporter.py#L352-L365

We should be able to workaround it, but just wanted to point this out. It seems strange for stopTest to be called without a startTest.

copybara-service bot pushed a commit to abseil/abseil-py that referenced this pull request Jan 11, 2024
…ipped.

`startTest` may not be called in this case, after the change in python/cpython#106588.

PiperOrigin-RevId: 597675639
copybara-service bot pushed a commit to abseil/abseil-py that referenced this pull request Jan 12, 2024
…ipped.

`startTest` may not be called in this case, after the change in python/cpython#106588.

PiperOrigin-RevId: 597675639
copybara-service bot pushed a commit to abseil/abseil-py that referenced this pull request Jan 12, 2024
…ipped.

`startTest` may not be called in this case, after the change in python/cpython#106588.

PiperOrigin-RevId: 597675639
copybara-service bot pushed a commit to abseil/abseil-py that referenced this pull request Jan 12, 2024
…ipped.

`startTest` may not be called in this case, after the change in python/cpython#106588.

PiperOrigin-RevId: 597675639
copybara-service bot pushed a commit to abseil/abseil-py that referenced this pull request Jan 12, 2024
…ipped.

`startTest` may not be called in this case, after the change in python/cpython#106588.

PiperOrigin-RevId: 597675639
copybara-service bot pushed a commit to abseil/abseil-py that referenced this pull request Jan 12, 2024
…ipped.

`startTest` may not be called in this case, after the change in python/cpython#106588.

PiperOrigin-RevId: 597840713
stephenfin pushed a commit to testing-cabal/testtools that referenced this pull request Jan 16, 2024
In Python 3.12.1 python/cpython#106588 was backported which changed the
execution behavior of the unittest runner. After python/cpython#106588
startTest() is no longer being called if a test is skipped. This causes
knock-on effects in testtools because the test result subclasses were
assuming that startTest() was always called when stopTest() was called.
To handle this change in behavior when running with Python 3.12.1 this
commit adds a check to only deal with tags if they exist (when
startTest() is run).
wshanks added a commit to conda-forge/qiskit-aer-feedstock that referenced this pull request Jan 19, 2024
* Add Python 3.12 builds

The migrator seems confused by another package from a split feedstock
that also produces non-Python packages that qiskit-aer depends on
not having Python 3.12 builds yet, so this is a manual migration.

Explicitly exclude TestNoiseTransformer tests because they require cvxpy.
Previously they were skipped by unittest when cvxpy was not installed but
test skipping was broken by Python 3.12.1 (see
testing-cabal/testtools#371 and
python/cpython#106588), so we had to explicitly
skip the tests with the test runner.
serhiy-storchaka added a commit to serhiy-storchaka/cpython that referenced this pull request Jan 23, 2024
serhiy-storchaka added a commit that referenced this pull request Feb 4, 2024
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Feb 4, 2024
…in Python 3.12 (pythonGH-106588)" (pythonGH-114470)

This reverts commit 8fc0713.
(cherry picked from commit ecabff9)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
serhiy-storchaka added a commit that referenced this pull request Feb 4, 2024
…thon 3.12 (GH-106588)" (GH-114470) (GH-114994)

This reverts commit 8fc0713.
(cherry picked from commit ecabff9)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
aisk pushed a commit to aisk/cpython that referenced this pull request Feb 11, 2024
fsc-eriker pushed a commit to fsc-eriker/cpython that referenced this pull request Feb 14, 2024
Glyphack pushed a commit to Glyphack/cpython that referenced this pull request Sep 2, 2024
…6588)

Co-authored-by: sunmy2019 <59365878+sunmy2019@users.noreply.github.com>
Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants