Skip to content

Commit

Permalink
Merge branch 'main' into fix_test_errors
Browse files Browse the repository at this point in the history
  • Loading branch information
ksbeattie authored Aug 22, 2024
2 parents d34371d + a1be331 commit 3066db0
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 5 deletions.
11 changes: 7 additions & 4 deletions idaes/commands/extensions.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,21 @@
_log = logging.getLogger("idaes.commands.extensions")


def print_extensions_version(library_only=False):
def print_extensions_version(library_only=False, bin_directory=None):
click.echo("---------------------------------------------------")
click.echo("IDAES Extensions Build Versions")
click.echo("===================================================")
if bin_directory is None:
bin_directory = idaes.bin_directory
if not library_only:
v = os.path.join(idaes.bin_directory, "version_solvers.txt")
v = os.path.join(bin_directory, "version_solvers.txt")
try:
with open(v, "r") as f:
v = f.readline().strip()
except FileNotFoundError:
v = "no version file found"
click.echo("Solvers: v{}".format(v))
v = os.path.join(idaes.bin_directory, "version_lib.txt")
v = os.path.join(bin_directory, "version_lib.txt")
try:
with open(v, "r") as f:
v = f.readline().strip()
Expand Down Expand Up @@ -150,7 +152,8 @@ def get_extensions(
for k, i in d.items():
click.echo(f"{k:14}: {i}")
else:
print_extensions_version(library_only)
# If `to` is None, we default to idaes.bin_directory.
print_extensions_version(library_only=library_only, bin_directory=to)
else:
click.echo("\n* You must provide a download URL for IDAES binary files.")

Expand Down
2 changes: 1 addition & 1 deletion idaes/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

_log = logging.getLogger(__name__)
# Default release version if no options provided for get-extensions
default_binary_release = "3.4.0"
default_binary_release = "3.4.2"
# Where to download releases from get-extensions
release_base_url = "https://github.com/IDAES/idaes-ext/releases/download"
# Where to get release checksums
Expand Down
4 changes: 4 additions & 0 deletions idaes/core/base/process_block.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,8 @@ def __init__(self, *args, **kwargs):
dct["__process_block__"] = "indexed"
# provide function ``base_class_module()`` to get unit module, for visualizer
dct["base_class_module"] = lambda mcs: bases[0].__module__
# provide function ``process_block_class()`` to get the constructing class
dct["process_block_class"] = lambda mcs: bases[0]
return type.__new__(mcs, name, bases, dct)


Expand All @@ -130,6 +132,8 @@ def __init__(self, *args, **kwargs):
dct["__process_block__"] = "scalar"
# provide function ``base_class_module()`` to get unit module, for visualizer
dct["base_class_module"] = lambda mcs: bases[0].__module__
# provide function ``process_block_class()`` to get the constructing class
dct["process_block_class"] = lambda mcs: bases[1]
return type.__new__(mcs, name, bases, dct)


Expand Down
12 changes: 12 additions & 0 deletions idaes/core/base/tests/test_process_block.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ def test_scalar_noargs(self):
assert isinstance(m.b.y, Var)
assert value(m.b.x) == 1001
assert value(m.b.y) == 1002
assert m.b.process_block_class() is MyBlock
assert m.b.parent_component().process_block_class() is MyBlock

@pytest.mark.unit
def test_vec_noargs(self):
Expand All @@ -59,6 +61,8 @@ def test_vec_noargs(self):
assert value(m.b[2].y) == 1002
assert value(m.b[3].x) == 1001
assert value(m.b[3].y) == 1002
assert m.b[2].parent_component().process_block_class() is MyBlock
assert m.b.process_block_class() is MyBlock

@pytest.mark.unit
def test_scalar_args1(self):
Expand All @@ -68,6 +72,8 @@ def test_scalar_args1(self):
assert isinstance(m.b.y, Var)
assert value(m.b.x) == 1
assert value(m.b.y) == 2
assert m.b.process_block_class() is MyBlock
assert m.b.parent_component().process_block_class() is MyBlock

@pytest.mark.unit
def test_scalar_args2(self):
Expand All @@ -77,6 +83,8 @@ def test_scalar_args2(self):
assert isinstance(m.b.y, Var)
assert value(m.b.x) == 1
assert value(m.b.y) == 2
assert m.b.process_block_class() is MyBlock
assert m.b.parent_component().process_block_class() is MyBlock

@pytest.mark.unit
def test_vec_args(self):
Expand All @@ -97,6 +105,8 @@ def test_vec_args(self):
assert value(m.b[2].y) == 2002
assert value(m.b[3].x) == 1
assert value(m.b[3].y) == 2
assert m.b[2].parent_component().process_block_class() is MyBlock
assert m.b.process_block_class() is MyBlock

@pytest.mark.unit
def test_user_map(self):
Expand Down Expand Up @@ -128,3 +138,5 @@ def new_imap(i):
assert value(m.b[3].y) == 5002
assert value(m.b[4].x) == 7001
assert value(m.b[4].y) == 7002
assert m.b[2].parent_component().process_block_class() is MyBlock
assert m.b.process_block_class() is MyBlock

0 comments on commit 3066db0

Please sign in to comment.