summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorxdegaye <xdegaye@gmail.com>2017-11-29 10:36:48 (GMT)
committerGitHub <noreply@github.com>2017-11-29 10:36:48 (GMT)
commitcc55e78acab93a495c974b9a2ea71c8bb9cc2f5d (patch)
treeac83055d0d8578a3f09cbf3c820d0ffcfa478ce4
parent041efd292ebff46060fc1680b0608b1d4c876a48 (diff)
downloadcpython-cc55e78acab93a495c974b9a2ea71c8bb9cc2f5d.zip
cpython-cc55e78acab93a495c974b9a2ea71c8bb9cc2f5d.tar.gz
cpython-cc55e78acab93a495c974b9a2ea71c8bb9cc2f5d.tar.bz2
bpo-32139: test_strftime does not anymore modify the locale (GH-4569)
-rw-r--r--Lib/test/test_strftime.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/Lib/test/test_strftime.py b/Lib/test/test_strftime.py
index 72b1910..ec305e5 100644
--- a/Lib/test/test_strftime.py
+++ b/Lib/test/test_strftime.py
@@ -58,8 +58,10 @@ class StrftimeTest(unittest.TestCase):
import java
java.util.Locale.setDefault(java.util.Locale.US)
except ImportError:
- import locale
- locale.setlocale(locale.LC_TIME, 'C')
+ from locale import setlocale, LC_TIME
+ saved_locale = setlocale(LC_TIME)
+ setlocale(LC_TIME, 'C')
+ self.addCleanup(setlocale, LC_TIME, saved_locale)
def test_strftime(self):
now = time.time()