Exemplo n.º 1
0
 def __init__(self, config, file=None):
     super(RemoteTerminalSession, self).__init__(config=config)
     self._setexecutable()
     if file is None:
         file = py.std.sys.stdout 
     self._file = file
     self.out = getout(file)
Exemplo n.º 2
0
def test_repr_local():
    config = newconfig('--showlocals')
    s = StringIO()
    out = getout(s)
    p = Presenter(out, config)
    p.repr_locals(locals())
    for key in locals().keys():
        assert s.getvalue().find(key) != -1
Exemplo n.º 3
0
 def __init__(self, config, file=None): 
     super(TerminalSession, self).__init__(config) 
     if file is None: 
         file = py.std.sys.stdout 
     self._file = file
     self.out = getout(file) 
     self._opencollectors = []
     self.presenter = Presenter(self.out, config)
Exemplo n.º 4
0
 def __init__(self, config, hosts):
     self.config = config
     self.hosts = hosts
     self.failed_tests_outcome = []
     self.skipped_tests_outcome = []
     self.out = getout(py.std.sys.stdout)
     self.presenter = Presenter(self.out, config)
     self.failed = dict([(host, 0) for host in hosts])
     self.skipped = dict([(host, 0) for host in hosts])
     self.passed = dict([(host, 0) for host in hosts])
     self.to_rsync = {}
Exemplo n.º 5
0
def test_repr_source():
    source = py.code.Source("""
    def f(x):
        pass
    """).strip()
    config = newconfig()
    s = StringIO()
    out = getout(s)
    p = Presenter(out, config)
    p.repr_source(source, "|", 0)
    lines = s.getvalue().split("\n")
    assert len(lines) == 3
    assert lines[0].startswith("|")
    assert lines[0].find("def f(x)") != -1
    assert lines[1].find("pass") != -1
Exemplo n.º 6
0
def test_repr_failure_explanation():
    """ We check here if indentation is right
    """
    def f():
        def g():
            1/0
        try:
            g()
        except:
            e = py.code.ExceptionInfo()
        return e
    config = newconfig()
    s = StringIO()
    out = getout(s)
    p = Presenter(out, config)
    source = py.code.Source(f)
    e = f()
    p.repr_failure_explanation(e, source)
    assert s.getvalue().startswith(">   ")
Exemplo n.º 7
0
def test_repr_traceback_long():
    py.test.skip("unfinished")
    config = py.test.config._reparse([])
    s = StringIO()
    out = getout(s)
    p = Presenter(out, config)