def test_main():
    try:
        test.test_support.run_unittest(PydocDocTest, PydocImportTest,
                                       TestDescriptions, TestUnicode,
                                       TestHelper)
    finally:
        reap_children()
Example #2
0
def test_main():
    tests = [
        DefaultSelectorTestCase, SelectSelectorTestCase, PollSelectorTestCase,
        EpollSelectorTestCase, KqueueSelectorTestCase, DevpollSelectorTestCase
    ]
    support.run_unittest(*tests)
    support.reap_children()
Example #3
0
def test_main():
    unit_tests = (ProcessTestCase, POSIXProcessTestCase, Win32ProcessTestCase,
                  ProcessTestCaseNoPoll, HelperFunctionTests,
                  CommandsWithSpaces)

    test_support.run_unittest(*unit_tests)
    test_support.reap_children()
Example #4
0
def test():
    import sys
    # sym => symbian_s60
    if sys.platform[:3] in ('win', 'mac', 'os2', 'ris', 'sym'):
        if verbose:
            print "Can't test select easily on", sys.platform
        return
    cmd = 'for i in 0 1 2 3 4 5 6 7 8 9; do echo testing...; sleep 1; done'
    p = os.popen(cmd, 'r')
    for tout in (0, 1, 2, 4, 8, 16) + (None, ) * 10:
        if verbose:
            print 'timeout =', tout
        rfd, wfd, xfd = select.select([p], [], [], tout)
        if (rfd, wfd, xfd) == ([], [], []):
            continue
        if (rfd, wfd, xfd) == ([p], [], []):
            line = p.readline()
            if verbose:
                print repr(line)
            if not line:
                if verbose:
                    print 'EOF'
                break
            continue
        print 'Unexpected return values from select():', rfd, wfd, xfd
    p.close()
    reap_children()
Example #5
0
def test():
    import sys

    if sys.platform[:3] in ("win", "mac", "os2", "riscos"):
        if verbose:
            print "Can't test select easily on", sys.platform
        return
    cmd = "for i in 0 1 2 3 4 5 6 7 8 9; do echo testing...; sleep 1; done"
    p = os.popen(cmd, "r")
    for tout in (0, 1, 2, 4, 8, 16) + (None,) * 10:
        if verbose:
            print "timeout =", tout
        rfd, wfd, xfd = select.select([p], [], [], tout)
        if (rfd, wfd, xfd) == ([], [], []):
            continue
        if (rfd, wfd, xfd) == ([p], [], []):
            line = p.readline()
            if verbose:
                print repr(line)
            if not line:
                if verbose:
                    print "EOF"
                break
            continue
        print "Unexpected return values from select():", rfd, wfd, xfd
    p.close()
    reap_children()
Example #6
0
def test():
    import sys
    if sys.platform[:3] in ('win', 'mac', 'os2', 'riscos'):
        if verbose:
            print "Can't test select easily on", sys.platform
        return
    cmd = 'for i in 0 1 2 3 4 5 6 7 8 9; do echo testing...; sleep 0.1; done'
    p = os.popen(cmd, 'r')
    for tout in (0, 0.1, 0.2, 0.4, 0.8, 1.6) + (None,)*10:
        if verbose:
            print 'timeout =', tout
        rfd, wfd, xfd = select.select([p], [], [], tout)
        if (rfd, wfd, xfd) == ([], [], []):
            continue
        if (rfd, wfd, xfd) == ([p], [], []):
            line = p.readline()
            if verbose:
                print repr(line)
            if not line:
                if verbose:
                    print 'EOF'
                break
            continue
        print 'Unexpected return values from select():', rfd, wfd, xfd
    p.close()
    reap_children()
Example #7
0
def test_main():
    from test import test_support
    test_support.run_unittest(
	    Test_loadHeader,
	    Test_labelCompare,
	    Test_upgrade)
    test_support.reap_children()
Example #8
0
 def test_popen(self):
     self.assertRaises(TypeError, os.popen)
     self._do_test_commandline("foo bar", ["foo", "bar"])
     self._do_test_commandline('foo "spam and eggs" "silly walk"',
                               ["foo", "spam and eggs", "silly walk"])
     self._do_test_commandline('foo "a \\"quoted\\" arg" bar',
                               ["foo", 'a "quoted" arg', "bar"])
     test_support.reap_children()
