Skip to content

Commit

Permalink
Fix pipx tests (#8665)
Browse files Browse the repository at this point in the history
* fix pipx tests

* enable pipx int tests

* replace ansible-lint with pylint in pipx test

* install jupyter in freebsd

* replace jupyter with mkdocs in pipx test

* adjust installed dependency for mkdocs

* fix pipx_info tests as well
  • Loading branch information
russoz authored Jul 23, 2024
1 parent e3fb817 commit 58f9860
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 39 deletions.
1 change: 0 additions & 1 deletion tests/integration/targets/pipx/aliases
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,3 @@ azp/posix/2
destructive
skip/python2
skip/python3.5
disabled # TODO
60 changes: 30 additions & 30 deletions tests/integration/targets/pipx/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -217,76 +217,76 @@
- "'tox' not in uninstall_tox_again.application"

##############################################################################
- name: ensure application ansible-lint is uninstalled
- name: ensure application pylint is uninstalled
community.general.pipx:
name: ansible-lint
name: pylint
state: absent

- name: install application ansible-lint
- name: install application pylint
community.general.pipx:
name: ansible-lint
register: install_ansible_lint
name: pylint
register: install_pylint

- name: inject packages
community.general.pipx:
state: inject
name: ansible-lint
name: pylint
inject_packages:
- licenses
register: inject_pkgs_ansible_lint
register: inject_pkgs_pylint

- name: inject packages with apps
community.general.pipx:
state: inject
name: ansible-lint
name: pylint
inject_packages:
- black
install_apps: true
register: inject_pkgs_apps_ansible_lint
register: inject_pkgs_apps_pylint

- name: cleanup ansible-lint
- name: cleanup pylint
community.general.pipx:
state: absent
name: ansible-lint
register: uninstall_ansible_lint
name: pylint
register: uninstall_pylint

- name: check assertions inject_packages
assert:
that:
- install_ansible_lint is changed
- inject_pkgs_ansible_lint is changed
- '"ansible-lint" in inject_pkgs_ansible_lint.application'
- '"licenses" in inject_pkgs_ansible_lint.application["ansible-lint"]["injected"]'
- inject_pkgs_apps_ansible_lint is changed
- '"ansible-lint" in inject_pkgs_apps_ansible_lint.application'
- '"black" in inject_pkgs_apps_ansible_lint.application["ansible-lint"]["injected"]'
- uninstall_ansible_lint is changed
- install_pylint is changed
- inject_pkgs_pylint is changed
- '"pylint" in inject_pkgs_pylint.application'
- '"licenses" in inject_pkgs_pylint.application["pylint"]["injected"]'
- inject_pkgs_apps_pylint is changed
- '"pylint" in inject_pkgs_apps_pylint.application'
- '"black" in inject_pkgs_apps_pylint.application["pylint"]["injected"]'
- uninstall_pylint is changed

##############################################################################
- name: install jupyter - not working smoothly in freebsd
when: ansible_system != 'FreeBSD'
# when: ansible_system != 'FreeBSD'
block:
- name: ensure application jupyter is uninstalled
- name: ensure application mkdocs is uninstalled
community.general.pipx:
name: jupyter
name: mkdocs
state: absent

- name: install application jupyter
- name: install application mkdocs
community.general.pipx:
name: jupyter
name: mkdocs
install_deps: true
register: install_jupyter
register: install_mkdocs

- name: cleanup jupyter
- name: cleanup mkdocs
community.general.pipx:
state: absent
name: jupyter
name: mkdocs

- name: check assertions
assert:
that:
- install_jupyter is changed
- '"ipython" in install_jupyter.stdout'
- install_mkdocs is changed
- '"markdown_py" in install_mkdocs.stdout'

##############################################################################
- name: ensure /opt/pipx
Expand Down
1 change: 0 additions & 1 deletion tests/integration/targets/pipx_info/aliases
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,3 @@ azp/posix/3
destructive
skip/python2
skip/python3.5
disabled # TODO
14 changes: 7 additions & 7 deletions tests/integration/targets/pipx_info/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
apps:
- name: tox
source: tox==3.24.0
- name: ansible-lint
- name: pylint
inject_packages:
- licenses

Expand All @@ -81,7 +81,7 @@
- name: install applications
community.general.pipx:
name: "{{ item.name }}"
source: "{{ item.source|default(omit) }}"
source: "{{ item.source | default(omit) }}"
loop: "{{ apps }}"

- name: inject packages
Expand All @@ -102,9 +102,9 @@
include_injected: true
register: info2_all_deps

- name: retrieve application ansible-lint
- name: retrieve application pylint
community.general.pipx_info:
name: ansible-lint
name: pylint
include_deps: true
include_injected: true
register: info2_lint
Expand All @@ -131,10 +131,10 @@
- "'injected' in all_apps_deps[0]"
- "'licenses' in all_apps_deps[0].injected"

- lint|length == 1
- lint | length == 1
- all_apps_deps|length == 2
- lint[0] == all_apps_deps[0]
vars:
all_apps: "{{ info2_all.application|sort(attribute='name') }}"
all_apps_deps: "{{ info2_all_deps.application|sort(attribute='name') }}"
lint: "{{ info2_lint.application|sort(attribute='name') }}"
all_apps_deps: "{{ info2_all_deps.application | sort(attribute='name') }}"
lint: "{{ info2_lint.application | sort(attribute='name') }}"

0 comments on commit 58f9860

Please sign in to comment.