Skip to content

Commit 079efd7

Browse files
committed
Fix TestFormatting to undo its context changes (#98)
(cherry picked from commit 516c028)
1 parent 895b76a commit 079efd7

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

CHANGELOG.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@ Bugfixes
5858

5959
- Fix initialization of the context on background threads. (#91)
6060

61-
- Fix unit tests that changed the context and didn't reset their changes. (#92)
61+
- Fix unit tests that changed the context and didn't reset their changes.
62+
(#92, #98)
6263

6364
Build
6465
-----

bigfloat/test/test_formatting.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
BigFloat,
2222
double_precision,
2323
RoundTiesToEven,
24+
getcontext,
2425
setcontext,
2526
)
2627

@@ -30,8 +31,13 @@
3031

3132
class TestFormatting(unittest.TestCase):
3233
def setUp(self):
34+
self._original_context = getcontext()
3335
setcontext(DefaultTestContext)
3436

37+
def tearDown(self):
38+
setcontext(self._original_context)
39+
del self._original_context
40+
3541
def test_format(self):
3642
# Fixed precision formatting.
3743
test_triples = [

0 commit comments

Comments
 (0)