Example #9
0
def test_main():
    test_support.run_unittest(
        BZ2FileTest,
        BZ2CompressorTest,
        BZ2DecompressorTest,
        FuncTest
    )
    test_support.reap_children()
Example #10
0
def test_main():
    try:
        test.test_support.run_unittest(PyDocDocTest,
                                       PydocImportTest,
                                       TestDescriptions,
                                       TestHelper)
    finally:
        reap_children()
Example #11
0
def test_main():
    unit_tests = (ProcessTestCase,
                  POSIXProcessTestCase,
                  Win32ProcessTestCase,
                  ProcessTestCaseNoPoll,
                  HelperFunctionTests)

    test_support.run_unittest(*unit_tests)
    test_support.reap_children()
Example #12
0
def test_main():
    try:
        test_support.run_unittest(
            ProcessPoolExecutorTest, ThreadPoolExecutorTest,
            ProcessPoolWaitTests, ThreadPoolWaitTests,
            ProcessPoolAsCompletedTests, ThreadPoolAsCompletedTests,
            FutureTests, ProcessPoolShutdownTest, ThreadPoolShutdownTest)
    finally:
        test_support.reap_children()
    def tearDown(self):
        self.doCleanups()
        reap_children()

        for fn in self.test_files:
            try:
                os.remove(fn)
            except os.error:
                pass
        self.test_files[:] = []
Example #14
0
    def tearDown (self):
        signal_alarm(0)  # Didn't deadlock.
        reap_children()

        for fn in self.test_files:
            try:
                os.remove(fn)
            except os.error:
                pass
        self.test_files[:] = []
Example #15
0
def test_main():
    try:
        start_dir = os.path.dirname(__file__)
        top_dir = os.path.dirname(os.path.dirname(start_dir))
        test_loader = unittest.TestLoader()
        # XXX find out how to use unittest.main, to get command-line options
        # (failfast, catch, etc.)
        run_unittest(test_loader.discover(start_dir, top_level_dir=top_dir))
    finally:
        reap_children()
Example #16
0
def run_pydoc(module_name, *args):
    """
    Runs pydoc on the specified module. Returns the stripped
    output of pydoc.
    """
    cmd = [sys.executable, pydoc.__file__, " ".join(args), module_name]
    try:
        output = subprocess.Popen(cmd, stdout=subprocess.PIPE).communicate()[0]
        return output.strip()
    finally:
        reap_children()
Example #17
0
def test_main():
    import imp
    if imp.lock_held():
        # If the import lock is held, the threads will hang.
        raise TestSkipped("can't run when import lock is held")

    try:
        testall()
    finally:
        cleanup()
    reap_children()
Example #18
0
def run_pydoc(module_name, *args):
    """
    Runs pydoc on the specified module. Returns the stripped
    output of pydoc.
    """
    cmd = [sys.executable, pydoc.__file__, " ".join(args), module_name]
    try:
        output = subprocess.Popen(cmd, stdout=subprocess.PIPE).communicate()[0]
        return output.strip()
    finally:
        reap_children()
 def tearDown(self):
     for inst in popen2._active:
         inst.wait()
     popen2._cleanup()
     self.assertFalse(popen2._active, "popen2._active not empty")
     # The os.popen*() API delegates to the subprocess module (on Unix)
     import subprocess
     for inst in subprocess._active:
         inst.wait()
     subprocess._cleanup()
     self.assertFalse(subprocess._active, "subprocess._active not empty")
     reap_children()
Example #20
0
def test_main(verbose=None):
    cwd = os.getcwd()
    env = os.environ.copy()
    try:
        test_support.run_unittest(BaseHTTPServerTestCase,
                                  SimpleHTTPServerTestCase,
                                  CGIHTTPServerTestCase)
    finally:
        test_support.reap_children()
        os.environ.clear()
        os.environ.update(env)
        os.chdir(cwd)
 def tearDown(self):
     for inst in popen2._active:
         inst.wait()
     popen2._cleanup()
     self.assertFalse(popen2._active, "popen2._active not empty")
     # The os.popen*() API delegates to the subprocess module (on Unix)
     import subprocess
     for inst in subprocess._active:
         inst.wait()
     subprocess._cleanup()
     self.assertFalse(subprocess._active, "subprocess._active not empty")
     reap_children()
