From 6955728080dac59c5109a0493276106bc2c97f4a Mon Sep 17 00:00:00 2001 From: Manuel Barkhau Date: Wed, 5 Sep 2018 21:04:26 +0200 Subject: [PATCH] py27 compat fixes --- src/pycalver/config.py | 2 +- test/test_config.py | 4 ++-- travis_run_tests.sh | 1 + 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/pycalver/config.py b/src/pycalver/config.py index 7721616..88eae68 100644 --- a/src/pycalver/config.py +++ b/src/pycalver/config.py @@ -36,7 +36,7 @@ def parse_buffer(cfg_buffer: io.StringIO) -> MaybeConfig: cfg_parser = configparser.RawConfigParser() cfg_parser.readfp(cfg_buffer) - if "pycalver" not in cfg_parser: + if not cfg_parser.has_section("pycalver"): log.error("setup.cfg does not contain a [pycalver] section.") return None diff --git a/test/test_config.py b/test/test_config.py index 07ae074..3c77f26 100644 --- a/test/test_config.py +++ b/test/test_config.py @@ -25,7 +25,7 @@ def test_parse(tmpdir): setup_path = tmpdir.mkdir("minimal").join("setup.cfg") setup_path.write("\n".join(( "[pycalver]", - f"current_version = v201808.0001-dev", + "current_version = v201808.0001-dev", "commit = False", "tag = False", "", @@ -78,7 +78,7 @@ def test_parse_invalid_version(tmpdir): setup_path = tmpdir.mkdir("fail").join("setup.cfg") setup_path.write("\n".join(( "[pycalver]", - f"current_version = 0.1.0", + "current_version = 0.1.0", "commit = False", ))) diff --git a/travis_run_tests.sh b/travis_run_tests.sh index 8219e31..0b27cff 100644 --- a/travis_run_tests.sh +++ b/travis_run_tests.sh @@ -2,6 +2,7 @@ set -e # minimal test requirements for py27 testing +python -m pip install -U pip python -m pip install pytest rst2html5 rst2html5 --strict README.rst > /dev/null