Skip to content

Commit 00e5c9c

Browse files
committed
Backport 0.3.x CI fixes and unofficial tox tests
1 parent c547eb9 commit 00e5c9c

File tree

7 files changed

+76
-27
lines changed

7 files changed

+76
-27
lines changed

.ci/ansible_tests.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,6 @@ def pause_if_interactive():
3737

3838

3939
with ci_lib.Fold('job_setup'):
40-
# Don't set -U as that will upgrade Paramiko to a non-2.6 compatible version.
41-
run("pip install -q ansible==%s", ci_lib.ANSIBLE_VERSION)
42-
4340
os.chdir(TESTS_DIR)
4441
os.chmod('../data/docker/mitogen__has_sudo_pubkey.key', int('0600', 7))
4542

@@ -69,8 +66,6 @@ def pause_if_interactive():
6966
run("sudo apt-get update")
7067
run("sudo apt-get install -y sshpass")
7168

72-
run("bash -c 'sudo ln -vfs /usr/lib/python2.7/plat-x86_64-linux-gnu/_sysconfigdata_nd.py /usr/lib/python2.7 || true'")
73-
run("bash -c 'sudo ln -vfs /usr/lib/python2.7/plat-x86_64-linux-gnu/_sysconfigdata_nd.py $VIRTUAL_ENV/lib/python2.7 || true'")
7469

7570
with ci_lib.Fold('ansible'):
7671
playbook = os.environ.get('PLAYBOOK', 'all.yml')

.ci/localhost_ansible_tests.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,6 @@
2020

2121

2222
with ci_lib.Fold('job_setup'):
23-
# Don't set -U as that will upgrade Paramiko to a non-2.6 compatible version.
24-
run("pip install -q virtualenv ansible==%s", ci_lib.ANSIBLE_VERSION)
25-
2623
os.chmod(KEY_PATH, int('0600', 8))
2724
if not ci_lib.exists_in_path('sshpass'):
2825
run("brew install http://git.io/sshpass.rb")

tests/ansible/integration/playbook_semantics/delegate_to.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,17 +51,23 @@
5151
shell: whoami > /tmp/delegate_to.yml.txt
5252
delegate_to: localhost
5353
become: true
54+
tags:
55+
- requires_local_sudo
5456

5557
- name: "delegate_to, sudo"
5658
assert:
5759
that: "lookup('file', '/tmp/delegate_to.yml.txt') == 'root'"
60+
tags:
61+
- requires_local_sudo
5862

5963
- name: "delegate_to, sudo"
6064
file:
6165
path: /tmp/delegate_to.yml.txt
6266
state: absent
6367
delegate_to: localhost
6468
become: true
69+
tags:
70+
- requires_local_sudo
6571

6672

6773
#
@@ -71,14 +77,20 @@
7177
shell: whoami > /tmp/delegate_to.yml.txt
7278
connection: local
7379
become: true
80+
tags:
81+
- requires_local_sudo
7482

7583
- name: "connection:local, sudo"
7684
assert:
7785
that: "lookup('file', '/tmp/delegate_to.yml.txt') == 'root'"
86+
tags:
87+
- requires_local_sudo
7888

7989
- name: "connection:local, sudo"
8090
file:
8191
path: /tmp/delegate_to.yml.txt
8292
state: absent
8393
connection: local
8494
become: true
95+
tags:
96+
- requires_local_sudo

tests/ansible/regression/issue_152__local_action_wrong_interpreter.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
content: |
1616
#!/bin/bash
1717
export CUSTOM_INTERPRETER=1
18-
exec python2.7 "$@"
18+
exec python "$@"
1919
2020
- custom_python_detect_environment:
2121
vars:

tests/ansible/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
paramiko==2.3.2 # Last 2.6-compat version.
22
hdrhistogram==0.6.1
33
PyYAML==3.11; python_version < '2.7'
4-
PyYAML==3.13; python_version >= '2.7'
4+
PyYAML==5.3.1; python_version >= '2.7' # Latest release (Jan 2021)

tests/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ coverage==4.5.1
33
Django==1.6.11 # Last version supporting 2.6.
44
mock==2.0.0
55
pytz==2018.5
6-
cffi==1.11.2 # Random pin to try and fix pyparser==2.18 not having effect
6+
cffi==1.14.3 # Random pin to try and fix pyparser==2.18 not having effect
77
pycparser==2.18 # Last version supporting 2.6.
88
faulthandler==3.1; python_version < '3.3' # used by testlib
99
pytest-catchlog==1.2.2

