summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_buffer.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2017-10-16 07:38:14 (GMT)
committerGitHub <noreply@github.com>2017-10-16 07:38:14 (GMT)
commit676db4bbf2e7c18dc7c35add17dd3bbdc2d3eeb3 (patch)
tree80bb141e349ef1f2c69458f93fd524624f844162 /Lib/test/test_buffer.py
parent1295e11d397c6138427296d5f9653a9e7dd69062 (diff)
downloadcpython-676db4bbf2e7c18dc7c35add17dd3bbdc2d3eeb3.zip
cpython-676db4bbf2e7c18dc7c35add17dd3bbdc2d3eeb3.tar.gz
cpython-676db4bbf2e7c18dc7c35add17dd3bbdc2d3eeb3.tar.bz2
bpo-31792: Restore os.environ in test_buffer when import numpy. (#4007)
Diffstat (limited to 'Lib/test/test_buffer.py')
-rw-r--r--Lib/test/test_buffer.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/Lib/test/test_buffer.py b/Lib/test/test_buffer.py
index b83f2f1..f302da4 100644
--- a/Lib/test/test_buffer.py
+++ b/Lib/test/test_buffer.py
@@ -17,7 +17,7 @@ from test import support
from itertools import permutations, product
from random import randrange, sample, choice
import warnings
-import sys, array, io
+import sys, array, io, os
from decimal import Decimal
from fractions import Fraction
@@ -37,7 +37,8 @@ except ImportError:
ctypes = None
try:
- with warnings.catch_warnings():
+ with support.EnvironmentVarGuard() as os.environ, \
+ warnings.catch_warnings():
from numpy import ndarray as numpy_array
except ImportError:
numpy_array = None