test/testing/test_session.py - line 27
|
|
def check_conflict_option(opts): |
print "testing if options conflict:", " ".join(opts) |
config = py.test.config._reparse(opts + [datadir/'filetest.py']) |
py.test.raises((ValueError, SystemExit), """ |
config.initsession() |
-> """) | |
test/raises.py - line 20
| 5 |
| 6 |
| 7 |
| 8 |
| 9 |
| 10 |
| 11 |
| 12 |
| 13 |
| 14 |
| 15 |
| 16 |
| 17 |
| 18 |
| 19 |
| 20 |
| 21 |
| 22 |
| 23 |
| 24 |
| 25 |
| 26 |
| 27 |
| 28 |
| 29 |
| 30 |
| 31 |
| 32 |
| 33 |
| 34 |
| 35 |
| 36 |
| 37 |
| 38 |
| 39 | |
def raises(ExpectedException, *args, **kwargs): |
""" raise AssertionError, if target code does not raise the expected |
exception. |
""" |
assert args |
__tracebackhide__ = True |
if isinstance(args[0], str): |
expr, = args |
assert isinstance(expr, str) |
frame = sys._getframe(1) |
loc = frame.f_locals.copy() |
loc.update(kwargs) |
|
source = py.code.Source(expr) |
try: |
-> exec source.compile() in frame.f_globals, loc |
|
|
|
except ExpectedException: |
return py.code.ExceptionInfo() |
else: |
func = args[0] |
assert callable |
try: |
func(*args[1:], **kwargs) |
|
except ExpectedException: |
return py.code.ExceptionInfo() |
k = ", ".join(["%s=%r" % x for x in kwargs.items()]) |
if k: |
k = ', ' + k |
expr = '%s(%r%s)' %(func.__name__, args, k) |
raise ExceptionFailure(msg="DID NOT RAISE", |
expr=args, expected=ExpectedException) | |
None</build/buildd/codespeak-lib-0.9.1/py/test/raises.py:20> - line 2
test/config.py - line 140
|
|
def initsession(self): |
""" return an initialized session object. """ |
cls = self._getsessionclass() |
-> session = cls(self) |
session.fixoptions() |
return session | |
test/terminal/remote.py - line 58
|
|
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) | |
test/terminal/remote.py - line 69
|
|
def _setexecutable(self): |
name = self.config.option.executable |
if name is None: |
executable = py.std.sys.executable |
else: |
-> executable = py.path.local.sysfind(name) |
assert executable is not None, executable |
self.executable = executable | |