sys.setswitchinterval

Here are the examples of the python api sys.setswitchinterval taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

3 Examples 7

Example 1

Project: TrustRouter Source File: test_sys.py
    @unittest.skipUnless(threading, 'Threading required for this test.')
    def test_switchinterval(self):
        self.assertRaises(TypeError, sys.setswitchinterval)
        self.assertRaises(TypeError, sys.setswitchinterval, "a")
        self.assertRaises(ValueError, sys.setswitchinterval, -1.0)
        self.assertRaises(ValueError, sys.setswitchinterval, 0.0)
        orig = sys.getswitchinterval()
        # sanity check
        self.assertTrue(orig < 0.5, orig)
        try:
            for n in 0.00001, 0.05, 3.0, orig:
                sys.setswitchinterval(n)
                self.assertAlmostEqual(sys.getswitchinterval(), n)
        finally:
            sys.setswitchinterval(orig)

Example 2

Project: brython Source File: test_locks.py
Function: tear_down
    def tearDown(self):
        if self.old_switchinterval is not None:
            sys.setswitchinterval(self.old_switchinterval)

Example 3

Project: iot-utilities Source File: test_locks.py
Function: tear_down
        def tearDown(self):
            if self.old_switchinterval is not None:
                sys.setswitchinterval(self.old_switchinterval)