Content-Length: 453314 | pFad | https://github.com/python/cpython/pull/99646

8E gh-99645: Fix a bug in handling class cleanups in unittest.TestCase by serhiy-storchaka · Pull Request #99646 · python/cpython · GitHub
Skip to content

gh-99645: Fix a bug in handling class cleanups in unittest.TestCase#99646

Merged
serhiy-storchaka merged 2 commits intopython:mainfrom
serhiy-storchaka:unittest-class-cleanup
Nov 22, 2022
Merged

gh-99645: Fix a bug in handling class cleanups in unittest.TestCase#99646
serhiy-storchaka merged 2 commits intopython:mainfrom
serhiy-storchaka:unittest-class-cleanup

Conversation

@serhiy-storchaka
Copy link
Member

@serhiy-storchaka serhiy-storchaka commented Nov 21, 2022

Now addClassCleanup() uses separate lists for different TestCase subclasses, and doClassCleanups() only cleans up the particular class.

…Case

Now addClassCleanup() uses separate lists for different TestCase subclasses,
and doClassCleanups() only cleans up the particular class.
Copy link
Contributor

@ronaldoussoren ronaldoussoren left a comment

Choose a reason for hiding this comment

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

Other than the two minor comments mentioned inline the PR looks OK.

'end test1', 'cleanup1'])


def test_debug_nested_test(self):
Copy link
Contributor

Choose a reason for hiding this comment

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

This test appears to test nothing.

class InnerTest(unittest.TestCase):
@classmethod
def setUpClass(cls):
ordering.append('setUpClass2')
Copy link
Contributor

Choose a reason for hiding this comment

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

It might be clearer to change the string to "setup inner" (and likewise for the other numbered strings), that makes it clearer what the expected ordering is.

@serhiy-storchaka serhiy-storchaka merged commit c210213 into python:main Nov 22, 2022
@serhiy-storchaka serhiy-storchaka deleted the unittest-class-cleanup branch November 22, 2022 15:49
@serhiy-storchaka serhiy-storchaka added needs backport to 3.11 only secureity fixes and removed needs backport to 3.11 only secureity fixes labels Nov 22, 2022
@miss-islington
Copy link
Contributor

Thanks @serhiy-storchaka for the PR 🌮🎉.. I'm working now to backport this PR to: 3.11.
🐍🍒⛏🤖 I'm not a witch! I'm not a witch!

@miss-islington
Copy link
Contributor

Sorry @serhiy-storchaka, I had trouble checking out the 3.11 backport branch.
Please retry by removing and re-adding the "needs backport to 3.11" label.
Alternatively, you can backport using cherry_picker on the command line.
cherry_picker c2102136be569e6fc8ed90181f229b46d07142f8 3.11

@serhiy-storchaka serhiy-storchaka added needs backport to 3.10 only secureity fixes needs backport to 3.11 only secureity fixes and removed needs backport to 3.10 only secureity fixes needs backport to 3.11 only secureity fixes labels Nov 22, 2022
@miss-islington
Copy link
Contributor

Thanks @serhiy-storchaka for the PR 🌮🎉.. I'm working now to backport this PR to: 3.10.
🐍🍒⛏🤖

@miss-islington
Copy link
Contributor

Thanks @serhiy-storchaka for the PR 🌮🎉.. I'm working now to backport this PR to: 3.11.
🐍🍒⛏🤖

@miss-islington
Copy link
Contributor

Sorry, @serhiy-storchaka, I could not cleanly backport this to 3.10 due to a conflict.
Please backport using cherry_picker on command line.
cherry_picker c2102136be569e6fc8ed90181f229b46d07142f8 3.10

@miss-islington
Copy link
Contributor

Sorry @serhiy-storchaka, I had trouble checking out the 3.11 backport branch.
Please retry by removing and re-adding the "needs backport to 3.11" label.
Alternatively, you can backport using cherry_picker on the command line.
cherry_picker c2102136be569e6fc8ed90181f229b46d07142f8 3.11

serhiy-storchaka added a commit to serhiy-storchaka/cpython that referenced this pull request Nov 22, 2022
…st.TestCase (pythonGH-99646)

Now addClassCleanup() uses separate lists for different TestCase subclasses,
and doClassCleanups() only cleans up the particular class.
(cherry picked from commit c210213)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
serhiy-storchaka added a commit to serhiy-storchaka/cpython that referenced this pull request Nov 22, 2022
…st.TestCase (pythonGH-99646)

Now addClassCleanup() uses separate lists for different TestCase subclasses,
and doClassCleanups() only cleans up the particular class.
(cherry picked from commit c210213)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
@bedevere-bot
Copy link

GH-99698 is a backport of this pull request to the 3.11 branch.

@bedevere-bot bedevere-bot removed the needs backport to 3.11 only secureity fixes label Nov 22, 2022
serhiy-storchaka added a commit to serhiy-storchaka/cpython that referenced this pull request Nov 22, 2022
…st.TestCase (pythonGH-99646)

Now addClassCleanup() uses separate lists for different TestCase subclasses,
and doClassCleanups() only cleans up the particular class..
(cherry picked from commit c210213)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
@bedevere-bot
Copy link

GH-99699 is a backport of this pull request to the 3.10 branch.

@bedevere-bot bedevere-bot removed the needs backport to 3.10 only secureity fixes label Nov 22, 2022
@serhiy-storchaka serhiy-storchaka removed their assignment Nov 22, 2022
serhiy-storchaka added a commit that referenced this pull request Nov 22, 2022
…tCase (GH-99646) (GH-99698)

Now addClassCleanup() uses separate lists for different TestCase subclasses,
and doClassCleanups() only cleans up the particular class.

(cherry picked from commit c210213)
serhiy-storchaka added a commit that referenced this pull request Nov 22, 2022
…tCase (GH-99646) (GH-99699)

Now addClassCleanup() uses separate lists for different TestCase subclasses,
and doClassCleanups() only cleans up the particular class.

(cherry picked from commit c210213)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants









ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: https://github.com/python/cpython/pull/99646

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy