Exemple #1
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
Exemple #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
Exemple #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
Exemple #4
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