Example #22
0
def test_main():
    try:
        test_support.run_unittest(ProcessPoolExecutorTest,
                                  ThreadPoolExecutorTest,
                                  ProcessPoolWaitTests,
                                  ThreadPoolWaitTests,
                                  ProcessPoolAsCompletedTests,
                                  ThreadPoolAsCompletedTests,
                                  FutureTests,
                                  ProcessPoolShutdownTest,
                                  ThreadPoolShutdownTest)
    finally:
        test_support.reap_children()
def test_main(verbose=None):
    cwd = os.getcwd()
    env = os.environ.copy()
    try:
        test_support.run_unittest(BaseHTTPServerTestCase,
                                  SimpleHTTPServerTestCase,
                                  CGIHTTPServerTestCase
                                  )
    finally:
        test_support.reap_children()
        os.environ.clear()
        os.environ.update(env)
        os.chdir(cwd)
Example #24
0
 def tearDown(self):
     for inst in popen2._active:
         inst.wait()
     popen2._cleanup()
     self.assertFalse(popen2._active, "popen2._active not empty")
     # The os.popen*() API delegates to the subprocess module (on Unix)
     if not due_to_ironpython_bug("http://ironpython.codeplex.com/workitem/15512"):
         import subprocess
         for inst in subprocess._active:
             inst.wait()
         subprocess._cleanup()
         self.assertFalse(subprocess._active, "subprocess._active not empty")
     reap_children()
Example #25
0
 def test_popen(self):
     self.assertRaises(TypeError, os.popen)
     self._do_test_commandline(
         "foo bar",
         ["foo", "bar"]
     )
     self._do_test_commandline(
         'foo "spam and eggs" "silly walk"',
         ["foo", "spam and eggs", "silly walk"]
     )
     self._do_test_commandline(
         'foo "a \\"quoted\\" arg" bar',
         ["foo", 'a "quoted" arg', "bar"]
     )
     test_support.reap_children()
Example #26
0
 def tearDown(self):
     for inst in popen2._active:
         inst.wait()
     popen2._cleanup()
     self.assertFalse(popen2._active, "popen2._active not empty")
     # The os.popen*() API delegates to the subprocess module (on Unix)
     if not due_to_ironpython_bug(
             "http://ironpython.codeplex.com/workitem/15512"):
         import subprocess
         for inst in subprocess._active:
             inst.wait()
         subprocess._cleanup()
         self.assertFalse(subprocess._active,
                          "subprocess._active not empty")
     reap_children()
Example #27
0
def test_main():
    run_unittest(CommandTests)
    reap_children()
Example #28
0
def main():
    print "Test popen:"
    _test_commandline()
    reap_children()
Example #29
0
def test_main():
    run_unittest(ForkTest)
    reap_children()
Example #30
0
def test_main():
    test_support.run_unittest(unittest.test.suite())
    test_support.reap_children()
Example #31
0
def test_main():
    run_unittest(Wait4Test)
    reap_children()
Example #32
0
    print "testing popen2..."
    w, r = os.popen2(cmd)
    w.write(teststr)
    w.close()
    got = r.read()
    if got.strip() != expected:
        raise ValueError("wrote %r read %r" % (teststr, got))
    print "testing popen3..."
    try:
        w, r, e = os.popen3([cmd])
    except:
        w, r, e = os.popen3(cmd)
    w.write(teststr)
    w.close()
    got = r.read()
    if got.strip() != expected:
        raise ValueError("wrote %r read %r" % (teststr, got))
    got = e.read()
    if got:
        raise ValueError("unexpected %r on stderr" % (got,))
    for inst in popen2._active[:]:
        inst.wait()
    popen2._cleanup()
    if popen2._active:
        raise ValueError("_active not empty")
    print "All OK"

