pyomo
pyomo copied to clipboard
One test fails: AttributeError: type object 'Test_expr' has no attribute 'add_baseline_test'
Summary
=========================================================================================== ERRORS ===========================================================================================
___________________________________________________________________ ERROR collecting doc/OnlineDocs/tests/test_examples.py ___________________________________________________________________
doc/OnlineDocs/tests/test_examples.py:198: in <module>
Test.add_baseline_test(
E AttributeError: type object 'Test_expr' has no attribute 'add_baseline_test'
====================================================================================== warnings summary ======================================================================================
pyomo/repn/plugins/nl_writer.py:74
/disk-samsung/freebsd-ports/math/py-Pyomo/work-py39/pyomo-6.4.2/pyomo/repn/plugins/nl_writer.py:74: DeprecationWarning: invalid escape sequence \p
"""Return type for NLWriter.write()
../../../../../../usr/local/lib/python3.9/site-packages/matplotlib/__init__.py:152
../../../../../../usr/local/lib/python3.9/site-packages/matplotlib/__init__.py:152
../../../../../../usr/local/lib/python3.9/site-packages/matplotlib/__init__.py:152
../../../../../../usr/local/lib/python3.9/site-packages/matplotlib/__init__.py:152
../../../../../../usr/local/lib/python3.9/site-packages/matplotlib/__init__.py:152
/usr/local/lib/python3.9/site-packages/matplotlib/__init__.py:152: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
if LooseVersion(module.__version__) < minver:
../../../../../../usr/local/lib/python3.9/site-packages/setuptools/_distutils/version.py:346
../../../../../../usr/local/lib/python3.9/site-packages/setuptools/_distutils/version.py:346
../../../../../../usr/local/lib/python3.9/site-packages/setuptools/_distutils/version.py:346
../../../../../../usr/local/lib/python3.9/site-packages/setuptools/_distutils/version.py:346
../../../../../../usr/local/lib/python3.9/site-packages/setuptools/_distutils/version.py:346
/usr/local/lib/python3.9/site-packages/setuptools/_distutils/version.py:346: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
other = LooseVersion(other)
pyomo/contrib/pynumero/sparse/block_matrix.py:25
/disk-samsung/freebsd-ports/math/py-Pyomo/work-py39/pyomo-6.4.2/pyomo/contrib/pynumero/sparse/block_matrix.py:25: DeprecationWarning: Please use `get_index_dtype` from the `scipy.sparse` namespace, the `scipy.sparse.sputils` namespace is deprecated.
from scipy.sparse.sputils import get_index_dtype
pyomo/contrib/pynumero/sparse/utils.py:11
/disk-samsung/freebsd-ports/math/py-Pyomo/work-py39/pyomo-6.4.2/pyomo/contrib/pynumero/sparse/utils.py:11: DeprecationWarning: Please use `isscalarlike` from the `scipy.sparse` namespace, the `scipy.sparse.sputils` namespace is deprecated.
from scipy.sparse.sputils import isscalarlike
-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
================================================================================== short test summary info ===================================================================================
SKIPPED [1] pyomo/contrib/appsi/solvers/tests/test_gurobi_persistent.py:13: unittest.case.SkipTest
SKIPPED [1] pyomo/contrib/interior_point/tests/test_inverse_reduced_hessian.py:28: unittest.case.SkipTest: inverse_reduced_hessian tests require numpy, scipy, and asl
SKIPPED [1] pyomo/contrib/interior_point/tests/test_realloc.py:17: unittest.case.SkipTest: Regularization tests require ASL
SKIPPED [1] pyomo/contrib/interior_point/tests/test_reg.py:31: unittest.case.SkipTest: Regularization tests require ASL
SKIPPED [1] pyomo/contrib/pynumero/algorithms/solvers/tests/test_cyipopt_interfaces.py:25: unittest.case.SkipTest: Pynumero needs the ASL extension to run CyIpoptSolver tests
SKIPPED [1] pyomo/contrib/pynumero/algorithms/solvers/tests/test_cyipopt_solver.py:26: unittest.case.SkipTest: Pynumero needs the ASL extension to run CyIpoptSolver tests
SKIPPED [1] pyomo/contrib/pynumero/algorithms/solvers/tests/test_pyomo_ext_cyipopt.py:26: unittest.case.SkipTest: Pynumero needs the ASL extension to run CyIpoptSolver tests
SKIPPED [1] pyomo/contrib/pynumero/examples/tests/test_cyipopt_examples.py:39: unittest.case.SkipTest: Pynumero needs the ASL extension to run CyIpopt tests
SKIPPED [1] pyomo/contrib/pynumero/examples/tests/test_examples.py:11: unittest.case.SkipTest: Pynumero examples need ASL
SKIPPED [1] pyomo/contrib/pynumero/interfaces/tests/test_dynamic_model.py:27: unittest.case.SkipTest: Pynumero needs the ASL extension to run CyIpoptSolver tests
SKIPPED [1] pyomo/contrib/pynumero/interfaces/tests/test_external_asl_function.py:20: unittest.case.SkipTest: Pynumero needs the ASL extension to run NLP tests
SKIPPED [1] pyomo/contrib/pynumero/interfaces/tests/test_external_grey_box_model.py:26: unittest.case.SkipTest: Pynumero needs the ASL extension to run cyipopt tests
SKIPPED [1] pyomo/contrib/pynumero/interfaces/tests/test_external_pyomo_block.py:29: unittest.case.SkipTest: Pynumero needs the ASL extension to run cyipopt tests
SKIPPED [1] pyomo/contrib/pynumero/interfaces/tests/test_external_pyomo_model.py:27: unittest.case.SkipTest: Pynumero needs the ASL extension to run cyipopt tests
SKIPPED [1] pyomo/contrib/pynumero/interfaces/tests/test_nlp.py:23: unittest.case.SkipTest: Pynumero needs the ASL extension to run NLP tests
SKIPPED [1] pyomo/contrib/pynumero/interfaces/tests/test_nlp_projections.py:23: unittest.case.SkipTest: Pynumero needs the ASL extension to run NLP tests
SKIPPED [1] pyomo/contrib/pynumero/interfaces/tests/test_pyomo_grey_box_nlp.py:26: unittest.case.SkipTest: Pynumero needs the ASL extension to run cyipopt tests
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
========================================================================= 17 skipped, 13 warnings, 1 error in 32.06s =========================================================================
*** Error code 2
Information on your system
Pyomo version: 6.4.2 Python version: 3.9 Operating system: FreeBSD 13.1 How Pyomo was installed (PyPI, conda, source): port
This will be resolved by #2540
[I take it back... I was looking at the warnings (which have been fixed). The error on test_examples persists and will need a separate PR.]
Tests in the version 6.5.0 fail like this:
cd /usr/ports/math/py-Pyomo/work-py39/pyomo-6.5.0 && /usr/bin/env XDG_DATA_HOME=/usr/ports/math/py-Pyomo/work-py39 XDG_CONFIG_HOME=/usr/ports/math/py-Pyomo/work-py39 XDG_CACHE_HOME=/usr/ports/math/py-Pyomo/work-py39/.cache HOME=/usr/ports/math/py-Pyomo/work-py39 PATH=/usr/local/libexec/ccache:/usr/ports/math/py-Pyomo/work-py39/.bin:/home/yuri/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin PKG_CONFIG_LIBDIR=/usr/ports/math/py-Pyomo/work-py39/.pkgconfig:/usr/local/libdata/pkgconfig:/usr/local/share/pkgconfig:/usr/libdata/pkgconfig MK_DEBUG_FILES=no MK_KERNEL_SYMBOLS=no SHELL=/bin/sh NO_LINT=YES LDSHARED="cc -shared" PYTHONDONTWRITEBYTECODE= PYTHONOPTIMIZE= PREFIX=/usr/local LOCALBASE=/usr/local CC="cc" CFLAGS="-O2 -pipe -fstack-protector-strong -fno-strict-aliasing " CPP="cpp" CPPFLAGS="" LDFLAGS=" -fstack-protector-strong " LIBS="" CXX="c++" CXXFLAGS="-O2 -pipe -fstack-protector-strong -fno-strict-aliasing " MANPREFIX="/usr/local" CCACHE_DIR="/tmp/.ccache" BSD_INSTALL_PROGRAM="install -s -m 555" BSD_INSTALL_LIB="install -s -m 0644" BSD_INSTALL_SCRIPT="install -m 555" BSD_INSTALL_DATA="install -m 0644" BSD_INSTALL_MAN="install -m 444" /usr/local/bin/python3.9 -m pytest -k '' -rs -v -o addopts=
========================================================================================== test session starts ==========================================================================================
platform freebsd13 -- Python 3.9.16, pytest-7.2.1, pluggy-1.0.0 -- /usr/local/bin/python3.9
cachedir: .pytest_cache
hypothesis profile 'default' -> database=DirectoryBasedExampleDatabase('/usr/ports/math/py-Pyomo/work-py39/pyomo-6.5.0/.hypothesis/examples')
Using --randomly-seed=398085807
rootdir: /usr/ports/math/py-Pyomo/work-py39/pyomo-6.5.0, configfile: setup.cfg
plugins: forked-1.4.0, hypothesis-6.65.2, mypy-plugins-1.10.1, cov-2.9.0, randomly-3.12.0, timeout-2.1.0, rerunfailures-10.1, flaky-3.7.0, xdist-2.5.0, env-0.6.2, freezegun-0.4.2, mock-3.10.0, parallel-0.1.1
collected 14074 items / 2 errors / 18 skipped
================================================================================================ ERRORS =================================================================================================
________________________________________________________________________ ERROR collecting doc/OnlineDocs/tests/test_examples.py _________________________________________________________________________
doc/OnlineDocs/tests/test_examples.py:211: in <module>
Test.add_baseline_test(
E AttributeError: type object 'Test_data' has no attribute 'add_baseline_test'
_________________________________________________________________________ ERROR collecting pyomo/solvers/tests/mip/test_mip.yml _________________________________________________________________________
/usr/local/lib/python3.9/site-packages/pytest_mypy_plugins/collect.py:98: in collect
raise ValueError(f"Test file has to be YAML list, got {type(parsed_file)!r}.")
E ValueError: Test file has to be YAML list, got <class 'dict'>.
=========================================================================================== warnings summary ============================================================================================
pyomo/contrib/mindtpy/util.py:135
/usr/ports/math/py-Pyomo/work-py39/pyomo-6.5.0/pyomo/contrib/mindtpy/util.py:135: DeprecationWarning: invalid escape sequence \s
"""This function generates objective (FP-NLP subproblem) for minimum euclidean distance to setpoint_model.
pyomo/contrib/mindtpy/util.py:171
/usr/ports/math/py-Pyomo/work-py39/pyomo-6.5.0/pyomo/contrib/mindtpy/util.py:171: DeprecationWarning: invalid escape sequence \s
"""This function generates objective (PF-OA main problem) for minimum Norm1 distance to setpoint_model.
pyomo/contrib/mindtpy/util.py:215
/usr/ports/math/py-Pyomo/work-py39/pyomo-6.5.0/pyomo/contrib/mindtpy/util.py:215: DeprecationWarning: invalid escape sequence \m
"""This function generates objective (PF-OA main problem) for minimum Norm Infinity distance to setpoint_model.
pyomo/contrib/mindtpy/util.py:345
/usr/ports/math/py-Pyomo/work-py39/pyomo-6.5.0/pyomo/contrib/mindtpy/util.py:345: DeprecationWarning: invalid escape sequence \s
"""This function generates constraint (PF-OA main problem) for minimum Norm1 distance to setpoint_model.
pyomo/common/tests/test_deprecated.py:57
/usr/ports/math/py-Pyomo/work-py39/pyomo-6.5.0/pyomo/common/tests/test_deprecated.py:57: DeprecationWarning: invalid escape sequence \(
DeveloperError, "@deprecated\(\): missing 'version' argument"):
pyomo/common/tests/test_deprecated.py:63
/usr/ports/math/py-Pyomo/work-py39/pyomo-6.5.0/pyomo/common/tests/test_deprecated.py:63: DeprecationWarning: invalid escape sequence \(
DeveloperError, "@deprecated\(\): missing 'version' argument"):
../../../../../local/lib/python3.9/site-packages/matplotlib/__init__.py:152
../../../../../local/lib/python3.9/site-packages/matplotlib/__init__.py:152
../../../../../local/lib/python3.9/site-packages/matplotlib/__init__.py:152
../../../../../local/lib/python3.9/site-packages/matplotlib/__init__.py:152
../../../../../local/lib/python3.9/site-packages/matplotlib/__init__.py:152
/usr/local/lib/python3.9/site-packages/matplotlib/__init__.py:152: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
if LooseVersion(module.__version__) < minver:
../../../../../local/lib/python3.9/site-packages/setuptools/_distutils/version.py:346
../../../../../local/lib/python3.9/site-packages/setuptools/_distutils/version.py:346
../../../../../local/lib/python3.9/site-packages/setuptools/_distutils/version.py:346
../../../../../local/lib/python3.9/site-packages/setuptools/_distutils/version.py:346
../../../../../local/lib/python3.9/site-packages/setuptools/_distutils/version.py:346
/usr/local/lib/python3.9/site-packages/setuptools/_distutils/version.py:346: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
other = LooseVersion(other)
pyomo/contrib/doe/doe.py:1191
/usr/ports/math/py-Pyomo/work-py39/pyomo-6.5.0/pyomo/contrib/doe/doe.py:1191: DeprecationWarning: invalid escape sequence \s
"""Calculate determinant. Can be applied to FIM of any size.
pyomo/contrib/pynumero/sparse/block_matrix.py:25
/usr/ports/math/py-Pyomo/work-py39/pyomo-6.5.0/pyomo/contrib/pynumero/sparse/block_matrix.py:25: DeprecationWarning: Please use `get_index_dtype` from the `scipy.sparse` namespace, the `scipy.sparse.sputils` namespace is deprecated.
from scipy.sparse.sputils import get_index_dtype
pyomo/contrib/parmest/parmest.py:1112
/usr/ports/math/py-Pyomo/work-py39/pyomo-6.5.0/pyomo/contrib/parmest/parmest.py:1112: DeprecationWarning: invalid escape sequence \c
"""
pyomo/contrib/pynumero/sparse/utils.py:11
/usr/ports/math/py-Pyomo/work-py39/pyomo-6.5.0/pyomo/contrib/pynumero/sparse/utils.py:11: DeprecationWarning: Please use `isscalarlike` from the `scipy.sparse` namespace, the `scipy.sparse.sputils` namespace is deprecated.
from scipy.sparse.sputils import isscalarlike
../../../../../local/lib/python3.9/site-packages/pytest_freezegun.py:17: 28148 warnings
/usr/local/lib/python3.9/site-packages/pytest_freezegun.py:17: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
if LooseVersion(pytest.__version__) < LooseVersion('3.6.0'):
-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
======================================================================================== short test summary info ========================================================================================
SKIPPED [1] pyomo/contrib/appsi/solvers/tests/test_gurobi_persistent.py:13: unittest.case.SkipTest
SKIPPED [1] pyomo/contrib/interior_point/tests/test_inverse_reduced_hessian.py:28: unittest.case.SkipTest: inverse_reduced_hessian tests require numpy, scipy, and asl
SKIPPED [1] pyomo/contrib/interior_point/tests/test_realloc.py:17: unittest.case.SkipTest: Regularization tests require ASL
SKIPPED [1] pyomo/contrib/interior_point/tests/test_reg.py:31: unittest.case.SkipTest: Regularization tests require ASL
SKIPPED [1] pyomo/contrib/pynumero/algorithms/solvers/tests/test_cyipopt_interfaces.py:25: unittest.case.SkipTest: Pynumero needs the ASL extension to run CyIpoptSolver tests
SKIPPED [1] pyomo/contrib/pynumero/algorithms/solvers/tests/test_cyipopt_solver.py:26: unittest.case.SkipTest: Pynumero needs the ASL extension to run CyIpoptSolver tests
SKIPPED [1] pyomo/contrib/pynumero/algorithms/solvers/tests/test_implicit_functions.py:41: unittest.case.SkipTest: PyNumero ASL extension is necessary to test implicit function solvers
SKIPPED [1] pyomo/contrib/pynumero/algorithms/solvers/tests/test_pyomo_ext_cyipopt.py:26: unittest.case.SkipTest: Pynumero needs the ASL extension to run CyIpoptSolver tests
SKIPPED [1] pyomo/contrib/pynumero/examples/tests/test_cyipopt_examples.py:39: unittest.case.SkipTest: Pynumero needs the ASL extension to run CyIpopt tests
SKIPPED [1] pyomo/contrib/pynumero/examples/tests/test_examples.py:11: unittest.case.SkipTest: Pynumero examples need ASL
SKIPPED [1] pyomo/contrib/pynumero/interfaces/tests/test_dynamic_model.py:27: unittest.case.SkipTest: Pynumero needs the ASL extension to run CyIpoptSolver tests
SKIPPED [1] pyomo/contrib/pynumero/interfaces/tests/test_external_asl_function.py:20: unittest.case.SkipTest: Pynumero needs the ASL extension to run NLP tests
SKIPPED [1] pyomo/contrib/pynumero/interfaces/tests/test_external_grey_box_model.py:26: unittest.case.SkipTest: Pynumero needs the ASL extension to run cyipopt tests
SKIPPED [1] pyomo/contrib/pynumero/interfaces/tests/test_external_pyomo_block.py:33: unittest.case.SkipTest: Pynumero needs the ASL extension to run cyipopt tests
SKIPPED [1] pyomo/contrib/pynumero/interfaces/tests/test_external_pyomo_model.py:27: unittest.case.SkipTest: Pynumero needs the ASL extension to run cyipopt tests
SKIPPED [1] pyomo/contrib/pynumero/interfaces/tests/test_nlp.py:23: unittest.case.SkipTest: Pynumero needs the ASL extension to run NLP tests
SKIPPED [1] pyomo/contrib/pynumero/interfaces/tests/test_nlp_projections.py:23: unittest.case.SkipTest: Pynumero needs the ASL extension to run NLP tests
SKIPPED [1] pyomo/contrib/pynumero/interfaces/tests/test_pyomo_grey_box_nlp.py:26: unittest.case.SkipTest: Pynumero needs the ASL extension to run cyipopt tests
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 2 errors during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
============================================================================ 18 skipped, 28168 warnings, 2 errors in 38.98s =============================================================================
*** Error code 2
Python-3.9 FreeBSD 13.1
@yurivict this is the command we use to run pytest on Pyomo in our automated testing infrastructure:
$PYTHON_EXE -m pytest -v \
-W ignore::Warning $CATEGORY \
pyomo `pwd`/pyomo-model-libraries \
`pwd`/examples/pyomobook --junitxml="TEST-pyomo.xml"
Notice that we specifically point it to the pyomo module (along with a couple other example directories) and don't run pytest in the top level directory. In particular, we don't run it in the doc/OnlineDocs/tests
directory. Those tests have been broken for a while and are being tracked in #1950.
The other error you're reporting looks like an issue with how pytest is collecting tests and not with Pyomo itself. Could you try running pytest using a command closer to the one I've posted above and let us know if you're still seeing errors?
6.7.0 only has 1 test in doc/OnlineDocs/tests failing, but since you said that they are known to be broken I am closing this issue.