Clean up compatibility code in importlib fixtures (#19156)

This commit is contained in:
Jason R. Coombs 2020-04-15 13:55:43 -04:00 committed by GitHub
parent 5eca75df03
commit 574547a75c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 16 deletions

View File

@ -1,25 +1,11 @@
from __future__ import unicode_literals
import os
import sys
import shutil
import pathlib
import tempfile
import textwrap
import contextlib
try:
from contextlib import ExitStack
except ImportError:
from contextlib2 import ExitStack
try:
import pathlib
except ImportError:
import pathlib2 as pathlib
__metaclass__ = type
@contextlib.contextmanager
def tempdir():
@ -58,7 +44,7 @@ def install_finder(finder):
class Fixtures:
def setUp(self):
self.fixtures = ExitStack()
self.fixtures = contextlib.ExitStack()
self.addCleanup(self.fixtures.close)