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
@@ 33-56 (lines=24) @@
30
            process_tests.wait_for_strings(target.read, TIMEOUT, 'Broken pipe. Stopping tracer.')
31
32
33
@pytest.mark.skipif('platform.system() == "Windows"')
34
def test_manhole_clean_exit():
35
    with process_tests.TestProcess(sys.executable, '-mtarget', 'manhole') as target, \
36
         process_tests.dump_on_error(target.read):
37
38
            process_tests.wait_for_strings(target.read, TIMEOUT, 'Oneshot activation is done by signal')
39
40
            with process_tests.TestProcess('hunter-trace', '-p', str(target.proc.pid), 'stdlib=False') as tracer,\
41
                 process_tests.dump_on_error(tracer.read):
42
43
                process_tests.wait_for_strings(
44
                    tracer.read, TIMEOUT,
45
                    'Output stream active. Starting tracer',
46
                    'call      => stuff()',
47
                    'line         time.sleep(1)',
48
                    'return    <= stuff: None',
49
                )
50
                target.reset()
51
                tracer.proc.send_signal(signal.SIGINT)
52
            process_tests.wait_for_strings(target.read, TIMEOUT,
53
                                           'remote.deactivate()',
54
                                           'Doing stuff',
55
                                           'Doing stuff',
56
                                           'Doing stuff')
57
58
59
@pytest.mark.skipif('platform.system() == "Windows"')