Skip to content

Commit

Permalink
python-stdlib: Enable more tests.
Browse files Browse the repository at this point in the history
Signed-off-by: Damien George <[email protected]>
  • Loading branch information
dpgeorge committed Jun 16, 2024
1 parent fc992b1 commit 82dd69c
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 12 deletions.
4 changes: 2 additions & 2 deletions python-stdlib/contextlib/contextlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,13 @@ class ExitStack(object):
"""

def __init__(self):
self._exit_callbacks = deque()
self._exit_callbacks = []

def pop_all(self):
"""Preserve the context stack by transferring it to a new instance"""
new_stack = type(self)()
new_stack._exit_callbacks = self._exit_callbacks
self._exit_callbacks = deque()
self._exit_callbacks = []
return new_stack

def _push_cm_exit(self, cm, cm_exit):
Expand Down
2 changes: 1 addition & 1 deletion python-stdlib/contextlib/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ def test_exit_exception_chaining_suppress(self):
def test_excessive_nesting(self):
# The original implementation would die with RecursionError here
with ExitStack() as stack:
for i in range(10000):
for i in range(5000):
stack.callback(int)

def test_instance_bypass(self):
Expand Down
2 changes: 2 additions & 0 deletions python-stdlib/datetime/test_datetime.py
Original file line number Diff line number Diff line change
Expand Up @@ -2082,9 +2082,11 @@ def test_timetuple00(self):
with LocalTz("Europe/Rome"):
self.assertEqual(dt1.timetuple()[:8], (2002, 1, 31, 0, 0, 0, 3, 31))

@unittest.skip("broken when running with non-UTC timezone")
def test_timetuple01(self):
self.assertEqual(dt27tz2.timetuple()[:8], (2010, 3, 27, 12, 0, 0, 5, 86))

@unittest.skip("broken when running with non-UTC timezone")
def test_timetuple02(self):
self.assertEqual(dt28tz2.timetuple()[:8], (2010, 3, 28, 12, 0, 0, 6, 87))

Expand Down
9 changes: 0 additions & 9 deletions python-stdlib/fnmatch/test_fnmatch.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"""Test cases for the fnmatch module."""

from test import support
import unittest

from fnmatch import fnmatch, fnmatchcase, translate, filter
Expand Down Expand Up @@ -79,11 +78,3 @@ def test_translate(self):
class FilterTestCase(unittest.TestCase):
def test_filter(self):
self.assertEqual(filter(["a", "b"], "a"), ["a"])


def main():
support.run_unittest(FnmatchTestCase, TranslateTestCase, FilterTestCase)


if __name__ == "__main__":
main()

0 comments on commit 82dd69c

Please sign in to comment.