mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-06 03:21:12 +07:00
PY-65353 Add test
GitOrigin-RevId: 9e8beb9b56fae71040e312ab92f6d09e56f6395b
This commit is contained in:
committed by
intellij-monorepo-bot
parent
6ee09adb6e
commit
d51a42a60f
11
python/testData/debug/test_multiprocess_2.py
Normal file
11
python/testData/debug/test_multiprocess_2.py
Normal file
@@ -0,0 +1,11 @@
|
||||
from __future__ import with_statement
|
||||
import multiprocessing
|
||||
|
||||
|
||||
def f(x):
|
||||
return x*x # breakpoint
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
with multiprocessing.Pool() as p:
|
||||
print(p.map(f, [1, 2, 3]))
|
||||
@@ -13,9 +13,11 @@ import org.junit.Assume;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
public class PythonDebuggerMultiprocessingTest extends PyEnvTestCase {
|
||||
|
||||
@@ -300,4 +302,42 @@ public class PythonDebuggerMultiprocessingTest extends PyEnvTestCase {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestFor(issues = "PY-65353")
|
||||
public void testDebuggerStopsOnBreakpointInEveryProcess() {
|
||||
runPythonTest(new PyDebuggerMultiprocessTask("/debug", "test_multiprocess_2.py") {
|
||||
@Override
|
||||
public void before() {
|
||||
toggleBreakpoint(5);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void testing() throws Exception {
|
||||
var expectedValues = new HashSet<String>();
|
||||
for (int i = 0; i < 3; i++) {
|
||||
expectedValues.add(Integer.toString(i));
|
||||
}
|
||||
|
||||
waitForPause();
|
||||
var first = eval("x").getValue();
|
||||
assertTrue(expectedValues.contains(first));
|
||||
expectedValues.remove(first);
|
||||
resume();
|
||||
|
||||
waitForPause();
|
||||
var second = eval("x").getValue();
|
||||
assertTrue(expectedValues.contains(second));
|
||||
expectedValues.remove(second);
|
||||
resume();
|
||||
|
||||
waitForPause();
|
||||
var third = eval("x").getValue();
|
||||
assertTrue(expectedValues.contains(third));
|
||||
resume();
|
||||
|
||||
waitForTerminate();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user