tox.ini

Lines changed: 61 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,89 @@
1+
# This file is a local convenience. It is not a substitute for the full CI
2+
# suite, and does not cover the full range of Python versions for Mitogen.
3+
4+
# I use this on Ubuntu 20.04, with the following additions
5+
#
6+
# sudo add-apt-repository ppa:deadsnakes/ppa
7+
# sudo apt update
8+
# sudo apt install python3.5 python3.6 python3.7 python3.9 tox libsasl2-dev libldap2-dev libssl-dev ssh-pass
9+
10+
# Last version to support each python version
11+
#
12+
# tox vir'env pip ansible coverage
13+
# ========== ======== ======== ======== ======== ========
14+
# python2.4 1.4 1.8 1.1 ???
15+
# python2.5 1.6.1 1.9.1 1.3.1 ???
16+
# python2.6 2.9.1 15.2.0 9.0.3 2.6.20 4.5.4
17+
118
[tox]
219
envlist =
320
init,
4-
py26,
5-
py27,
6-
py35,
7-
py36,
8-
py37,
21+
py{27,36,39}-mode_ansible,
22+
py{27,36,39}-mode_mitogen,
23+
py{27,36,39}-mode_mitogen-distro_centos7,
924
report,
25+
requires =
26+
tox-factor
1027

1128
[testenv]
12-
usedevelop = True
13-
deps =
14-
-r{toxinidir}/dev_requirements.txt
15-
-r{toxinidir}/tests/ansible/requirements.txt
16-
29+
basepython =
30+
py26: python2.6
31+
py27: python2.7
32+
py36: python3.6
33+
py37: python3.7
34+
py38: python3.8
35+
py39: python3.9
36+
commands_pre =
37+
mode_ansible: {toxinidir}/.ci/ansible_install.py
38+
mode_debops_common: {toxinidir}/.ci/debops_common_install.py
39+
mode_mitogen: {toxinidir}/.ci/mitogen_install.py
1740
commands =
18-
{posargs:bash run_tests}
19-
whitelist_externals =
20-
bash
41+
mode_ansible: {toxinidir}/.ci/ansible_tests.py
42+
mode_debops_common: {toxinidir}/.ci/debops_common_tests.py
43+
mode_mitogen: {toxinidir}/.ci/mitogen_tests.py
44+
passenv =
45+
ANSIBLE_*
46+
HOME
2147
setenv =
48+
ANSIBLE_SKIP_TAGS = requires_local_sudo
2249
NOCOVERAGE_ERASE = 1
2350
NOCOVERAGE_REPORT = 1
51+
ansible2.3: VER=2.3.3.0
52+
ansible2.4: VER=2.4.6.0
53+
ansible2.8: VER=2.8.3
54+
ansible2.9: VER=2.9.6
55+
ansible2.10: VER=2.10.0
56+
distro_centos5: DISTRO=centos5
57+
distro_centos6: DISTRO=centos6
58+
distro_centos7: DISTRO=centos7
59+
distro_debian: DISTRO=debian
60+
distro_debianpy3: DISTRO=debian-py3
61+
distros_centos5: DISTROS=centos5
62+
distros_debian: DISTROS=debian
63+
mode_ansible: MODE=ansible
64+
mode_debops_common: MODE=debops_common
65+
mode_mitogen: MODE=mitogen
66+
strategy_linear: STRATEGY=linear
2467

2568
[testenv:init]
69+
basepython = python3
2670
commands =
2771
coverage erase
2872
deps =
29-
coverage
73+
coverage==4.5.4
3074

3175
[testenv:report]
76+
basepython = python3
3277
commands =
3378
coverage html
3479
echo "coverage report is at file://{toxinidir}/htmlcov/index.html"
3580
deps =
36-
coverage
81+
coverage==4.5.4
3782
whitelist_externals =
3883
echo
3984

4085
[testenv:docs]
41-
basepython = python
86+
basepython = python3
4287
changedir = docs
4388
commands =
4489
sphinx-build -W -b html -d {envtmpdir}/doctrees . {envtmpdir}/html

0 commit comments

Comments
 (0)