diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2016-11-08 19:16:07 -0500 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2016-11-08 19:16:07 -0500 |
commit | 669ac29df4931d07399a8f4779895cff2a2821c4 (patch) | |
tree | a269396e3203187dcdfdc7cff4ef3ccf55dbb871 | |
parent | 5e5a786db1b5b9d36398f715520ad7561916e1cc (diff) | |
download | python-coveragepy-git-669ac29df4931d07399a8f4779895cff2a2821c4.tar.gz |
Use py2 ConfigParser if we can, prevents deprecation warnings. #530
-rw-r--r-- | CHANGES.rst | 4 | ||||
-rw-r--r-- | coverage/backward.py | 9 |
2 files changed, 10 insertions, 3 deletions
diff --git a/CHANGES.rst b/CHANGES.rst index e7c5760a..4a6d0edf 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -43,6 +43,9 @@ Unreleased - Fixed an unusual bug involving multiple coding declarations affecting code containing code in multi-line strings: `issue 529`_. +- Prevented deprecation warnings from configparser that happened in some + circumstatnces, closing `issue 530`_. + - Corrected the name of the jquery.ba-throttle-debounce.js library. Thanks, Ben Finney. Closes `issue 505`_. @@ -55,6 +58,7 @@ Unreleased .. _issue 516: https://bitbucket.org/ned/coveragepy/issues/516/running-coverage-combine-twice-deletes-all .. _issue 525: https://bitbucket.org/ned/coveragepy/issues/525/coverage-combine-when-not-in-parallel-mode .. _issue 529: https://bitbucket.org/ned/coveragepy/issues/529/encoding-marker-may-only-appear-on-the +.. _issue 530: https://bitbucket.org/ned/coveragepy/issues/530/deprecationwarning-you-passed-a-bytestring Version 4.2 --- 2016-07-26 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: |