-
Notifications
You must be signed in to change notification settings - Fork 54
test_pyptima sometimes fails on windows-lates #274
Copy link
Copy link
Open
Description
Could @nbelakovski take a look at this? Thank you very much.
test_pyptima sometimes fails on windows-lates. The failure seems to be non-deterministic, as it may disappear after re-running.
See
https://github.com/opt4ai/prima/actions/runs/22234778043/job/64323529500 (attempt 1, failure)
https://github.com/opt4ai/prima/actions/runs/22234778043/job/64347074482 (attempt 2, success)
The error message for the failure:
Obtaining file:///D:/a/prima/prima/pyprima
Installing build dependencies: started
Installing build dependencies: finished with status 'done'
Checking if build backend supports build_editable: started
Checking if build backend supports build_editable: finished with status 'done'
Getting requirements to build editable: started
Getting requirements to build editable: finished with status 'done'
Preparing editable metadata (pyproject.toml): started
Preparing editable metadata (pyproject.toml): finished with status 'done'
Requirement already satisfied: numpy in C:\hostedtoolcache\windows\Python\3.12.10\x64\Lib\site-packages (from pyprima==0.0.1) (2.4.2)
Building wheels for collected packages: pyprima
Building editable for pyprima (pyproject.toml): started
Building editable for pyprima (pyproject.toml): finished with status 'done'
Created wheel for pyprima: filename=pyprima-0.0.1-0.editable-py3-none-any.whl size=1164 sha256=4a8ae1dc72bd39e6c20f547dd90eac86155db97969dd591cd3be6f445129c318
Stored in directory: C:\Users\runneradmin\AppData\Local\Temp\pip-ephem-wheel-cache-bm_mzvab\wheels\f4\30\90\c1e25e7637e57b985f6d432bebdffefa2893375a3c81860466
Successfully built pyprima
Installing collected packages: pyprima
Successfully installed pyprima-0.0.1
============================= test session starts =============================
platform win32 -- Python 3.12.10, pytest-9.0.2, pluggy-1.6.0
rootdir: D:\a\prima\prima\pyprima
configfile: pyproject.toml
plugins: cov-7.0.0, order-1.3.0
collected 36 items / 1 skipped
tests\test_bounds.py ..F.......... [ 36%]
tests\test_end_to_end.py .... [ 47%]
tests\test_get_lincon.py ... [ 55%]
tests\test_miscellaneous.py ............... [ 97%]
tests\test_threading.py . [100%]
================================== FAILURES ===================================
___________ test_eliminate_fixed_bounds_with_nonlinear_constraints ____________
def test_eliminate_fixed_bounds_with_nonlinear_constraints():
# Ensure that the logic for fixed bounds also modifies the nonlinear constraint
# function appropriately
def f(x):
return np.sum(x**2)
lb = [-1, None, None]
ub = [-1, None, None]
bounds = [(a, b) for a, b in zip(lb, ub)]
x0 = np.array([1, 1, 1])
# Have the nonlinear constraint function operate on the last element of x, but be
# explicit about the length of x. This ensures that the test is still valid if the
# fixed bound is removed. If we simply used x[-1] this test would pass but it
# wouldn't actually test if we had properly modified the nonlinear constraint
# function after removing the fixed bounds
nlc = NLC(lambda x: x[len(x0)-1]**2, lb=9, ub=15)
res = minimize(f, x0=x0, constraints=nlc, bounds=bounds)
assert np.isclose(res.x[0], -1, atol=1e-6, rtol=1e-6)
> assert np.isclose(res.x[1], 0, atol=1e-6, rtol=1e-6)
E assert np.False_
E + where np.False_ = <function isclose at 0x0000025D5B2C2870>(np.float64(5.396434059920006e-06), 0, atol=1e-06, rtol=1e-06)
E + where <function isclose at 0x0000025D5B2C2870> = np.isclose
tests\test_bounds.py:59: AssertionError
============================== warnings summary ===============================
tests/test_miscellaneous.py::test_rhobeg_without_rhoend
D:\a\prima\prima\pyprima\src\pyprima\common\preproc.py:198: UserWarning: COBYLA: Invalid RHOBEG; it should be a positive number; it is set to 1
warn(f'{solver}: Invalid RHOBEG; it should be a positive number; it is set to {rhobeg}')
tests/test_miscellaneous.py::test_eta2_without_eta1_and_eta2_out_of_range
tests/test_miscellaneous.py::test_eta1_without_eta2_and_eta1_out_of_range
D:\a\prima\prima\pyprima\src\pyprima\common\preproc.py:144: UserWarning: COBYLA: Invalid ETA2; it should be in the interval [0, 1) and not less than ETA1; it is set to 0.7000000000000001
warn(f'{solver}: Invalid ETA2; it should be in the interval [0, 1) and not less than ETA1; it is set to {eta2}')
tests/test_miscellaneous.py::test_eta1_without_eta2_and_eta1_out_of_range
D:\a\prima\prima\pyprima\src\pyprima\common\preproc.py:135: UserWarning: COBYLA: Invalid ETA1; it should be in the interval [0, 1) and not more than ETA2; it is set to 0.09999999999999999
warn(f'{solver}: Invalid ETA1; it should be in the interval [0, 1) and not more than ETA2; it is set to {eta1}')
tests/test_miscellaneous.py::test_iprint[4]
D:\a\prima\prima\pyprima\src\pyprima\common\preproc.py:54: UserWarning: COBYLA: Invalid IPRINT; it should be 0, 1, -1, 2, -2, 3, or -3; it is set to 0
warn(f'{solver}: Invalid IPRINT; it should be 0, 1, -1, 2, -2, 3, or -3; it is set to {iprint}')
-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
=============================== tests coverage ================================
______________ coverage: platform win32, python 3.12.10-final-0 _______________
Coverage HTML written to dir htmlcov
=========================== short test summary info ===========================
FAILED tests/test_bounds.py::test_eliminate_fixed_bounds_with_nonlinear_constraints - assert np.False_
+ where np.False_ = <function isclose at 0x0000025D5B2C2870>(np.float64(5.396434059920006e-06), 0, atol=1e-06, rtol=1e-06)
+ where <function isclose at 0x0000025D5B2C2870> = np.isclose
======= 1 failed, 35 passed, 1 skipped, 5 warnings in 117.11s (0:01:57) =======
Error: Process completed with exit code 1.
The error log:
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels