From 415567c233b984e74f9e8de442358073fd2344c3 Mon Sep 17 00:00:00 2001 From: Mark Dickinson Date: Mon, 30 Dec 2019 16:56:05 +0000 Subject: [PATCH] Fix TestFormatting to undo its context changes (#98) (#99) (cherry picked from commit 516c02815e837c380207827b497978d09baed09e) --- CHANGELOG.rst | 3 ++- bigfloat/test/test_formatting.py | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index ec89fba..8211da2 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -58,7 +58,8 @@ Bugfixes - Fix initialization of the context on background threads. (#91) -- Fix unit tests that changed the context and didn't reset their changes. (#92) +- Fix unit tests that changed the context and didn't reset their changes. + (#92, #98) Build ----- diff --git a/bigfloat/test/test_formatting.py b/bigfloat/test/test_formatting.py index 7cc2e17..1fc713e 100644 --- a/bigfloat/test/test_formatting.py +++ b/bigfloat/test/test_formatting.py @@ -21,6 +21,7 @@ BigFloat, double_precision, RoundTiesToEven, + getcontext, setcontext, ) @@ -30,8 +31,13 @@ class TestFormatting(unittest.TestCase): def setUp(self): + self._original_context = getcontext() setcontext(DefaultTestContext) + def tearDown(self): + setcontext(self._original_context) + del self._original_context + def test_format(self): # Fixed precision formatting. test_triples = [