Skip to content

Fix failing Travis build due to issues 39-45 #46

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Sep 28, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@ python:
- 3.8

before_install:
- pip install poetry
- curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py > /tmp/get-poetry.py
- python /tmp/get-poetry.py --preview --yes
- source $HOME/.poetry/env

install:
- poetry install -E yaml -E toml -E azure -E aws
- poetry install -E yaml -E toml -E azure -E aws -E gcp

script:
- poetry run pytest
Expand Down
9 changes: 8 additions & 1 deletion config/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import base64
from contextlib import contextmanager
from copy import deepcopy
from sys import version_info
from typing import (
Any,
Dict,
Expand All @@ -27,6 +28,9 @@
interpolate_object,
)

if version_info < (3, 8):
from collections import OrderedDict


class Configuration:
"""
Expand Down Expand Up @@ -299,7 +303,10 @@ def __iter__(self) -> Iterator[Tuple[str, Any]]: # noqa: D105
return iter(dict(self.items())) # type: ignore

def __reversed__(self) -> Iterator[Tuple[str, Any]]: # noqa: D105
return reversed(dict(self.items())) # type: ignore
if version_info < (3, 8):
return OrderedDict(reversed(list(self.items()))) # type: ignore
else:
return reversed(dict(self.items())) # type: ignore

def __len__(self) -> int: # noqa: D105
return len(self.keys())
Expand Down
5 changes: 4 additions & 1 deletion tests/test_interpolation.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,10 @@ def test_interpolation(): # type: ignore
assert cfg.var1 == "This is a test"

cfg = config_from_dict(
VALUES, lowercase_keys=True, interpolate=True, interpolate_type="unknown",
VALUES,
lowercase_keys=True,
interpolate=True,
interpolate_type="unknown",
)

with raises(ValueError, match='Invalid interpolation method "unknown"'):
Expand Down