From 669ac29df4931d07399a8f4779895cff2a2821c4 Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Tue, 8 Nov 2016 19:16:07 -0500 Subject: Use py2 ConfigParser if we can, prevents deprecation warnings. #530 --- coverage/backward.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'coverage/backward.py') diff --git a/coverage/backward.py b/coverage/backward.py index 00fffa54..c7b607a9 100644 --- a/coverage/backward.py +++ b/coverage/backward.py @@ -17,11 +17,14 @@ try: except ImportError: from io import StringIO -# In py3, ConfigParser was renamed to the more-standard configparser +# In py3, ConfigParser was renamed to the more-standard configparser. +# But there's a py3 backport that installs "configparser" in py2, and I don't +# want it because it has annoying deprecation warnings. So try the real py2 +# import first. try: - import configparser -except ImportError: import ConfigParser as configparser +except ImportError: + import configparser # What's a string called? try: -- cgit v1.2.1