Skip to content

Commit 5594c07

Browse files
Clean up compatibility code in importlib fixtures (GH-19156) (#19543)
(cherry picked from commit 574547a) Co-authored-by: Jason R. Coombs <[email protected]> Co-authored-by: Jason R. Coombs <[email protected]>
1 parent 7c82528 commit 5594c07

File tree

1 file changed

+2
-16
lines changed

1 file changed

+2
-16
lines changed

Lib/test/test_importlib/fixtures.py

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,11 @@
1-
from __future__ import unicode_literals
2-
31
import os
42
import sys
53
import shutil
4+
import pathlib
65
import tempfile
76
import textwrap
87
import contextlib
98

10-
try:
11-
from contextlib import ExitStack
12-
except ImportError:
13-
from contextlib2 import ExitStack
14-
15-
try:
16-
import pathlib
17-
except ImportError:
18-
import pathlib2 as pathlib
19-
20-
21-
__metaclass__ = type
22-
239

2410
@contextlib.contextmanager
2511
def tempdir():
@@ -58,7 +44,7 @@ def install_finder(finder):
5844

5945
class Fixtures:
6046
def setUp(self):
61-
self.fixtures = ExitStack()
47+
self.fixtures = contextlib.ExitStack()
6248
self.addCleanup(self.fixtures.close)
6349

6450

0 commit comments

Comments
 (0)