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

Fixed thread termination in servers.tests.LiveServerPort on Python 3.10.9+, 3.11.1+, and 3.12+. #16444

Merged
merged 1 commit into from Jan 12, 2023

Conversation

felixxm
Copy link
Member

@felixxm felixxm commented Jan 11, 2023

Class cleanups registered in TestCase subclasses are no longer called as TestCase.doClassCleanups() only cleans up the particular class, see python/cpython@c210213 and python/cpython#99645.

…rt on Python 3.12+.

Class cleanups registered in TestCase subclasses are no longer called
as TestCase.doClassCleanups() only cleans up the particular class, see

python/cpython@c210213
@felixxm felixxm requested a review from a team January 11, 2023 12:47
@felixxm
Copy link
Member Author

felixxm commented Jan 11, 2023

@adamchainz This can be an interesting change for you ☝️

@felixxm felixxm changed the title Refs #34118 -- Fixed thread termination in servers.tests.LiveServerPort on Python 3.12+. Refs #34118 -- Fixed thread termination in servers.tests.LiveServerPort on Python 3.10.9+, 3.11.1+, and 3.12+. Jan 11, 2023
Copy link
Member

@carltongibson carltongibson left a comment

Choose a reason for hiding this comment

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

Yes, OK. Good.

(I wonder if just calling TestCase._terminate_thread() isn't more transparent in these two cases 🤔 — But that's just a ??? — no biggie :)

@felixxm
Copy link
Member Author

felixxm commented Jan 11, 2023

Yes, OK. Good.

@carltongibson Thanks for the review 👍

(I wonder if just calling TestCase._terminate_thread() isn't more transparent in these two cases thinking — But that's just a ??? — no biggie :)

Unfortunately, it won't work on previous versions of Python as _terminate_thread() would be called twice once as a class cleanup and once manually.

@felixxm felixxm changed the title Refs #34118 -- Fixed thread termination in servers.tests.LiveServerPort on Python 3.10.9+, 3.11.1+, and 3.12+. Fixed thread termination in servers.tests.LiveServerPort on Python 3.10.9+, 3.11.1+, and 3.12+. Jan 11, 2023
@felixxm felixxm merged commit d02a9f0 into django:main Jan 12, 2023
@felixxm felixxm deleted the threading-cleanups branch January 12, 2023 05:04
@adamchainz
Copy link
Sponsor Member

@adamchainz This can be an interesting change for you ☝️

That is interesting, thanks for tagging me. Your fix looks good. 🫡

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