File: issue_152__virtualenv_python_fails.yml

package info (click to toggle)
python-mitogen 0.3.36-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 6,708 kB
  • sloc: python: 24,457; sh: 198; makefile: 74; perl: 19; ansic: 18
file content (53 lines) | stat: -rw-r--r-- 1,805 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
- name: regression/issue_152__virtualenv_python_fails.yml
  gather_facts: true
  hosts: test-targets
  vars:
    virtualenv_path: /tmp/issue_152_virtualenv
    virtualenv_python: "{{ ansible_facts.python.executable }}"
  tasks:
    - custom_python_detect_environment:
      register: lout

    # Can't use pip module because it can't create virtualenvs, must call it
    # directly.
    - name: Create temporary virtualenv
      environment:
        https_proxy: "{{ lookup('env', 'https_proxy')|default('') }}"
        no_proxy: "{{ lookup('env', 'no_proxy')|default('') }}"
        PATH: "{{ lookup('env', 'PATH') }}"
      command:
        argv: "{{ virtualenv_create_argv }}"
        creates: "{{ virtualenv_path }}"
      when:
        - lout.python.version.full is version('2.7', '>=', strict=True)

    - custom_python_detect_environment:
      vars:
        ansible_python_interpreter: "{{ virtualenv_path }}/bin/python"
      register: out
      when:
        - lout.python.version.full is version('2.7', '>=', strict=True)

    - name: Check virtualenv was used
      # On macOS runners a symlink /tmp -> /private/tmp has been seen
      vars:
        requested_executable: "{{ virtualenv_path }}/bin/python"
        expected_executables:
          - "{{ requested_executable }}"
          - "{{ requested_executable.replace('/tmp', out.fs['/tmp'].resolved) }}"
      assert:
        that:
          - out.sys_executable in expected_executables
        fail_msg: |
          out={{ out }}
      when:
        - lout.python.version.full is version('2.7', '>=', strict=True)

    - name: Cleanup temporary virtualenv
      file:
        path: "{{ virtualenv_path }}"
        state: absent
      when:
        - lout.python.version.full is version('2.7', '>=', strict=True)
  tags:
    - issue_152