--- - name: install pipx pip: name: pipx extra_args: --user ############################################################################## - name: ensure application tox is uninstalled community.general.pipx: state: absent name: tox register: uninstall_tox - name: install application tox community.general.pipx: name: tox register: install_tox - name: install application tox again community.general.pipx: name: tox register: install_tox_again ignore_errors: yes - name: install application tox again force community.general.pipx: name: tox force: yes register: install_tox_again_force - name: uninstall application tox community.general.pipx: state: absent name: tox register: uninstall_tox - name: check assertions tox assert: that: - install_tox is changed - "'tox' in install_tox.application" - install_tox_again is not changed - install_tox_again_force is changed - uninstall_tox is changed - "'tox' not in uninstall_tox.application" ############################################################################## - name: install application tox 3.24.0 community.general.pipx: name: tox source: tox==3.24.0 register: install_tox_324 - name: reinstall tox 3.24.0 community.general.pipx: name: tox state: reinstall register: reinstall_tox_324 - name: upgrade tox 3.24.0 community.general.pipx: name: tox state: upgrade register: upgrade_tox_324 - name: downgrade tox 3.24.0 community.general.pipx: name: tox source: tox==3.24.0 force: yes register: downgrade_tox_324 - name: cleanup tox 3.24.0 community.general.pipx: state: absent name: tox register: uninstall_tox_324 - name: check assertions tox 3.24.0 assert: that: - install_tox_324 is changed - "'tox' in install_tox_324.application" - install_tox_324.application.tox.version == '3.24.0' - reinstall_tox_324 is changed - reinstall_tox_324.application.tox.version == '3.24.0' - upgrade_tox_324 is changed - upgrade_tox_324.application.tox.version != '3.24.0' - downgrade_tox_324 is changed - downgrade_tox_324.application.tox.version == '3.24.0' - uninstall_tox_324 is changed - "'tox' not in uninstall_tox_324.application"