Skip to content

Commit

Permalink
Merge pull request #57 from pepkit/dev
Browse files Browse the repository at this point in the history
0.12.4
  • Loading branch information
vreuter authored May 30, 2019
2 parents 1f911b5 + 11e287c commit f63c9ca
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 24 deletions.
2 changes: 1 addition & 1 deletion attmap/_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.12.3"
__version__ = "0.12.4"
2 changes: 1 addition & 1 deletion attmap/attmap_echo.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def __getattr__(self, item, default=None, expand=True):
to be indicative of the intent of protection.
"""
try:
return super(self.__class__, self).__getattr__(item, default, expand)
return super(EchoAttMap, self).__getattr__(item, default, expand)
except (AttributeError, TypeError):
# If not, triage and cope accordingly.
if self._is_od_member(item) or \
Expand Down
4 changes: 4 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## [0.12.4] - 2019-05-30
### Fixed
- Avoid infinite recursion when an `EchoAttMap` subtype calls up to the superclass constructor: [Issue 55](https://github.com/pepkit/attmap/issues/55).

## [0.12.3] - 2019-05-18
### Changed
- `PathExAttMap` now decleares itself as lower type bound.
Expand Down
1 change: 1 addition & 0 deletions requirements/requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ mock>=2.0.0
pytest>=3.0.7
pyyaml>=3.12
pandas>=0.20.2
ubiquerg>=0.3
veracitools
22 changes: 22 additions & 0 deletions tests/regression/test_echo_subclass.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
""" Tests for subclassing EchoAttMap """

import pytest
from attmap import EchoAttMap

__author__ = "Vince Reuter"
__email__ = "[email protected]"


class _SubEcho(EchoAttMap):
""" Dummy class to derive from EchoAttMap """
def __init__(self, entries=None):
super(_SubEcho, self).__init__(entries)


@pytest.mark.parametrize("entries", [None, {}])
def test_echo_subclass_smoke(entries):
""" Superclass ctor invocation avoids infinite recursion. """
try:
_SubEcho(entries)
except RuntimeError as e:
pytest.fail(str(e))
23 changes: 1 addition & 22 deletions tests/test_path_expansion.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import string
import pytest
from attmap import *
from ubiquerg import expandpath
from ubiquerg import expandpath, TmpEnv

__author__ = "Vince Reuter"
__email__ = "[email protected]"
Expand All @@ -23,27 +23,6 @@ def pam():
return PathExAttMap()


class TmpEnv(object):
""" Temporary environment variable setting. """
def __init__(self, overwrite=False, **kwargs):
if not overwrite:
already_set = [k for k in kwargs if os.getenv(k)]
if already_set:
msg = "{} variable(s) already set: {}".\
format(len(already_set), ", ".join(already_set))
raise ValueError(msg)
self._kvs = kwargs

def __enter__(self):
for k, v in self._kvs.items():
os.environ[k] = v
return self

def __exit__(self, exc_type, exc_val, exc_tb):
for k in self._kvs:
del os.environ[k]


def get_path_env_pair(perm):
"""
Create path-like text and mapping of variable name substitutions.
Expand Down

0 comments on commit f63c9ca

Please sign in to comment.