Skip to content

Commit

Permalink
Fix pyutilib dependency; Fix pytest-attrdict issue
Browse files Browse the repository at this point in the history
  • Loading branch information
sjpfenninger committed Jul 29, 2021
1 parent 16da9b5 commit 762c322
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 6 deletions.
2 changes: 1 addition & 1 deletion calliope/backend/pyomo/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import pyomo.environ as pe # pylint: disable=unused-import,import-error

# TempfileManager is required to set log directory
from pyutilib.services import TempfileManager # pylint: disable=import-error
from pyomo.common.tempfiles import TempfileManager # pylint: disable=import-error

from calliope.backend.pyomo.util import (
get_var,
Expand Down
8 changes: 7 additions & 1 deletion calliope/core/attrdict.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,13 @@ class AttrDict(dict):
"""

__getattr__ = dict.__getitem__
def __getattr__(self, item):
try:
return self[item]
except KeyError:
if item.startswith("__"):
raise AttributeError

__setattr__ = dict.__setitem__

def __init__(self, source_dict=None):
Expand Down
6 changes: 3 additions & 3 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@ def __getattr__(cls, name):
"pyomo.core",
"pyomo.opt",
"pyomo.environ",
"pyutilib",
"pyutilib.services",
"pyutilib.services.TempfileManager",
"pyomo.common",
"pyomo.common.tempfiles",
"pyomo.common.tempfiles.TempfileManager",
"yaml",
"pandas",
"pandas.api",
Expand Down
2 changes: 1 addition & 1 deletion requirements.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ dependencies:
- pyomo=6.0
- pytest-cov
- pytest-xdist # pytest distributed testing plugin
- pytest=5.2 # 5.3 fails with KeyError: '__name__' when collecting items
- pytest
- ruamel.yaml=0.16
- scikit-learn
- xarray=0.17

0 comments on commit 762c322

Please sign in to comment.