Exemple #1
0
    def testRunString(self):
        """Test the RunString method."""
        PythonEngine.AcquireLock()
        
        code = "import sys; sys.singleline_worked = 1"
        PythonEngine.RunString(code)
        self.failUnless(sys.singleline_worked == 1)
        
        code = "import sys\nsys.multiline_worked = 1"
        PythonEngine.RunString(code)
        self.failUnless(sys.multiline_worked == 1)

        PythonEngine.ReleaseLock()
Exemple #2
0
def test_run_string():
    """Test the RunString method."""
    PythonEngine.AcquireLock()

    code = "import sys; sys.singleline_worked = 1"
    PythonEngine.RunString(code)
    assert sys.singleline_worked == 1

    code = "import sys\nsys.multiline_worked = 1"
    PythonEngine.RunString(code)
    assert sys.multiline_worked == 1

    PythonEngine.ReleaseLock()