Skip to content

Commit b3f9d75

Browse files
authored
fix tests, figured out issue with matplotlib on windows 3.13, unpinned OSQP (#200)
* fix tests * Update test.yml * Update pyproject.toml * Update __main__.py * Update __main__.py * Update __main__.py * Update __init__.py * test warnings * retry * retry * retry * seems to have worked
1 parent 819b1a0 commit b3f9d75

File tree

4 files changed

+13
-7
lines changed

4 files changed

+13
-7
lines changed

.github/workflows/test.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ jobs:
117117
fail-fast: false
118118
matrix: # https://github.com/actions/runner-images
119119
os: [ubuntu-latest, windows-latest, macos-latest, macos-13] # last 2 are aarch64 and amd64
120-
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13.3'] # bug in 3.13.4 affecting Windows: github.com/python/cpython/issues/135151
120+
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', '>=3.13.0 <=3.13.13 || >=3.13.5 <3.14.0'] # bug in 3.13.4 affecting Windows: github.com/python/cpython/issues/135151
121121
exclude:
122122
- os: macos-latest # aarch64
123123
python-version: '3.8'
@@ -164,6 +164,10 @@ jobs:
164164
if: ${{ matrix.python-version == '3.12'}}
165165
run: python -m pip install numpy==2.1.2 scipy==1.14.1 matplotlib==3.9.2 cvxpy==1.5.3 pandas==2.2.3 osqp==0.6.7.post3 ecos==2.0.14 scs==3.2.7 pillow==11.2.1
166166

167+
- name: If running on python 3.13 install any dependency whose latest version is causing upstream issues
168+
if: ${{ matrix.python-version == '>=3.13.0 <=3.13.13 || >=3.13.5 <3.14.0'}}
169+
run: python -m pip install pillow==11.2.1 # 11.3 throws a deprecationwarning from matplotlib; works fine, https://github.com/matplotlib/matplotlib/pull/30221
170+
167171
- name: Install package
168172
run: |
169173
python -m pip install .[test]
@@ -214,4 +218,4 @@ jobs:
214218
if: startsWith(github.ref, 'refs/tags/')
215219
uses: pypa/gh-action-pypi-publish@release/v1
216220
with:
217-
skip-existing: true
221+
skip-existing: true

cvxportfolio/policies.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -948,6 +948,11 @@ def values_in_time_recursive( # pylint: disable=arguments-differ
948948
warnings.filterwarnings(
949949
"ignore", category=UserWarning,
950950
message='Solution may be inaccurate')
951+
# this one is thrown by OSQP 1.0
952+
warnings.filterwarnings(
953+
"ignore", category=PendingDeprecationWarning,
954+
message='The default value of raise_error ' +
955+
'will change to True in the future.')
951956
# cvxpy 1.4 and 1.5 FutureWarnings about ECOS deprecation
952957
if cp.__version__[:3] in ['1.4', '1.5']:
953958
warnings.filterwarnings("ignore", category=FutureWarning)

cvxportfolio/tests/__main__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,9 @@ def parseArgs( # pylint: disable=missing-param-doc,missing-type-doc
9797
self.testRunner = TextTestRunnerAllowDownloadError
9898

9999
if __name__ == '__main__': # pragma: no cover
100+
# We only test turning warnings to exceptions
101+
# on current Python versions
100102
if sys.version_info.minor > 9:
101-
# DeprecationWarning's may be thrown
102-
# when running with old versions
103103
mainOptionallyAllowDownloadError(warnings='error')
104104
else:
105105
mainOptionallyAllowDownloadError()

pyproject.toml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,6 @@ dependencies = [
3232
"requests; python_version<'3.9'",
3333
# "multiprocess", # robustifies usage w/ 3rd party modules, used if installed
3434
"scs", # it's hardcoded as fallback solver if numerical errors
35-
# following is sub-dependency; need to pin it b/c w/ recent release
36-
# problematic intf changes, confusing warnings, not resolved by caller yet
37-
"osqp<1.0.0"
3835
]
3936

4037
[project.optional-dependencies]

0 commit comments

Comments
 (0)