← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~cjwatson/launchpad:py3only-config-fixture into launchpad:master

 

Colin Watson has proposed merging ~cjwatson/launchpad:py3only-config-fixture into launchpad:master.

Commit message:
Use parser.read_file in lp.services.config.fixture

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/407008

`parser.readfp` produces a `DeprecationWarning`.  I removed some other Python 2 compatibility code while I was there.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:py3only-config-fixture into launchpad:master.
diff --git a/lib/lp/services/config/fixture.py b/lib/lp/services/config/fixture.py
index 944f98a..9be9e0b 100644
--- a/lib/lp/services/config/fixture.py
+++ b/lib/lp/services/config/fixture.py
@@ -12,13 +12,13 @@ __all__ = [
     ]
 
 from configparser import RawConfigParser
+import io
 import os.path
 import shutil
 from textwrap import dedent
 
 from fixtures import Fixture
 import scandir
-import six
 
 from lp.services.config import config
 
@@ -47,11 +47,8 @@ class ConfigFixture(Fixture):
     def _parseConfigData(self, conf_data, conf_filename):
         """Parse a single chunk of config data, with no inheritance."""
         # Compare https://bugs.launchpad.net/lazr.config/+bug/1397779.
-        parser_kws = {}
-        if six.PY3:
-            parser_kws['strict'] = False
-        parser = RawConfigParser(**parser_kws)
-        parser.readfp(six.StringIO(conf_data), conf_filename)
+        parser = RawConfigParser(strict=False)
+        parser.read_file(io.StringIO(conf_data), conf_filename)
         return parser
 
     def _parseConfigFile(self, conf_filename):