Skip to content

Commit

Permalink
Fix TestFormatting to undo its context changes (#98)
Browse files Browse the repository at this point in the history
(cherry picked from commit 516c028)
  • Loading branch information
mdickinson committed Dec 30, 2019
1 parent 895b76a commit 079efd7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 2 additions & 1 deletion CHANGELOG.rst
Expand Up @@ -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
-----
Expand Down
6 changes: 6 additions & 0 deletions bigfloat/test/test_formatting.py
Expand Up @@ -21,6 +21,7 @@
BigFloat,
double_precision,
RoundTiesToEven,
getcontext,
setcontext,
)

Expand All @@ -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 = [
Expand Down

0 comments on commit 079efd7

Please sign in to comment.