File tree Expand file tree Collapse file tree 6 files changed +46
-18
lines changed Expand file tree Collapse file tree 6 files changed +46
-18
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ python::version : ' 39'
Original file line number Diff line number Diff line change 4949 Boolean $manage_dev_package = true ,
5050 Boolean $manage_venv_package = $python::params::manage_venv_package ,
5151 Boolean $manage_pip_package = $python::params::manage_pip_package ,
52+ Optional[String[1]] $pip_package_name = undef ,
5253 String[1] $gunicorn_package_name = $python::params::gunicorn_package_name ,
5354 Optional[Python::Provider] $provider = undef ,
5455 Hash $python_pips = {},
6869 default => ' ' ,
6970 }
7071
72+ $pip_package_real_name = $pip_package_name .lest || {
73+ fact(' os.family' ) ? {
74+ ' FreeBSD' => " py${version} -pip" ,
75+ default => ' python-pip' ,
76+ }
77+ }
78+
79+
7180 contain python::install
7281 contain python::config
7382
Original file line number Diff line number Diff line change 4848 # Respect the $python::pip setting
4949 unless $python::pip == ' absent' {
5050 # Install pip without pip, see https://pip.pypa.io/en/stable/installing/.
51- include python::pip::bootstrap
51+ contain python::pip::bootstrap
5252
5353 Exec[' bootstrap pip' ] -> File [' pip-python' ] -> Package <| provider == pip |>
5454
Original file line number Diff line number Diff line change 1515 }
1616 ' anaconda' : {
1717 }
18- default: {
18+ pip, default: {
1919 case $facts [' os' ][' family' ] {
2020 ' AIX' : {
2121 unless String($python::version ) =~ /^python3/ {
Original file line number Diff line number Diff line change 1+ # frozen_string_literal: true
2+
3+ require 'spec_helper'
4+
5+ describe 'python::install::pip' do
6+ on_supported_os . each do |os , facts |
7+ context "on #{ os } " do
8+ let :facts do
9+ facts
10+ end
11+
12+ context 'with default settings' do
13+ it { is_expected . to contain_package ( 'pip' ) . with ( ensure : 'present' ) }
14+ end
15+
16+ context 'when ensuring pip is absent' do
17+ let ( :pre_condition ) do
18+ <<~PP
19+ class { 'python':
20+ pip => absent,
21+ }
22+ PP
23+ end
24+
25+ it { is_expected . to contain_package ( 'pip' ) . with ( ensure : 'absent' ) }
26+ end
27+ end
28+ end
29+ end
Original file line number Diff line number Diff line change 1818 it { is_expected . to contain_package ( 'python' ) }
1919
2020 if facts [ :os ] [ 'family' ] == 'Archlinux'
21- it { is_expected . not_to contain_package ( ' pip') }
21+ it { is_expected . not_to contain_class ( 'python::install:: pip') }
2222 else
23- it { is_expected . to contain_package ( ' pip') }
23+ it { is_expected . to contain_class ( 'python::install:: pip') }
2424 end
2525
2626 if %w[ Archlinux ] . include? ( facts [ :os ] [ 'family' ] )
4343 it { is_expected . to compile . with_all_deps }
4444 it { is_expected . not_to contain_package ( 'python' ) }
4545 it { is_expected . not_to contain_package ( 'python-dev' ) }
46- it { is_expected . not_to contain_package ( ' pip') }
46+ it { is_expected . not_to contain_class ( 'python::install:: pip') }
4747 it { is_expected . not_to contain_class ( 'python::install::venv' ) }
4848 end
4949
50- context 'with packages present' do
51- let :params do
52- {
53- manage_pip_package : true ,
54- pip : 'present' ,
55- }
56- end
57-
58- it { is_expected . to compile . with_all_deps }
59- it { is_expected . to contain_package ( 'pip' ) . with ( ensure : 'present' ) }
60- end
61-
6250 case facts [ :os ] [ 'family' ]
6351 when 'Debian'
6452
6856 # Base debian packages.
6957 it { is_expected . to contain_package ( 'python' ) }
7058 it { is_expected . to contain_package ( 'python-dev' ) }
71- it { is_expected . to contain_package ( ' pip') }
59+ it { is_expected . to contain_class ( 'python::install:: pip') }
7260
7361 describe 'with python::version' do
7462 context 'python3.7' do
You can’t perform that action at this time.
0 commit comments