Skip to content

Commit

Permalink
pipx: add testcase w/ env vars PIPX_xxxx (#5845)
Browse files Browse the repository at this point in the history
* pipx: add testcase w/ env vars PIPX_xxxx

* add note to the docs about env vars

* add note to the docs about env vars

* Apply suggestions from code review

* Update plugins/modules/pipx.py

Co-authored-by: Felix Fontein <felix@fontein.de>

* Update plugins/modules/pipx_info.py

Co-authored-by: Felix Fontein <felix@fontein.de>

* break long lines into smaller ones

Co-authored-by: Felix Fontein <felix@fontein.de>
  • Loading branch information
russoz and felixfontein authored Jan 18, 2023
1 parent a35b2ed commit 1430ed0
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 0 deletions.
3 changes: 3 additions & 0 deletions plugins/modules/pipx.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,9 @@
notes:
- This module does not install the C(pipx) python package, however that can be easily done with the module M(ansible.builtin.pip).
- This module does not require C(pipx) to be in the shell C(PATH), but it must be loadable by Python as a module.
- >
This module will honor C(pipx) environment variables such as but not limited to C(PIPX_HOME) and C(PIPX_BIN_DIR)
passed using the R(environment Ansible keyword, playbooks_environment).
- Please note that C(pipx) requires Python 3.6 or above.
- >
This first implementation does not verify whether a specified version constraint has been installed or not.
Expand Down
3 changes: 3 additions & 0 deletions plugins/modules/pipx_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@
notes:
- This module does not install the C(pipx) python package, however that can be easily done with the module M(ansible.builtin.pip).
- This module does not require C(pipx) to be in the shell C(PATH), but it must be loadable by Python as a module.
- >
This module will honor C(pipx) environment variables such as but not limited to C(PIPX_HOME) and C(PIPX_BIN_DIR)
passed using the R(environment Ansible keyword, playbooks_environment).
- Please note that C(pipx) requires Python 3.6 or above.
- See also the C(pipx) documentation at U(https://pypa.github.io/pipx/).
author:
Expand Down
27 changes: 27 additions & 0 deletions tests/integration/targets/pipx/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -230,3 +230,30 @@
that:
- install_jupyter is changed
- '"ipython" in install_jupyter.stdout'

##############################################################################
- name: ensure /opt/pipx
ansible.builtin.file:
path: /opt/pipx
state: directory
mode: 0755

- name: install tox site-wide
community.general.pipx:
name: tox
state: latest
register: install_tox_sitewide
environment:
PIPX_HOME: /opt/pipx
PIPX_BIN_DIR: /usr/local/bin

- name: stat /usr/local/bin/tox
ansible.builtin.stat:
path: /usr/local/bin/tox
register: usrlocaltox

- name: check assertions
ansible.builtin.assert:
that:
- install_tox_sitewide is changed
- usrlocaltox.stat.exists

0 comments on commit 1430ed0

Please sign in to comment.