Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pipx: add new states #8809

Merged
merged 12 commits into from
Sep 6, 2024
Prev Previous commit
Next Next commit
fix uninject tests
  • Loading branch information
russoz committed Aug 27, 2024
commit b3dc94a7023aee8c63596c7218f15d4b7e8898b3
3 changes: 3 additions & 0 deletions tests/integration/targets/pipx/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -253,3 +253,6 @@

- name: Include testcase for PR 8809 pin
ansible.builtin.include_tasks: testcase-8809-pin.yml

- name: Include testcase for PR 8809 injectpkg
ansible.builtin.include_tasks: testcase-8809-uninjectpkg.yml
69 changes: 69 additions & 0 deletions tests/integration/targets/pipx/tasks/testcase-8809-uninjectpkg.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
---
# Copyright (c) Ansible Project
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
# SPDX-License-Identifier: GPL-3.0-or-later

- name: Set up environment
environment:
PATH: /usr/local/bin:{{ ansible_env.PATH }}
block:
- name: Uninstall pycowsay and black
community.general.pipx:
state: uninstall
name: pycowsay

# latest is 0.0.0.2
- name: Install pycowsay 0.0.0.1
community.general.pipx:
state: install
name: pycowsay
source: pycowsay==0.0.0.1

- name: Pin cowsay
community.general.pipx:
state: pin
name: pycowsay
register: pin_cow

- name: Upgrade pycowsay
community.general.pipx:
state: upgrade
name: pycowsay

- name: Get pycowsay version
community.general.pipx_info:
name: pycowsay
register: cow_info_1

- name: Unpin cowsay
community.general.pipx:
state: unpin
name: pycowsay
register: unpin_cow

- name: Upgrade pycowsay
community.general.pipx:
state: upgrade
name: pycowsay

- name: Get pycowsay version
community.general.pipx_info:
name: pycowsay
register: cow_info_2

- name: Uninstall pycowsay and black (again)
community.general.pipx:
state: uninstall
name: "{{ item }}"
loop:
- black
- pycowsay
register: uninstall_all_2

- name: Assert uninstall-all
ansible.builtin.assert:
that:
- pin_cow is changed
- cow_info_1 == "0.0.0.1"
- unpin_cow is changed
- cow_info_2 != "0.0.0.1"
9 changes: 0 additions & 9 deletions tests/integration/targets/pipx/tasks/testcase-injectpkg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,6 @@
install_apps: true
register: inject_pkgs_apps_pylint

- name: Uninject package
community.general.pipx:
state: uninject
name: pylint
inject_packages:
- black
register: uninject_b

- name: Cleanup pylint
community.general.pipx:
state: absent
Expand All @@ -55,4 +47,3 @@
- '"pylint" in inject_pkgs_apps_pylint.application'
- '"black" in inject_pkgs_apps_pylint.application["pylint"]["injected"]'
- uninstall_pylint is changed
- uninject_b is changed