예제 #1
0
파일: test_oct2py.py 프로젝트: minrk/oct2py
def test_keyboard():

    oc = Oct2Py()

    oc._eval('a=1')

    stdin = sys.stdin
    stdout = sys.stdout
    output = StringIO()
    sys.stdin = StringIO('a\nreturn')
    oc._session.stdout = output
    try:
        oc.keyboard(timeout=3)
    except Oct2PyError as e:
        if 'session timed out' in str(e).lower():
            return
    sys.stdin.flush()
    sys.stdin = stdin
    oc._session.stdout = stdout

    out = output.getvalue()
    assert 'Entering Octave Debug Prompt...' in out
    assert 'a =  1' in out
예제 #2
0
def test_keyboard():

    oc = Oct2Py()

    oc._eval('a=1')

    stdin = sys.stdin
    stdout = sys.stdout
    output = StringIO()
    sys.stdin = StringIO('a\nreturn')
    oc._session.stdout = output
    try:
        oc.keyboard(timeout=3)
    except Oct2PyError as e:
        if 'session timed out' in str(e).lower():
            return
    sys.stdin.flush()
    sys.stdin = stdin
    oc._session.stdout = stdout

    out = output.getvalue()
    assert 'Entering Octave Debug Prompt...' in out
    assert 'a =  1' in out
예제 #3
0
    def test_keyboard(self):
        self.oc.eval('a=1')

        stdin = sys.stdin
        stdout = sys.stdout
        output = StringIO()
        sys.stdin = StringIO('a\nexit')
        self.oc._session.stdout = output
        try:
            self.oc.keyboard(timeout=3)
        except Oct2PyError as e:  # pragma: no cover
            if 'session timed out' in str(e).lower():
                # the keyboard command is not supported
                # (likely using Octave 3.2)
                return
            else:
                raise(e)
        sys.stdin.flush()
        sys.stdin = stdin
        self.oc._session.stdout = stdout

        out = output.getvalue()
        assert 'Entering Octave Debug Prompt...' in out
        assert 'a =  1' in out
예제 #4
0
파일: test_misc.py 프로젝트: suever/oct2py
    def test_keyboard(self):
        self.oc.eval('a=1')

        stdin = sys.stdin
        stdout = sys.stdout
        output = StringIO()
        sys.stdin = StringIO('a\nexit')
        self.oc._session.stdout = output
        try:
            self.oc.keyboard(timeout=3)
        except Oct2PyError as e:  # pragma: no cover
            if 'session timed out' in str(e).lower():
                # the keyboard command is not supported
                # (likely using Octave 3.2)
                return
            else:
                raise(e)
        sys.stdin.flush()
        sys.stdin = stdin
        self.oc._session.stdout = stdout

        out = output.getvalue()
        assert 'Entering Octave Debug Prompt...' in out
        assert 'a =  1' in out