Code Duplication    Length = 24-24 lines in 2 locations

tests/test_remote.py 2 locations

@@ 78-101 (lines=24) @@
75
            process_tests.wait_for_strings(target.read, TIMEOUT, 'Broken pipe. Stopping tracer.')
76
77
78
@pytest.mark.skipif('platform.system() == "Windows"')
79
@pytest.mark.skipif('platform.python_implementation() == "PyPy"')
80
def test_gdb_clean_exit():
81
    with process_tests.TestProcess(sys.executable, '-mtarget', 'manhole') as target, \
82
         process_tests.dump_on_error(target.read):
83
84
            with process_tests.TestProcess('hunter-trace', '-p', str(target.proc.pid),
85
                                           'stdlib=False', '--gdb') as tracer,\
86
                 process_tests.dump_on_error(tracer.read):
87
88
                process_tests.wait_for_strings(
89
                    tracer.read, TIMEOUT,
90
                    'WARNING: Using GDB may deadlock the process or create unpredictable results!',
91
                    'Output stream active. Starting tracer',
92
                    'call      => stuff()',
93
                    'line         time.sleep(1)',
94
                    'return    <= stuff: None',
95
                )
96
                target.reset()
97
                tracer.proc.send_signal(signal.SIGINT)
98
            process_tests.wait_for_strings(target.read, TIMEOUT,
99
                                           'Doing stuff',
100
                                           'Doing stuff',
101
                                           'Doing stuff')
102
@@ 32-55 (lines=24) @@
29
            process_tests.wait_for_strings(target.read, TIMEOUT, 'Broken pipe. Stopping tracer.')
30
31
32
@pytest.mark.skipif('platform.system() == "Windows"')
33
def test_manhole_clean_exit():
34
    with process_tests.TestProcess(sys.executable, '-mtarget', 'manhole') as target, \
35
         process_tests.dump_on_error(target.read):
36
37
            process_tests.wait_for_strings(target.read, TIMEOUT, 'Oneshot activation is done by signal')
38
39
            with process_tests.TestProcess('hunter-trace', '-p', str(target.proc.pid), 'stdlib=False') as tracer,\
40
                 process_tests.dump_on_error(tracer.read):
41
42
                process_tests.wait_for_strings(
43
                    tracer.read, TIMEOUT,
44
                    'Output stream active. Starting tracer',
45
                    'call      => stuff()',
46
                    'line         time.sleep(1)',
47
                    'return    <= stuff: None',
48
                )
49
                target.reset()
50
                tracer.proc.send_signal(signal.SIGINT)
51
            process_tests.wait_for_strings(target.read, TIMEOUT,
52
                                           'remote.deactivate()',
53
                                           'Doing stuff',
54
                                           'Doing stuff',
55
                                           'Doing stuff')
56
57
58
@pytest.mark.skipif('platform.system() == "Windows"')