diff --git a/.github/workflows/core.yml b/.github/workflows/core.yml index 509f962829..4823aebb02 100644 --- a/.github/workflows/core.yml +++ b/.github/workflows/core.yml @@ -119,7 +119,7 @@ jobs: echo PYTEST_ADDOPTS="$PYTEST_ADDOPTS --cov --cov-report=xml" >> "$GITHUB_ENV" - name: Run pytest (not integration) run: | - pytest --pyargs idaes -m "not integration" + pytest -m "not integration" - name: Upload coverage report as GHA workflow artifact if: matrix.cov-report uses: actions/upload-artifact@v4 diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index e46ff32c77..2d7c3ae9d0 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -154,7 +154,7 @@ jobs: with: install-target: -r requirements-dev.txt - name: Run pytest (integration) - run: pytest --pyargs idaes -m integration + run: pytest -m integration examples: name: Run examples (py${{ matrix.python-version }}/${{ matrix.os }}) diff --git a/idaes/conftest.py b/idaes/conftest.py index 4b9cd1a237..d05983d941 100644 --- a/idaes/conftest.py +++ b/idaes/conftest.py @@ -41,47 +41,6 @@ #### -def pytest_addoption(parser): - parser.addoption( - "--performance", - action="store_true", - dest="performance", - default=False, - help="enable performance decorated tests", - ) - - -MARKERS = { - "build": "test of model build methods", - "cubic_root": "test requires the compiled cubic root finder", - "iapws": "test requires the compiled IAPWS95 property package", - "initialization": "test of initialization methods. These generally require a solver as well", - "solver": "test requires a solver", - "ui": "tests of an aspect of the ui", - "unit": "quick tests that do not require a solver, must run in <2s", - "component": "quick tests that may require a solver", - "integration": "long duration tests", - "performance": "tests for the IDAES performance testing suite", -} - - -def pytest_configure(config: pytest.Config): - for name, description in MARKERS.items(): - config.addinivalue_line("markers", f"{name}: {description}") - - if not config.option.performance: - if len(config.option.markexpr) > 0: - setattr( - config.option, - "markexpr", - f"{config.option.markexpr} and not performance", - ) - else: - setattr(config.option, "markexpr", "not performance") - else: - setattr(config.option, "markexpr", "performance") - - REQUIRED_MARKERS = {"unit", "component", "integration", "performance"} ALL_PLATFORMS = {"darwin", "linux", "win32"} @@ -156,6 +115,30 @@ def _validate_required_markers(item, required_markers=None, expected_count=1): pytest.fail(msg) +def pytest_addoption(parser): + parser.addoption( + "--performance", + action="store_true", + dest="performance", + default=False, + help="enable performance decorated tests", + ) + + +def pytest_configure(config): + if not config.option.performance: + if len(config.option.markexpr) > 0: + setattr( + config.option, + "markexpr", + f"{config.option.markexpr} and not performance", + ) + else: + setattr(config.option, "markexpr", "not performance") + else: + setattr(config.option, "markexpr", "performance") + + ModuleName = str diff --git a/idaes/core/util/scaling.py b/idaes/core/util/scaling.py index c0ec998ac7..d4bd8256aa 100644 --- a/idaes/core/util/scaling.py +++ b/idaes/core/util/scaling.py @@ -47,7 +47,7 @@ from pyomo.dae.flatten import slice_component_along_sets from pyomo.util.calc_var_value import calculate_variable_from_constraint from pyomo.core import expr as EXPR -from pyomo.common.numeric_types import native_types +from pyomo.core.expr.numvalue import native_types, pyomo_constant_types from pyomo.core.base.units_container import _PyomoUnit import idaes.logger as idaeslog @@ -1509,7 +1509,7 @@ def exitNode(self, node, data): # first check if the node is a leaf nodetype = type(node) - if nodetype in native_types: + if nodetype in native_types or nodetype in pyomo_constant_types: return [node] node_func = self.node_type_method_map.get(nodetype, None) diff --git a/pytest.ini b/pytest.ini index ccd02e93f6..1a53544a9a 100644 --- a/pytest.ini +++ b/pytest.ini @@ -1,7 +1,19 @@ [pytest] -addopts = --durations=100 - --durations-min=2 +addopts = --pyargs idaes + --durations=100 + -W ignore log_file = pytest.log log_file_date_format = %Y-%m-%dT%H:%M:%S log_file_format = %(asctime)s %(levelname)-7s <%(filename)s:%(lineno)d> %(message)s -log_file_level = INFO \ No newline at end of file +log_file_level = INFO +markers = + build: test of model build methods + cubic_root : test requires the compiled cubic root finder + iapws: test requires the compiled IAPWS95 property package + initialization: test of initialization methods. These generally require a solver as well + solver: test requires a solver + ui: tests of an aspect of the ui + unit: quick tests that do not require a solver, must run in <2s + component: quick tests that may require a solver + integration: long duration tests + performance: tests for the IDAES performance testing suite diff --git a/setup.py b/setup.py index 902cf7a3df..bf1676ecd3 100644 --- a/setup.py +++ b/setup.py @@ -93,7 +93,7 @@ class ExtraDependencies: ] omlt = [ "omlt==1.1", # fix the version for now as package evolves - 'tensorflow < 2.16.1 ; python_version < "3.12"', + 'tensorflow; python_version < "3.12"', ] grid = [ "gridx-prescient>=2.2.1", # idaes.tests.prescient