main()
_test()
reap_children()
Example #33
0
 def tearDown(self):
     for inst in popen2._active:
         inst.wait()
     popen2._cleanup()
     self.assertFalse(popen2._active, "_active not empty")
     reap_children()
Example #34
0
def test_main():
    from test import test_support
    test_support.run_unittest(Test_evrCompare)
    test_support.reap_children()
Example #35
0
def test_main():
    test_support.run_unittest(ProcessTestCase)
    if hasattr(test_support, "reap_children"):
        test_support.reap_children()
def test_main():
    # Spawning many new jython processes takes a long time
    test_support.requires('subprocess')
    test_support.run_unittest(ProcessTestCase)
    if hasattr(test_support, "reap_children"):
        test_support.reap_children()
Example #37
0
def test_main():
    run_unittest(CommandTests)
    reap_children()
    w, r = os.popen2(cmd)
    w.write(teststr)
    w.close()
    got = r.read()
    if got.strip() != expected:
        raise ValueError("wrote %r read %r" % (teststr, got))
    print "testing popen3..."
    try:
        w, r, e = os.popen3([cmd])
    except:
        w, r, e = os.popen3(cmd)
    w.write(teststr)
    w.close()
    got = r.read()
    if got.strip() != expected:
        raise ValueError("wrote %r read %r" % (teststr, got))
    got = e.read()
    if got:
        raise ValueError("unexpected %r on stderr" % (got, ))
    for inst in popen2._active[:]:
        inst.wait()
    popen2._cleanup()
    if popen2._active:
        raise ValueError("_active not empty")
    print "All OK"


main()
_test()
reap_children()
 def tearDown(self):
     support.threading_cleanup(*self._threads)
     support.reap_children()
Example #40
0
 def setUp(self):
     # Try to minimize the number of children we have so this test
     # doesn't crash on some buildbots (Alphas in particular).
     test_support.reap_children()
def test_main():
    try:
        test_support.run_unittest(__name__)
    finally:
        test_support.reap_children()
Example #42
0
def sloppy_cleanup():
    # See http://python.org/sf/1540386
    # We need to reap children here otherwise a child from one server
    # can be left running for the next server and cause a test failure.
    time.sleep(DELAY)
    reap_children()
Example #43
0
def test_main():
    test_support.run_unittest(SelectTestCase)
    test_support.reap_children()
Example #44
0
def test_main():
    test_support.run_unittest(ProcessTestCase)
    if hasattr(test_support, "reap_children"):
        test_support.reap_children()
Example #45
0
def test_main():
    test_support.run_unittest(SelectTestCase)
    test_support.reap_children()
Example #46
0
def test_main():
    test_support.run_unittest(ProcessTestCase,
                              HelperFunctionTests)
    if hasattr(test_support, "reap_children"):
        test_support.reap_children()
Example #47
0
def test_main():
    run_unittest(ForkTest)
    reap_children()
Example #48
0
 def tearDown(self):
     support.threading_cleanup(*self._threads)
     support.reap_children()
Example #49
0
def test_main():
    run_unittest(Wait3Test)
    reap_children()
Example #50
0
 def tearDown(self):
     # Try to minimize the number of children we have so this test
     # doesn't crash on some buildbots (Alphas in particular).
     if hasattr(test_support, "reap_children"):
         test_support.reap_children()
def test_main():
    try:
        test_support.run_unittest(__name__)
    finally:
        test_support.reap_children()
 def tearDown(self):
     # Try to minimize the number of children we have so this test
     # doesn't crash on some buildbots (Alphas in particular).
     if hasattr(test_support, "reap_children"):
         test_support.reap_children()
Example #53
0
def test_main():
    # Spawning many new jython processes takes a long time
    test_support.requires('subprocess')
    test_support.run_unittest(ProcessTestCase)
    if hasattr(test_support, "reap_children"):
        test_support.reap_children()
Example #54
0
 def setUp(self):
     # Try to minimize the number of children we have so this test
     # doesn't crash on some buildbots (Alphas in particular).
     test_support.reap_children()
Example #55
0
 def tearDown(self):
     for inst in popen2._active:
         inst.wait()
     popen2._cleanup()
     self.assertFalse(popen2._active, "_active not empty")
     reap_children()