commit 06d2e96dae21db883c451f22ce33434d156b7f0224020fffb33ccbdc0f1d6143 Author: Steve Kowalik Date: Wed Dec 4 06:05:03 2024 +0000 - Add patch support-python-313.patch: * Do not use crypt for testing. - Switch to pyproject macros. OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:pytest/python-pytest-testinfra?expand=0&rev=18 diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..9b03811 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,23 @@ +## Default LFS +*.7z filter=lfs diff=lfs merge=lfs -text +*.bsp filter=lfs diff=lfs merge=lfs -text +*.bz2 filter=lfs diff=lfs merge=lfs -text +*.gem filter=lfs diff=lfs merge=lfs -text +*.gz filter=lfs diff=lfs merge=lfs -text +*.jar filter=lfs diff=lfs merge=lfs -text +*.lz filter=lfs diff=lfs merge=lfs -text +*.lzma filter=lfs diff=lfs merge=lfs -text +*.obscpio filter=lfs diff=lfs merge=lfs -text +*.oxt filter=lfs diff=lfs merge=lfs -text +*.pdf filter=lfs diff=lfs merge=lfs -text +*.png filter=lfs diff=lfs merge=lfs -text +*.rpm filter=lfs diff=lfs merge=lfs -text +*.tbz filter=lfs diff=lfs merge=lfs -text +*.tbz2 filter=lfs diff=lfs merge=lfs -text +*.tgz filter=lfs diff=lfs merge=lfs -text +*.ttf filter=lfs diff=lfs merge=lfs -text +*.txz filter=lfs diff=lfs merge=lfs -text +*.whl filter=lfs diff=lfs merge=lfs -text +*.xz filter=lfs diff=lfs merge=lfs -text +*.zip filter=lfs diff=lfs merge=lfs -text +*.zst filter=lfs diff=lfs merge=lfs -text diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..57affb6 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.osc diff --git a/pytest-testinfra-10.1.1.tar.gz b/pytest-testinfra-10.1.1.tar.gz new file mode 100644 index 0000000..9bc69f4 --- /dev/null +++ b/pytest-testinfra-10.1.1.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a876f1453a01b58d94d9d936dd50344c2c01ac7880a2b41d15bdf233aed9cf1f +size 86567 diff --git a/python-pytest-testinfra.changes b/python-pytest-testinfra.changes new file mode 100644 index 0000000..7cb49bf --- /dev/null +++ b/python-pytest-testinfra.changes @@ -0,0 +1,369 @@ +------------------------------------------------------------------- +Wed Dec 4 06:04:30 UTC 2024 - Steve Kowalik + +- Add patch support-python-313.patch: + * Do not use crypt for testing. +- Switch to pyproject macros. + +------------------------------------------------------------------- +Fri Jun 7 07:02:49 UTC 2024 - Dirk Müller + +- update to 10.1.1: + * [FIX] Add check for the existence of ssh control path + directory + * [FIX] Handle is_installed for rpm package when rpm database + is corrupted + * [FIX] Fix service.exists + +------------------------------------------------------------------- +Sat Mar 16 12:58:20 UTC 2024 - Dirk Müller + +- update to 10.1.0: + * [NEW] Add Interface.link property + * [FIX] Make file properties follow symlinks + * [FIX] Require pytest>=6 and use future annotations for + pytest<7 compatibility + +------------------------------------------------------------------- +Mon Jan 15 14:11:05 UTC 2024 - Dirk Müller + +- update to 10.0.0: + * [FIX] Fix output of error message + * [FIX] Ansible: Fix for missing group names in get_variables() + * [FIX] testinfra/modules/blockdevice: Don't fail on stderr + * [DOC] Extend and show the documentation of CommandResult + * [FIX] Extend list of valid suffixes for systemd units + * [DOC] Add missing Environment doc section + * [MISC] Define types for plugin.py + * [MISC] Bump actions/checkout from 3 to 4 + * [FIX] Missing RHEL distribution in package module + * [NEW] feat(package): brew support + * [NEW] Add Service.exists + * [MISC] Make CommandResult a dataclass +- update to 9.0.0: + * [BREAKING] pytest-testinfra now require python >= 3.9 + * [BREAKING] Drop deprecated module PipPackage + * [NEW] Add support for the SSH ControlPath connection sharing + option + * [FIX] Retry SSH on ConnectionResetError + * [FIX] List openSUSE Leap and Tumbleweed explicitly as rpm + based distributions + * [FIX] Make group name mandatory in group module + +------------------------------------------------------------------- +Mon May 22 04:16:57 UTC 2023 - Georg Pfuetzenreuter + +- Update to 8.1.0: + * [NEW] Add Windows support for File and Service modules + * [NEW] Add File.is_executable property + +- 8.0.0: + * [NEW] Add Group.members attribute + * [NEW] Add File.inode attribute + * [NEW] Add Interface.routes() method + * [NEW] Add Docker.is_restarting attribute + * [FIX] Fix possible error in Interface.default() + * [FIX] Fix busybox detection in Process module + * [FIX] Fix possible KeyError in SysInfo module + * [BREAKING] drop support for python 3.7 + +- 7.0.1: + * [FIX] Fix command -v compatibility with dash shell + +------------------------------------------------------------------- +Tue May 9 21:23:17 UTC 2023 - Dirk Müller + +- update to 7.0.0: + * Improved ssh config support in Paramiko backend + * Add chroot backend + * Add support for Manjaro-Linux + * Add support for Cloudlinux + * [BREAKING] Drop support for python 3.6 which is EOL + * Handle ansible_connection type community.docker.docker + * add ssh_extra_args option + * Allow to test for user password expiration + * Handle ANSIBLE_SSH_COMMON_ARGS and + ANSIBLE_SSH_EXTRA_ARGS environment variables for ansible + connections + * Fix encoding issue in salt connections + * Fix AttributeError when "command" is not available and + fallback to "which" + * Fallback to which when "command -v" fails + * Use realpath by default to resolve symlinks instead of + "readlink -f" + * ansible: Support environment variables + * Force package module to resolve to RpmPackage on Fedora + * Fix new versions of supervisor may exit with status != 0 + * Eventually decode ansible output when it's not ascii + * Either use python3 or python to get remote encoding + * Implement Interface names and default (#615) + * Implement Service.systemd_properties (#612) + +------------------------------------------------------------------- +Fri May 5 19:55:05 UTC 2023 - Johannes Kastl + +- add sle15_python_module_pythons + +------------------------------------------------------------------- +Tue Apr 27 11:12:59 UTC 2021 - Matej Cepl + +- Rename package to the upstream name: python-pytest-testinfra. + +------------------------------------------------------------------- +Mon Apr 26 18:16:40 UTC 2021 - Ben Greiner + +- Update to 6.3.0 + * Fix #451 for use with pytest -p no:terminal + * Add client_version() and server_version() and version() to + docker module. +- Release 6.2.0 + * Fix #590: Systeminfo doesn't resolve Windows correctly (#592) + * First implementation of network namespaces in addr module + (#596) + * pip check support in PipPackage module (#605) + * pip refactoring: implementation of installed and version (#606) + * Allow to specify supervisorctl and supervisord.conf paths + (#536) +- Release 6.1.0 + * Fix wrong package module on CentOS having dpkg tools installed + #570 (#575) + * Deduplicate hosts returned by get_backends() (#572) + * Use /run/systemd/system/ to detect systemd (fixes #546) + * Use ssh_args from ansible.cfg + * Require python >= 3.6 + * Fix ValueError with python 3.8+ when using --nagios option. +- Release 6.0.0 + * Breaking change: testinfra has moved to the + https://github.com/pytest-dev/ organization. Project on PyPi + is renamed as pytest-testinfra. A dummy testinfra will make + the transition, but you should rename to pytest-testinfra in + your requirements files. +- Add testinfra-parametrize-backends-test.patch in order to be able + to skip salt backend and still test the rest. + (All docker tests are skipped automatically, because no there is + no docker host running.) +- Ignore upstream test-requirements.txt version pins: + * tornado < 5 + * ansible >= 3 + +------------------------------------------------------------------- +Fri Jul 3 06:02:57 UTC 2020 - Steve Kowalik + +- Upate to 5.2.1: + * Fix documentation build + * Allow kubeconfig context to be supplied in kubernetes backend + * Drop file.__ne__ implementation and require python >= 3.5 + * Use remote_user and remote_port in ansible.cfg + * Add arch (architecture) attribute to system_info module + +------------------------------------------------------------------- +Wed Mar 11 11:31:39 UTC 2020 - pgajdos@suse.com + +- version update to 5.0.0 + 5.0.0 + ===== + * Breaking change: host.file().listdir() is now a method + 4.1.0 + ===== + * Pass extra arguments to ansible CLI via host.ansible() + * New method host.file.listdir() to list items in a directory. + +------------------------------------------------------------------- +Thu Feb 6 12:11:37 UTC 2020 - Ondřej Súkup + +- update to 4.0.0 + * drop python 2 support + * Add podman backend and module + * Add extras for backend dependencies + * various enhencements of kitchen integration documentation + * ansible backend now support "password" field from ansible inventory + * New backend "openshift" + * Fix Process module when working with long strings (username, ...) + +------------------------------------------------------------------- +Mon Sep 16 13:27:28 UTC 2019 - Tomáš Chvátal + +- Update to 3.2.0: + * New module "environment" for getting remote environment variables + * New module "block_device" exposing block device informations + * Add a global flag --force-ansible to the command line + * Raise an error in case of missing ansible inventory file + * Fix an escape issue with ansible ssh args set inventory or configuration file + +------------------------------------------------------------------- +Wed Aug 28 12:26:12 UTC 2019 - Marketa Calabkova + +- update to version 3.1.0 + * ssh connections uses persistent connections by default. + * ansible ssh connections now use ssh backend instead of paramiko. + * Add a new ansible connection options “force_ansible”, when set + to True, testinfra will always call ansible for all commands + he need to run. + * Handle all ansible connections types by setting force_ansible=True + for connections which doesn’t have a testinfra equivalent connection + (for example “network_cli”). + +------------------------------------------------------------------- +Tue Aug 27 06:30:54 UTC 2019 - Jan Engelhardt + +- Language fixes to the description. + +------------------------------------------------------------------- +Tue Aug 13 16:55:33 UTC 2019 - Sean Marlow + +- Update to 3.0.6: + + Issue full command logging using DEBUG log level to avoid + logging sensible data when log level is INFO. + + Fix possible crash when parsing ansible inventories. + + Support using alternative kubeconfig file in kubectl + connections. + + Support parsing ProxyCommand from ssh_config for paramiko + connections. + +------------------------------------------------------------------- +Mon Jun 3 10:06:46 UTC 2019 - Tomáš Chvátal + +- Update to 3.0.5: + * Set default timeout to 10s on ssh/paramiko connections + * Add support for ansible inventory parameter ansible_private_key_file + +------------------------------------------------------------------- +Fri May 24 19:26:49 UTC 2019 - Tomáš Chvátal + +- Update to 3.0.4: + * Add support for ansible lxc and lxd connections + +------------------------------------------------------------------- +Thu May 16 20:39:31 UTC 2019 - ranand@suse.com + +- Removed _multibuild, not needed here. + +------------------------------------------------------------------- +Thu May 16 20:27:54 UTC 2019 - ranand@suse.com + +- update to version 3.0.3 + 3.0.3 + * Fix paramiko parsing RequestTTY from ssh configs + * Re-add "groups" key from ansible.get_variables() + to be backward compatible with testinfra 2.X + 3.0.2 + * Fix ansible with no inventory resolving to "localhost" + * Fix support for ansible 2.8 with no inventory + * Fix ansible/paramiko which wasn't reading hosts config + from ~/.ssh/config + * Allow to pass --ssh-config and --ssh-identity-file to + ansible connection + 3.0.1 + * Fix parsing of ipv6 adresses for paramiko, ssh and + ansible backends. + * Fix --connection=ansible invocation when no hosts are provided + 3.0.0 + * New ansible backend fixing support for ansible 2.8 and + license issue. + * Windows support is improved. + +------------------------------------------------------------------- +Tue Apr 16 10:10:11 UTC 2019 - Marketa Calabkova + +- update to version 2.1.0 + * socket: fix parsing of ipv6 addresses with new versions of ss + * Add addr module, used to test network connectivity + * Drop deprecated "testinfra" command, you should use "py.test" + instead + * Drop support for ansible <= 2.4 + * Drop deprecated top level fixtures, access them through the + fixture "host" instead. + 1.1?.0 + * Fix pytest 4 compatibility + * Allow to urlencode character in host specification "user:pass@host" + * Drop support for python 2.6 + * Allow to configure timeouts for winrm backend + * Add support for ansible "become" user in ansible module + * packaging: Use setuptools_scm instead of pbr + * iptables: add ip6tables support + * Fix no_ssl and no_verify_ssl options for WinRM backend + +------------------------------------------------------------------- +Tue Dec 4 12:55:11 UTC 2018 - Matej Cepl + +- Remove superfluous devel dependency for noarch package + +------------------------------------------------------------------- +Thu Jul 19 19:57:27 UTC 2018 - sean.marlow@suse.com + +- Update to v1.14.0 + + Add a new lxc backend + + Socket: fix is_listening for unix sockets + + Add namespace and container support for kubernetes backend + + Add a cache of parsed ansible inventories for ansible backend + + Service: fix service detection on Centos 6 hosts + + File: implement file comparison with string paths +- Update to v1.13.1 + + package: fix is_installed and version behavior for uninstalled + packages + + ansible: Use predictibles test ordering when using pytest-xdist + to fix random test collections errors +- Update to v1.13.0 + + socket: fix detection of udp listening sockets + + ssh backend: Add support for GSSAPI + +------------------------------------------------------------------- +Tue May 1 18:11:56 UTC 2018 - sean.marlow@suse.com + +- Update to v1.12.0 + + ansible: fix compatibility with ansible 2.5 + + pip: fix compatibility with pip 10 +- Update to v1.11.1 + + Socket: fix error with old versions of ss without the + --no-header option +- Update to v1.11.0 + + Fix bad error reporting when using ansible module without + ansible backend + + Socket: add a new implementation using ss instead of netstat + + Add service, process, and systeminfo support for Alpine +- Update to v1.10.1 + + Fix get_variables() for ansible>=2.0,<2.4 + + Paramiko: Use the RequireTTY setting if specified in a + provided SSHConfig +- Update to v1.10.0 + + New iptables module +- Update to v1.9.1 + + Fix running testinfra within a suite using doctest (#268) + + Service: add is_valid method for systemd + + Fix file.linked_to() for Mac OS +- Update to v1.9.0 + + Interface: allow to find 'ip' command ousite of PATH + + Fix --nagios option with python 3 +- Update to v1.8.0 + + Deprecate testinfra command (will be dropped in 2.0), use + py.test instead. + + Handle --nagios option when using py.test command +- Update to v1.7.1 + + Support for ansible 2.4 +- Update to v1.7.0 + + Salt: allow specifiy config directory + + Add a WinRM backend + + Socket: ipv6 sockets can handle ipv4 clients + + Service: Enhance upstart detection + +------------------------------------------------------------------- +Mon Aug 28 22:20:05 UTC 2017 - sean.marlow@suse.com + +- Update to v1.6.5 + + Service: add is_enabled() support for OpenBSD + + Add ssh identity file option for paramiko and ssh backends + + Expand tilde (~) to user home directory for ssh-config, + ssh-identity-file and ansible-inventory options +- Update to v1.6.4 + + Service: Allow to find 'service' command outside of $PATH #211 + + doc fixes +- Update to v1.6.3 + + Fix unwanted deprecation warning when running tests with + pytest 3.1 #204 +- Update to v1.6.2 + + Fix wheel package for 1.6.1 + +------------------------------------------------------------------- +Wed May 17 22:24:33 UTC 2017 - sean.marlow@suse.com + +- Initial release (v1.6.1) diff --git a/python-pytest-testinfra.spec b/python-pytest-testinfra.spec new file mode 100644 index 0000000..af5cc9f --- /dev/null +++ b/python-pytest-testinfra.spec @@ -0,0 +1,87 @@ +# +# spec file for package python-pytest-testinfra +# +# Copyright (c) 2024 SUSE LLC +# +# All modifications and additions to the file contributed by third parties +# remain the property of their copyright owners, unless otherwise agreed +# upon. The license for this file, and modifications and additions to the +# file, is the same license as for the pristine package itself (unless the +# license for the pristine package is not an Open Source License, in which +# case the license is the MIT License). An "Open Source License" is a +# license that conforms to the Open Source Definition (Version 1.9) +# published by the Open Source Initiative. + +# Please submit bugfixes or comments via https://bugs.opensuse.org/ +# + + +%{?sle15_python_module_pythons} +Name: python-pytest-testinfra +Version: 10.1.1 +Release: 0 +Summary: Python module to test infrastructures +License: Apache-2.0 +URL: https://github.com/pytest-dev/pytest-testinfra +Source: https://files.pythonhosted.org/packages/source/p/pytest-testinfra/pytest-testinfra-%{version}.tar.gz +# PATCH-FIX-OPENSUSE testinfra-parametrize-backends-test.patch -- make backends deselectable which are not available for testing +Patch0: testinfra-parametrize-backends-test.patch +# PATCH-FIX-UPSTREAM gh#pytest-dev/pytest-testinfra#764 +Patch1: support-python-313.patch +BuildRequires: %{python_module paramiko} +BuildRequires: %{python_module pip} +BuildRequires: %{python_module pytest} +BuildRequires: %{python_module pywinrm} +BuildRequires: %{python_module setuptools_scm} +BuildRequires: %{python_module setuptools} +BuildRequires: %{python_module tornado} +BuildRequires: %{python_module wheel} +BuildRequires: ansible +BuildRequires: fdupes +BuildRequires: python-rpm-macros +BuildRequires: python3-salt +Requires: python-pytest >= 6.0 +Provides: python-testinfra = %{version}-%{release} +Obsoletes: python-testinfra < %{version}-%{release} +BuildArch: noarch +%python_subpackages + +%description +With Testinfra, one can write unit tests in Python to test the actual +state of servers configured by managements tools like Salt, Ansible, +Puppet, Chef and so on. + +Testinfra is like a Serverspec equivalent in Python, and is written +as a plugin to the Pytest test engine. + +%prep +%autosetup -p1 -n pytest-testinfra-%{version} +# register custom markers for test suite in order to avoid warning clutter +sed -i -e '/\[tool:pytest\]/ a markers = \ + testinfra_hosts\ + destructive' setup.cfg + +%build +%pyproject_wheel + +%install +%pyproject_install +%python_expand %fdupes %{buildroot}%{$python_sitelib}/testinfra + +%check +export LANG=en_US.UTF-8 +donttest="donttestnonemptyprefix" +%{python_expand # salt is python3 primary flavor only +if [ "${python_flavor}" != "python3" -a "%{$python_provides}" != "python3" ]; then + $python_donttest="or (test_backend_importables and salt)" +fi +} +%pytest -ra -k "not ($donttest ${$python_donttest})" test + +%files %{python_files} +%doc CHANGELOG.rst README.rst +%license LICENSE +%{python_sitelib}/testinfra +%{python_sitelib}/pytest_testinfra-%{version}.dist-info + +%changelog diff --git a/support-python-313.patch b/support-python-313.patch new file mode 100644 index 0000000..5c262a5 --- /dev/null +++ b/support-python-313.patch @@ -0,0 +1,31 @@ +From 20ef83970b24cd53ce7f5bf952360d8b99a0b7de Mon Sep 17 00:00:00 2001 +From: Martin Hoyer +Date: Tue, 7 May 2024 15:55:07 +0200 +Subject: [PATCH] Remove crypt lib from testing + +--- + test/test_modules.py | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/test/test_modules.py b/test/test_modules.py +index 23a1f2f2..15416344 100644 +--- a/test/test_modules.py ++++ b/test/test_modules.py +@@ -10,7 +10,6 @@ + # See the License for the specific language governing permissions and + # limitations under the License. + +-import crypt + import datetime + import os + import re +@@ -257,7 +256,8 @@ def test_nonexistent_user(host): + def test_current_user(host): + assert host.user().name == "root" + pw = host.user().password +- assert crypt.crypt("foo", pw) == pw ++ assert pw.startswith("$") ++ assert len(pw) == 73 + + + def test_group(host): diff --git a/testinfra-parametrize-backends-test.patch b/testinfra-parametrize-backends-test.patch new file mode 100644 index 0000000..ed8f0a9 --- /dev/null +++ b/testinfra-parametrize-backends-test.patch @@ -0,0 +1,23 @@ +Index: pytest-testinfra-10.0.0/test/test_backends.py +=================================================================== +--- pytest-testinfra-10.0.0.orig/test/test_backends.py ++++ pytest-testinfra-10.0.0/test/test_backends.py +@@ -476,13 +476,13 @@ def test_ansible_unknown_option(): + with pytest.raises(KeyError, match="^'unknown'$"): + runner.options_to_cli({"unknown": True}) + +- +-def test_backend_importables(): ++@pytest.mark.parametrize('connection_type', ++ testinfra.backend.BACKENDS.keys()) ++def test_backend_importables(connection_type): + # just check that all declared backend are importable and NAME is set + # correctly +- for connection_type in testinfra.backend.BACKENDS: +- obj = testinfra.backend.get_backend_class(connection_type) +- assert obj.get_connection_type() == connection_type ++ obj = testinfra.backend.get_backend_class(connection_type) ++ assert obj.get_connection_type() == connection_type + + + @pytest.mark.testinfra_hosts("docker://rockylinux9", "ssh://rockylinux9")