diff options
author | Victor Stinner <vstinner@redhat.com> | 2019-07-02 14:50:19 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-07-02 14:50:19 +0200 |
commit | 7cb9204ee1cf204f6f507d99a60f7c5bb359eebb (patch) | |
tree | ae351690ede26e65b690c5802de6aa0a850894ee /Lib/test/test_sax.py | |
parent | 039fb49c185570ab7b02f13fbdc51c859cfd831e (diff) | |
download | cpython-git-7cb9204ee1cf204f6f507d99a60f7c5bb359eebb.tar.gz |
bpo-37421: urllib.request tests call urlcleanup() (GH-14529)
urllib.request tests now call urlcleanup() to remove temporary files
created by urlretrieve() tests and to clear the _opener global
variable set by urlopen() and functions calling indirectly urlopen().
regrtest now checks if urllib.request._url_tempfiles and
urllib.request._opener are changed by tests.
Diffstat (limited to 'Lib/test/test_sax.py')
-rw-r--r-- | Lib/test/test_sax.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/Lib/test/test_sax.py b/Lib/test/test_sax.py index da4eb1da3c..ce3a422b50 100644 --- a/Lib/test/test_sax.py +++ b/Lib/test/test_sax.py @@ -20,6 +20,7 @@ import codecs import os.path import shutil from urllib.error import URLError +import urllib.request from test import support from test.support import findfile, run_unittest, FakePath, TESTFN @@ -979,6 +980,9 @@ class ExpatReaderTest(XmlTestBase): self.assertEqual(handler._entities, [("img", None, "expat.gif", "GIF")]) def test_expat_external_dtd_enabled(self): + # clear _opener global variable + self.addCleanup(urllib.request.urlcleanup) + parser = create_parser() parser.setFeature(feature_external_ges, True) resolver = self.TestEntityRecorder() |