Fix python3.11 patch and shell completions
This commit is contained in:
parent
4b920c7ebe
commit
ae17667064
@ -8,25 +8,6 @@ index fdaa9e5..e1136cc 100644
|
||||
'3.10',
|
||||
+ '3.11',
|
||||
)
|
||||
diff --git a/test/units/module_utils/urls/test_RedirectHandlerFactory.py b/test/units/module_utils/urls/test_RedirectHandlerFactory.py
|
||||
index aa3500a..7bbe4b5 100644
|
||||
--- a/test/units/module_utils/urls/test_RedirectHandlerFactory.py
|
||||
+++ b/test/units/module_utils/urls/test_RedirectHandlerFactory.py
|
||||
@@ -130,9 +130,11 @@ def test_redir_validate_certs(urllib_req, request_body, mocker):
|
||||
assert opener_mock.add_handler.call_count == int(not HAS_SSLCONTEXT)
|
||||
|
||||
|
||||
-def test_redir_http_error_308_urllib2(urllib_req, request_body):
|
||||
+def test_redir_http_error_308_urllib2(urllib_req, request_body, mocker):
|
||||
+ redir_mock = mocker.patch.object(urllib_request.HTTPRedirectHandler, 'redirect_request')
|
||||
handler = RedirectHandlerFactory('urllib2', False)
|
||||
inst = handler()
|
||||
|
||||
- with pytest.raises(urllib_error.HTTPError):
|
||||
- inst.redirect_request(urllib_req, request_body, 308, '308 Permanent Redirect', {}, 'https://docs.ansible.com/')
|
||||
+ inst.redirect_request(urllib_req, request_body, 308, '308 Permanent Redirect', {}, 'https://docs.ansible.com/')
|
||||
+
|
||||
+ assert redir_mock.call_count == 1
|
||||
diff --git a/test/units/module_utils/urls/test_fetch_url.py b/test/units/module_utils/urls/test_fetch_url.py
|
||||
index 4869bb0..94f2e1b 100644
|
||||
--- a/test/units/module_utils/urls/test_fetch_url.py
|
||||
|
@ -93,6 +93,7 @@ BuildRequires: glibc-all-langpacks
|
||||
BuildRequires: python%{python3_pkgversion}-systemd
|
||||
%endif
|
||||
|
||||
Requires: python%{python3_pkgversion}-argcomplete
|
||||
# Require packaging macros if rpm-build exists
|
||||
# This makes the transition seamless for other packages
|
||||
Requires: (ansible-packaging if rpm-build)
|
||||
@ -152,10 +153,12 @@ make PYTHON=%{python3} docs
|
||||
# make PYTHON=%{python3} -Cdocs/docsite config cli keywords modules plugins testing
|
||||
%endif
|
||||
|
||||
(
|
||||
cd bin
|
||||
for shell in bash fish; do
|
||||
mkdir -p "${shell}_completions"
|
||||
for bin in bin/*; do
|
||||
bin="$(basename ${bin})"
|
||||
mkdir -p "../${shell}_completions"
|
||||
for bin in *; do
|
||||
if grep -q PYTHON_ARGCOMPLETE_OK "${bin}"; then
|
||||
case "${shell}" in
|
||||
bash)
|
||||
format="${bin}"
|
||||
@ -164,14 +167,18 @@ for shell in bash fish; do
|
||||
format="${bin}.${shell}"
|
||||
;;
|
||||
esac
|
||||
register-python-argcomplete --shell "${shell}" "${bin}" > "${shell}_completions/${format}"
|
||||
register-python-argcomplete --shell "${shell}" "${bin}" > "../${shell}_completions/${format}"
|
||||
else
|
||||
echo "Skipped generating completions for ${bin}"
|
||||
fi
|
||||
done
|
||||
done
|
||||
)
|
||||
|
||||
%install
|
||||
%pyproject_install
|
||||
|
||||
install -Dpm 0644 bash_completions/* -t %{buildroot}%{_datadir}/bash_completion/completions
|
||||
install -Dpm 0644 bash_completions/* -t %{buildroot}%{_datadir}/bash-completion/completions
|
||||
install -Dpm 0644 fish_completions/* -t %{buildroot}%{_datadir}/fish/vendor_completions.d
|
||||
|
||||
# Create system directories that Ansible defines as default locations in
|
||||
@ -228,14 +235,14 @@ make PYTHON=%{python3} tests-py3
|
||||
%endif
|
||||
|
||||
%files
|
||||
%license COPYING licenses/{Apache-License.MIT-license,PSF-license,simplified_bsd}.txt
|
||||
%license COPYING licenses/{Apache-License,MIT-license,PSF-license,simplified_bsd}.txt
|
||||
%doc README.rst PKG-INFO changelogs/CHANGELOG-v2.13.rst
|
||||
%dir %{_sysconfdir}/ansible/
|
||||
%config(noreplace) %{_sysconfdir}/ansible/*
|
||||
%{_mandir}/man1/ansible*
|
||||
%{_bindir}/ansible*
|
||||
%{_datadir}/ansible/
|
||||
%{_datadir}/bash_completion/completions/ansible*
|
||||
%{_datadir}/bash-completion/completions/ansible*
|
||||
%dir %{_datadir}/fish
|
||||
%dir %{_datadir}/fish/vendor_completions.d
|
||||
%{_datadir}/fish/vendor_completions.d/ansible*.fish
|
||||
|
Loading…
Reference in New Issue
Block a user