diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2012-11-10 14:49:04 -0500 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2012-11-10 14:49:04 -0500 |
commit | 53f3439dab1cec091cf9623e882435e50838e448 (patch) | |
tree | 9bf76566177d5ab65d823e2681caa4d5f406a5ec /coverage/config.py | |
parent | 2416ec25d22d2d1a490fd7a1ac92fe8ed2a5ed26 (diff) | |
download | python-coveragepy-53f3439dab1cec091cf9623e882435e50838e448.tar.gz |
Properly test that config file HTML titles can be non-ascii.
Diffstat (limited to 'coverage/config.py')
-rw-r--r-- | coverage/config.py | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/coverage/config.py b/coverage/config.py index f8e400c..7a6afe4 100644 --- a/coverage/config.py +++ b/coverage/config.py @@ -1,7 +1,7 @@ """Config file for coverage.py""" -import os -from coverage.backward import string_class # pylint: disable=W0622 +import os, sys +from coverage.backward import string_class # In py3, # ConfigParser was renamed to the more-standard configparser try: @@ -13,6 +13,13 @@ except ImportError: class HandyConfigParser(configparser.ConfigParser): """Our specialization of ConfigParser.""" + def read(self, filename): + """Read a filename as UTF-8 configuration data.""" + if sys.version_info >= (3, 2): + super().read(filename, encoding="utf-8") + else: + configparser.ConfigParser.read(self, filename) + def getlist(self, section, option): """Read a list of strings. |