Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions build-constraints.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
setuptools<82
2 changes: 1 addition & 1 deletion cloudkittydashboard/dashboards/project/rating/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
4 changes: 2 additions & 2 deletions cloudkittydashboard/tests/test_predictive_pricing.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)

Expand Down
3 changes: 3 additions & 0 deletions tools/pip.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash
pip install 'pip==25.3'
pip install "$@"
16 changes: 12 additions & 4 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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}

Expand All @@ -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
Expand All @@ -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