From b5649f9686ad0501c4dd858b3e6197c51cb3be7e Mon Sep 17 00:00:00 2001 From: Sloane Hertel <19572925+s-hertel@users.noreply.github.com> Date: Sun, 7 Jan 2024 23:00:10 -0500 Subject: [PATCH] Remove more Python 2 handling from tests (#82449) --- test/integration/targets/apt_repository/tasks/apt.yml | 6 ------ test/integration/targets/command_shell/tasks/main.yml | 6 ------ test/integration/targets/get_url/tasks/hashlib.yml | 1 - .../integration/targets/setup_pexpect/files/constraints.txt | 1 - 4 files changed, 14 deletions(-) diff --git a/test/integration/targets/apt_repository/tasks/apt.yml b/test/integration/targets/apt_repository/tasks/apt.yml index afb92cb2126..04e9ce5d60c 100644 --- a/test/integration/targets/apt_repository/tasks/apt.yml +++ b/test/integration/targets/apt_repository/tasks/apt.yml @@ -9,15 +9,9 @@ - name: show python version debug: var=ansible_python_version -- name: use python-apt - set_fact: - python_apt: python-apt - when: ansible_python_version is version('3', '<') - - name: use python3-apt set_fact: python_apt: python3-apt - when: ansible_python_version is version('3', '>=') # UNINSTALL 'python-apt' # The `apt_repository` module has the smarts to auto-install `python-apt`. To diff --git a/test/integration/targets/command_shell/tasks/main.yml b/test/integration/targets/command_shell/tasks/main.yml index d2cde9533e1..c40b6f73ca4 100644 --- a/test/integration/targets/command_shell/tasks/main.yml +++ b/test/integration/targets/command_shell/tasks/main.yml @@ -543,15 +543,9 @@ - 'parent_dir_cd.stdout.endswith(remote_tmp_dir ~ "/www")' - 'parent_dir_chdir.stdout.endswith(remote_tmp_dir ~ "/www_root")' -- name: Set print error command for Python 2 - set_fact: - print_error_command: print >> sys.stderr, msg - when: ansible_facts.python_version is version('3', '<') - - name: Set print error command for Python 3 set_fact: print_error_command: print(msg, file=sys.stderr) - when: ansible_facts.python_version is version('3', '>=') - name: run command with strip command: '{{ ansible_python_interpreter }} -c "import sys; msg=''hello \n \r''; print(msg); {{ print_error_command }}"' diff --git a/test/integration/targets/get_url/tasks/hashlib.yml b/test/integration/targets/get_url/tasks/hashlib.yml index cc50ad727b5..e67555ebe91 100644 --- a/test/integration/targets/get_url/tasks/hashlib.yml +++ b/test/integration/targets/get_url/tasks/hashlib.yml @@ -17,4 +17,3 @@ loop: "{{ algorithms.keys() }}" loop_control: loop_var: algorithm - when: ansible_python_version.startswith('3.') or not algorithm.startswith('sha3_') diff --git a/test/integration/targets/setup_pexpect/files/constraints.txt b/test/integration/targets/setup_pexpect/files/constraints.txt index c78ecdad66c..930ee5caedf 100644 --- a/test/integration/targets/setup_pexpect/files/constraints.txt +++ b/test/integration/targets/setup_pexpect/files/constraints.txt @@ -1,2 +1 @@ pexpect == 4.8.0 -ptyprocess < 0.7.0 ; python_version < '2.7' # ptyprocess >= 0.7.0 not compatible with Python 2.6