Debian Codegraph @

test/integration/targets/debugger/test_run_once.py

raw ◀ ▶
1 Debian patch touch this file
•1 #!/usr/bin/env python3
2 from __future__ import annotations
3
4 import io
5 import os
6 import sys
7
8 import pexpect
9
10
11 env_vars = {
12 'ANSIBLE_NOCOLOR': 'True',
13 'ANSIBLE_RETRY_FILES_ENABLED': 'False',
14 }
15
16 env = os.environ.copy()
17 env.update(env_vars)
18
19 with io.BytesIO() as logfile:
20 debugger_test_test = pexpect.spawn(
21 'ansible-playbook',
22 args=['test_run_once_playbook.yml'] + sys.argv[1:],
23 timeout=10,
24 env=env
25 )
26
27 debugger_test_test.logfile = logfile
28
29 debugger_test_test.expect_exact('TASK: Task 1 (debug)> ')
30 debugger_test_test.send('task.args["that"] = []\r')
31 debugger_test_test.expect_exact('TASK: Task 1 (debug)> ')
32 debugger_test_test.send('r\r')
33 debugger_test_test.expect(pexpect.EOF)
34 debugger_test_test.close()
35
36 assert str(logfile.getvalue()).count('Task 2 executed') == 2