From 77f0953d613f5b2fc0474f9ca17d03c76d3330f3 Mon Sep 17 00:00:00 2001 From: Ivan Anfimov Date: Tue, 28 Apr 2026 15:43:33 +0300 Subject: [PATCH 1/2] Constrain setuptools<82 due to pkg_resources deprecation This way the tests on the gates should still pass with minimal code changes. Change-Id: I4b7c677d58a281dce6ee48eb9eb239538bf9f1ea Co-authored-by: Radomir Dopieralski Signed-off-by: Ivan Anfimov --- build-constraints.txt | 1 + tools/pip.sh | 3 +++ tox.ini | 16 ++++++++++++---- 3 files changed, 16 insertions(+), 4 deletions(-) create mode 100644 build-constraints.txt create mode 100755 tools/pip.sh diff --git a/build-constraints.txt b/build-constraints.txt new file mode 100644 index 0000000..b722ef6 --- /dev/null +++ b/build-constraints.txt @@ -0,0 +1 @@ +setuptools<82 diff --git a/tools/pip.sh b/tools/pip.sh new file mode 100755 index 0000000..eebd54e --- /dev/null +++ b/tools/pip.sh @@ -0,0 +1,3 @@ +#!/bin/bash +pip install 'pip==25.3' +pip install "$@" diff --git a/tox.ini b/tox.ini index d783310..aa778f2 100644 --- a/tox.ini +++ b/tox.ini @@ -7,11 +7,16 @@ ignore_basepython_conflict = True [testenv] basepython = python3 usedevelop = True -install_command = pip install -c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/2025.1} -U {opts} {packages} +install_command = {toxinidir}/tools/pip.sh --build-constraint={toxinidir}/build-constraints.txt {opts} {packages} setenv = VIRTUAL_ENV={envdir} -deps = -r{toxinidir}/requirements.txt +deps = -c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/2025.1} + -r{toxinidir}/requirements.txt -r{toxinidir}/test-requirements.txt + pip==25.3 # Needed for build-constraints.txt + setuptools<82 # Due to deprecation of pkg_resources +allowlist_externals = + {toxinidir}/tools/pip.sh commands = stestr run --slowest {posargs} @@ -32,13 +37,16 @@ commands = coverage xml -o cover/coverage.xml [testenv:docs] -deps = -r{toxinidir}/doc/requirements.txt +deps = -c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/2025.1} + -r{toxinidir}/doc/requirements.txt + setuptools<82 # Due to deprecation of pkg_resources commands = sphinx-build -W --keep-going -b html doc/source doc/build/html [testenv:pdf-docs] deps = {[testenv:docs]deps} allowlist_externals = make + {toxinidir}/tools/pip.sh commands = sphinx-build -W --keep-going -b latex doc/source doc/build/pdf make -C doc/build/pdf @@ -55,6 +63,6 @@ builtins = _ exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,build,.ropeproject,releasenotes [testenv:releasenotes] -deps = -r{toxinidir}/doc/requirements.txt +deps = {[testenv:docs]deps} commands = sphinx-build -a -E -W -d releasenotes/build/doctrees --keep-going -b html releasenotes/source releasenotes/build/html From 5dbc016a68c91b7907c6a9de8ca7265520153220 Mon Sep 17 00:00:00 2001 From: Wqrld Date: Fri, 11 Jul 2025 14:07:16 +0200 Subject: [PATCH 2/2] Replace deprecated is_ajax call. This fixes the broken /project/rating endpoint Change-Id: I6d7b7e4defa06b1927d8d31ec828fdaabca2cf39 Signed-off-by: Wqrld (cherry picked from commit d836c6e09d0cd205c34bfb6d7d0a86826d6281b2) --- cloudkittydashboard/dashboards/project/rating/views.py | 2 +- cloudkittydashboard/tests/test_predictive_pricing.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cloudkittydashboard/dashboards/project/rating/views.py b/cloudkittydashboard/dashboards/project/rating/views.py index 87ee80c..f1e9139 100644 --- a/cloudkittydashboard/dashboards/project/rating/views.py +++ b/cloudkittydashboard/dashboards/project/rating/views.py @@ -52,7 +52,7 @@ def get_data(self): def quote(request): pricing = 0.0 - if request.is_ajax(): + if request.headers.get('x-requested-with') == 'XMLHttpRequest': if request.method == 'POST': json_data = json.loads(request.body) diff --git a/cloudkittydashboard/tests/test_predictive_pricing.py b/cloudkittydashboard/tests/test_predictive_pricing.py index 38c898b..8fad16b 100644 --- a/cloudkittydashboard/tests/test_predictive_pricing.py +++ b/cloudkittydashboard/tests/test_predictive_pricing.py @@ -36,7 +36,7 @@ def setUp(self): def _test_quote_request_not_ajax_post(self, arg): request = mock.MagicMock() if arg == 'ajax': - request.is_ajax.return_value = False + request.headers.get.return_value = None # Not an AJAX request elif arg == 'method': request.method == 'POST' resp = self.quote(request) @@ -57,7 +57,7 @@ def test_quote_does_update_request_dict(self, api_mock): {'other_key': None, 'service': 'test_service'}] request = mock.MagicMock() - request.is_ajax.return_value = True + request.headers.get.return_value = 'XMLHttpRequest' request.method = 'POST' request.body = json.dumps(body)