[py-svn] r51145 - in py/branch/event/py: . test2 test2/rsession test2/rsession/testing test2/terminal test2/testing test2/web
hpk at codespeak.net
hpk at codespeak.net
Wed Jan 30 20:38:16 CET 2008
Author: hpk
Date: Wed Jan 30 20:38:14 2008
New Revision: 51145
Added:
py/branch/event/py/test2/
- copied from r51144, py/branch/event/py/test/
Modified:
py/branch/event/py/__init__.py
py/branch/event/py/test2/box.py
py/branch/event/py/test2/cmdline.py
py/branch/event/py/test2/collect.py
py/branch/event/py/test2/collectonly.py
py/branch/event/py/test2/compat.py
py/branch/event/py/test2/config.py
py/branch/event/py/test2/conftesthandle.py
py/branch/event/py/test2/defaultconftest.py
py/branch/event/py/test2/doctest.py
py/branch/event/py/test2/executor.py
py/branch/event/py/test2/item.py
py/branch/event/py/test2/raises.py
py/branch/event/py/test2/repevent.py
py/branch/event/py/test2/reporter.py
py/branch/event/py/test2/representation.py
py/branch/event/py/test2/rsession/hostmanage.py
py/branch/event/py/test2/rsession/local.py
py/branch/event/py/test2/rsession/master.py
py/branch/event/py/test2/rsession/rest.py
py/branch/event/py/test2/rsession/rsession.py
py/branch/event/py/test2/rsession/slave.py
py/branch/event/py/test2/rsession/testing/basetest.py
py/branch/event/py/test2/rsession/testing/test_hostmanage.py
py/branch/event/py/test2/rsession/testing/test_master.py
py/branch/event/py/test2/rsession/testing/test_rest.py
py/branch/event/py/test2/rsession/testing/test_rsession.py
py/branch/event/py/test2/rsession/testing/test_slave.py
py/branch/event/py/test2/rsession/testing/test_web.py
py/branch/event/py/test2/rsession/testing/test_webjs.py
py/branch/event/py/test2/rsession/web.py
py/branch/event/py/test2/rsession/webjs.py
py/branch/event/py/test2/session.py
py/branch/event/py/test2/terminal/remote.py
py/branch/event/py/test2/testing/setupdata.py
py/branch/event/py/test2/testing/test_boxing.py
py/branch/event/py/test2/testing/test_collect.py
py/branch/event/py/test2/testing/test_collectonly.py
py/branch/event/py/test2/testing/test_compat.py
py/branch/event/py/test2/testing/test_config.py
py/branch/event/py/test2/testing/test_conftesthandle.py
py/branch/event/py/test2/testing/test_deprecated.py
py/branch/event/py/test2/testing/test_doctest.py
py/branch/event/py/test2/testing/test_executor.py
py/branch/event/py/test2/testing/test_itemgen.py
py/branch/event/py/test2/testing/test_outcome.py
py/branch/event/py/test2/testing/test_remote.py
py/branch/event/py/test2/testing/test_repevent.py
py/branch/event/py/test2/testing/test_reporter.py
py/branch/event/py/test2/testing/test_repr.py
py/branch/event/py/test2/testing/test_session.py
py/branch/event/py/test2/testing/test_session2.py
py/branch/event/py/test2/web/webcheck.py
Log:
make a py.test2 namespace for incremental refactoring
and to allow to use py.test itself for testing it.
Modified: py/branch/event/py/__init__.py
==============================================================================
--- py/branch/event/py/__init__.py (original)
+++ py/branch/event/py/__init__.py Wed Jan 30 20:38:14 2008
@@ -26,28 +26,47 @@
exportdefs = {
# helpers for use from test functions or collectors
'test.__doc__' : ('./test/__init__.py', '__doc__'),
+ 'test2.__doc__' : ('./test2/__init__.py', '__doc__'),
'test.raises' : ('./test/raises.py', 'raises'),
+ 'test2.raises' : ('./test2/raises.py', 'raises'),
'test.deprecated_call' : ('./test/deprecate.py', 'deprecated_call'),
+ 'test2.deprecated_call' : ('./test2/deprecate.py', 'deprecated_call'),
'test.skip' : ('./test/item.py', 'skip'),
+ 'test2.skip' : ('./test2/item.py', 'skip'),
'test.fail' : ('./test/item.py', 'fail'),
+ 'test2.fail' : ('./test2/item.py', 'fail'),
'test.exit' : ('./test/session.py', 'exit'),
+ 'test2.exit' : ('./test2/session.py', 'exit'),
'test.pdb' : ('./test/custompdb.py', 'set_trace'),
+ 'test2.pdb' : ('./test2/custompdb.py', 'set_trace'),
# configuration/initialization related test api
'test.config' : ('./test/config.py', 'config_per_process'),
+ 'test2.config' : ('./test2/config.py', 'config_per_process'),
'test.ensuretemp' : ('./test/config.py', 'ensuretemp'),
+ 'test2.ensuretemp' : ('./test2/config.py', 'ensuretemp'),
'test.cmdline.main' : ('./test/cmdline.py', 'main'),
+ 'test2.cmdline.main' : ('./test2/cmdline.py', 'main'),
# for customization of collecting/running tests
'test.collect.Collector' : ('./test/collect.py', 'Collector'),
+ 'test2.collect.Collector' : ('./test2/collect.py', 'Collector'),
'test.collect.Directory' : ('./test/collect.py', 'Directory'),
+ 'test2.collect.Directory' : ('./test2/collect.py', 'Directory'),
'test.collect.Module' : ('./test/collect.py', 'Module'),
+ 'test2.collect.Module' : ('./test2/collect.py', 'Module'),
'test.collect.DoctestFile' : ('./test/collect.py', 'DoctestFile'),
+ 'test2.collect.DoctestFile' : ('./test2/collect.py', 'DoctestFile'),
'test.collect.Class' : ('./test/collect.py', 'Class'),
+ 'test2.collect.Class' : ('./test2/collect.py', 'Class'),
'test.collect.Instance' : ('./test/collect.py', 'Instance'),
+ 'test2.collect.Instance' : ('./test2/collect.py', 'Instance'),
'test.collect.Generator' : ('./test/collect.py', 'Generator'),
+ 'test2.collect.Generator' : ('./test2/collect.py', 'Generator'),
'test.collect.Item' : ('./test/item.py', 'Item'),
+ 'test2.collect.Item' : ('./test2/item.py', 'Item'),
'test.collect.Function' : ('./test/item.py', 'Function'),
+ 'test2.collect.Function' : ('./test2/item.py', 'Function'),
# Event related APIs
'event.Hub' : ('./event/hub.py', 'Hub'),
Modified: py/branch/event/py/test2/box.py
==============================================================================
--- py/branch/event/py/test/box.py (original)
+++ py/branch/event/py/test2/box.py Wed Jan 30 20:38:14 2008
@@ -7,7 +7,7 @@
import os
import sys
import marshal
-from py.__.test import config as pytestconfig
+from py.__.test2 import config as pytestconfig
PYTESTSTDOUT = "pyteststdout"
PYTESTSTDERR = "pyteststderr"
@@ -32,9 +32,9 @@
self.kwargs = kwargs
def run(self, continuation=False):
- # XXX we should not use py.test.ensuretemp here
+ # XXX we should not use py.test2.ensuretemp here
count = counter()
- tempdir = py.test.ensuretemp("box%d" % count)
+ tempdir = py.test2.ensuretemp("box%d" % count)
self.tempdir = tempdir
self.PYTESTRETVAL = tempdir.join('retval')
self.PYTESTSTDOUT = tempdir.join('stdout')
Modified: py/branch/event/py/test2/cmdline.py
==============================================================================
--- py/branch/event/py/test/cmdline.py (original)
+++ py/branch/event/py/test2/cmdline.py Wed Jan 30 20:38:14 2008
@@ -8,7 +8,7 @@
warn_about_missing_assertion()
if args is None:
args = py.std.sys.argv[1:]
- config = py.test.config
+ config = py.test2.config
config.parse(args)
session = config.initsession()
try:
Modified: py/branch/event/py/test2/collect.py
==============================================================================
--- py/branch/event/py/test/collect.py (original)
+++ py/branch/event/py/test2/collect.py Wed Jan 30 20:38:14 2008
@@ -25,7 +25,7 @@
"""
from __future__ import generators
import py
-from py.__.test.outcome import Skipped
+from py.__.test2.outcome import Skipped
def configproperty(name):
def fget(self):
@@ -45,7 +45,7 @@
def __init__(self, name, parent=None):
self.name = name
self.parent = parent
- self._config = getattr(parent, '_config', py.test.config)
+ self._config = getattr(parent, '_config', py.test2.config)
self.fspath = getattr(parent, 'fspath', None)
Module = configproperty('Module')
@@ -181,7 +181,7 @@
if eor:
key = key[1:]
if not (eor ^ self._matchonekeyword(key, chain)):
- py.test.skip("test not selected by keyword %r" %(keyword,))
+ py.test2.skip("test not selected by keyword %r" %(keyword,))
def _matchonekeyword(self, key, chain):
elems = key.split(".")
@@ -208,11 +208,11 @@
cases.
"""
if yieldtype is None:
- yieldtype = py.test.collect.Item
+ yieldtype = py.test2.collect.Item
if isinstance(self, yieldtype):
yield self
else:
- if not isinstance(self, py.test.collect.Item):
+ if not isinstance(self, py.test2.collect.Item):
try:
for x in self.run():
for y in self.join(x)._tryiter(yieldtype):
@@ -283,7 +283,7 @@
elif p.ext == '.txt':
res = self.DoctestFile(p, parent=self)
elif p.check(dir=1):
- Directory = py.test.config.getvalue('Directory', p)
+ Directory = py.test2.config.getvalue('Directory', p)
res = Directory(p, parent=self)
name2items[name] = res
return res
@@ -430,7 +430,7 @@
except IOError:
pass
# fall back...
- for x in self._tryiter((py.test.collect.Generator, py.test.collect.Item)):
+ for x in self._tryiter((py.test2.collect.Generator, py.test2.collect.Item)):
return x._getsortvalue()
class Instance(PyCollectorMixin, Collector):
@@ -507,7 +507,7 @@
return [self.fspath.basename]
def join(self, name):
- from py.__.test.doctest import DoctestText
+ from py.__.test2.doctest import DoctestText
if name == self.fspath.basename:
item = DoctestText(self.fspath.basename, parent=self)
item._content = self.fspath.read()
Modified: py/branch/event/py/test2/collectonly.py
==============================================================================
--- py/branch/event/py/test/collectonly.py (original)
+++ py/branch/event/py/test2/collectonly.py Wed Jan 30 20:38:14 2008
@@ -3,8 +3,8 @@
"""
import py
-from py.__.test.session import Session
-from py.__.test.reporter import LocalReporter
+from py.__.test2.session import Session
+from py.__.test2.reporter import LocalReporter
class CollectReporter(LocalReporter):
def __init__(self, *args, **kwds):
Modified: py/branch/event/py/test2/compat.py
==============================================================================
--- py/branch/event/py/test/compat.py (original)
+++ py/branch/event/py/test2/compat.py Wed Jan 30 20:38:14 2008
@@ -1,5 +1,5 @@
import py
-from py.__.test.outcome import Failed, Passed
+from py.__.test2.outcome import Failed, Passed
class TestCaseUnit(py.test.collect.Function):
@@ -31,7 +31,7 @@
raise Failed(msg=msg)
def assertRaises(self, excclass, func, *args, **kwargs):
- py.test.raises(excclass, func, *args, **kwargs)
+ py.test2.raises(excclass, func, *args, **kwargs)
failUnlessRaises = assertRaises
# dynamically construct (redundant) methods
Modified: py/branch/event/py/test2/config.py
==============================================================================
--- py/branch/event/py/test/config.py (original)
+++ py/branch/event/py/test2/config.py Wed Jan 30 20:38:14 2008
@@ -2,7 +2,7 @@
import py
from conftesthandle import Conftest
-from py.__.test.defaultconftest import adddefaultoptions
+from py.__.test2.defaultconftest import adddefaultoptions
optparse = py.compat.optparse
@@ -173,13 +173,13 @@
""" this is used from tests that want to re-invoke parse(). """
#assert args # XXX should not be empty
global config_per_process
- oldconfig = py.test.config
+ oldconfig = py.test2.config
try:
- config_per_process = py.test.config = Config()
+ config_per_process = py.test2.config = Config()
config_per_process.parse(args)
return config_per_process
finally:
- config_per_process = py.test.config = oldconfig
+ config_per_process = py.test2.config = oldconfig
def _makerepr(self, conftestnames, optnames=None):
""" return a marshallable representation
@@ -260,16 +260,16 @@
del colitem._capture
colitem._captured_out, colitem._captured_err = capture.reset()
-# this is the one per-process instance of py.test configuration
+# this is the one per-process instance of py.test2 configuration
config_per_process = Config()
# default import paths for sessions
-Session = 'py.__.test.session'
-RemoteTerminalSession = 'py.__.test.terminal.remote'
-RSession = 'py.__.test.rsession.rsession'
-LSession = 'py.__.test.rsession.rsession'
-CollectSession = 'py.__.test.collectonly'
+Session = 'py.__.test2.session'
+RemoteTerminalSession = 'py.__.test2.terminal.remote'
+RSession = 'py.__.test2.rsession.rsession'
+LSession = 'py.__.test2.rsession.rsession'
+CollectSession = 'py.__.test2.collectonly'
#
# helpers
Modified: py/branch/event/py/test2/conftesthandle.py
==============================================================================
--- py/branch/event/py/test/conftesthandle.py (original)
+++ py/branch/event/py/test2/conftesthandle.py Wed Jan 30 20:38:14 2008
@@ -3,7 +3,7 @@
class Conftest(object):
""" the single place for accessing values and interacting
- towards conftest modules from py.test objects.
+ towards conftest modules from py.test2 objects.
Note that triggering Conftest instances to import
conftest.py files may result in added cmdline options.
Modified: py/branch/event/py/test2/defaultconftest.py
==============================================================================
--- py/branch/event/py/test/defaultconftest.py (original)
+++ py/branch/event/py/test2/defaultconftest.py Wed Jan 30 20:38:14 2008
@@ -1,12 +1,12 @@
import py
-Module = py.test.collect.Module
-DoctestFile = py.test.collect.DoctestFile
-Directory = py.test.collect.Directory
-Class = py.test.collect.Class
-Generator = py.test.collect.Generator
-Function = py.test.collect.Function
-Instance = py.test.collect.Instance
+Module = py.test2.collect.Module
+DoctestFile = py.test2.collect.DoctestFile
+Directory = py.test2.collect.Directory
+Class = py.test2.collect.Class
+Generator = py.test2.collect.Generator
+Function = py.test2.collect.Function
+Instance = py.test2.collect.Instance
conf_iocapture = "fd" # overridable from conftest.py
@@ -20,7 +20,7 @@
dist_taskspernode = 15
dist_boxed = False
if hasattr(py.std.os, 'nice'):
- dist_nicelevel = py.std.os.nice(0) # nice py.test works
+ dist_nicelevel = py.std.os.nice(0) # nice py.test2 works
else:
dist_nicelevel = 0
dist_rsync_ignore = []
Modified: py/branch/event/py/test2/doctest.py
==============================================================================
--- py/branch/event/py/test/doctest.py (original)
+++ py/branch/event/py/test2/doctest.py Wed Jan 30 20:38:14 2008
@@ -1,6 +1,6 @@
import py
-class DoctestText(py.test.collect.Item):
+class DoctestText(py.test2.collect.Item):
def _setcontent(self, content):
self._content = content
@@ -29,5 +29,5 @@
mod.__doc__ = docstring
failed, tot = py.compat.doctest.testmod(mod, verbose=1)
if failed:
- py.test.fail("doctest %s: %s failed out of %s" %(
+ py.test2.fail("doctest %s: %s failed out of %s" %(
self.fspath, failed, tot))
Modified: py/branch/event/py/test2/executor.py
==============================================================================
--- py/branch/event/py/test/executor.py (original)
+++ py/branch/event/py/test2/executor.py Wed Jan 30 20:38:14 2008
@@ -3,11 +3,11 @@
import py, os, sys
-from py.__.test.outcome import SerializableOutcome, ReprOutcome
-from py.__.test.box import Box
-from py.__.test import repevent
-from py.__.test.outcome import Skipped, Failed
-import py.__.test.custompdb
+from py.__.test2.outcome import SerializableOutcome, ReprOutcome
+from py.__.test2.box import Box
+from py.__.test2 import repevent
+from py.__.test2.outcome import Skipped, Failed
+import py.__.test2.custompdb
class RunExecutor(object):
""" Same as in executor, but just running run
@@ -48,7 +48,7 @@
excinfo = e.excinfo
else:
excinfo = py.code.ExceptionInfo()
- if isinstance(self.item, py.test.collect.Function):
+ if isinstance(self.item, py.test2.collect.Function):
fun = self.item.obj # hope this is stable
code = py.code.Code(fun)
excinfo.traceback = excinfo.traceback.cut(
@@ -60,7 +60,7 @@
self.reporter(repevent.ImmediateFailure(self.item,
ReprOutcome(outcome.make_repr
(self.config.option.tbstyle))))
- py.__.test.custompdb.post_mortem(excinfo._excinfo[2])
+ py.__.test2.custompdb.post_mortem(excinfo._excinfo[2])
# XXX hmm, we probably will not like to continue from that
# point
raise SystemExit()
@@ -85,7 +85,7 @@
""" We want to trace *only* function objects here. Unsure
what to do with custom collectors at all
"""
- if hasattr(self.item, 'obj') and type(self.item) is py.test.collect.Function:
+ if hasattr(self.item, 'obj') and type(self.item) is py.test2.collect.Function:
self.item.execute = self.wrap_underlaying
self.item.run()
Modified: py/branch/event/py/test2/item.py
==============================================================================
--- py/branch/event/py/test/item.py (original)
+++ py/branch/event/py/test2/item.py Wed Jan 30 20:38:14 2008
@@ -1,8 +1,8 @@
import py
from inspect import isclass, ismodule
-from py.__.test.outcome import Skipped, Failed, Passed
-from py.__.test.collect import FunctionMixin
+from py.__.test2.outcome import Skipped, Failed, Passed
+from py.__.test2.collect import FunctionMixin
_dummy = object()
@@ -31,7 +31,7 @@
col.setup()
self.stack.append(col)
-class Item(py.test.collect.Collector):
+class Item(py.test2.collect.Collector):
def startcapture(self):
self._config._startcapture(self, path=self.fspath)
Modified: py/branch/event/py/test2/raises.py
==============================================================================
--- py/branch/event/py/test/raises.py (original)
+++ py/branch/event/py/test2/raises.py Wed Jan 30 20:38:14 2008
@@ -1,6 +1,6 @@
import sys
import py
-from py.__.test.outcome import ExceptionFailure
+from py.__.test2.outcome import ExceptionFailure
def raises(ExpectedException, *args, **kwargs):
""" raise AssertionError, if target code does not raise the expected
Modified: py/branch/event/py/test2/repevent.py
==============================================================================
--- py/branch/event/py/test/repevent.py (original)
+++ py/branch/event/py/test2/repevent.py Wed Jan 30 20:38:14 2008
@@ -11,7 +11,7 @@
# pass
##def report_error(excinfo):
-## if isinstance(excinfo, py.test.collect.Item.Skipped):
+## if isinstance(excinfo, py.test2.collect.Item.Skipped):
## # we need to dispatch this info
## report(Skipped(excinfo))
## else:
Modified: py/branch/event/py/test2/reporter.py
==============================================================================
--- py/branch/event/py/test/reporter.py (original)
+++ py/branch/event/py/test2/reporter.py Wed Jan 30 20:38:14 2008
@@ -7,11 +7,11 @@
import py
-from py.__.test.terminal.out import getout
-from py.__.test import repevent
-from py.__.test import outcome
+from py.__.test2.terminal.out import getout
+from py.__.test2 import repevent
+from py.__.test2 import outcome
from py.__.misc.terminal_helper import ansi_print, get_terminal_width
-from py.__.test.representation import Presenter, repr_pythonversion,\
+from py.__.test2.representation import Presenter, repr_pythonversion,\
getrelpath
import sys
@@ -21,10 +21,10 @@
def choose_reporter(reporterclass, config):
option = config.option
if option.startserver or option.runbrowser:
- from py.__.test.rsession.web import WebReporter
+ from py.__.test2.rsession.web import WebReporter
return WebReporter
if option.restreport:
- from py.__.test.rsession.rest import RestReporter
+ from py.__.test2.rsession.rest import RestReporter
return RestReporter
else:
return reporterclass
@@ -378,7 +378,7 @@
def report_SkippedTryiter(self, event):
#self.show_item(event.item, False)
- if isinstance(event.item, py.test.collect.Module):
+ if isinstance(event.item, py.test2.collect.Module):
self.out.write("- skipped (%s)" % event.excinfo.value)
else:
self.out.write("s")
@@ -409,10 +409,10 @@
self.show_item(event.item)
def show_item(self, item, count_elems = True):
- if isinstance(item, py.test.collect.Module):
+ if isinstance(item, py.test2.collect.Module):
self.show_Module(item)
if self.config.option.verbose > 0 and\
- isinstance(item, py.test.collect.Item):
+ isinstance(item, py.test2.collect.Item):
self.show_ItemVerbose(item)
def show_ItemVerbose(self, item):
Modified: py/branch/event/py/test2/representation.py
==============================================================================
--- py/branch/event/py/test/representation.py (original)
+++ py/branch/event/py/test2/representation.py Wed Jan 30 20:38:14 2008
@@ -51,14 +51,14 @@
self.out.line(prefix + source[i])
def repr_item_info(self, item):
- """ This method represents py.test.collect.Item info (path and module)
+ """ This method represents py.test2.collect.Item info (path and module)
"""
root = item.fspath
modpath = item._getmodpath()
try:
fn, lineno = item._getpathlineno()
except TypeError:
- assert isinstance(item.parent, py.test.collect.Generator)
+ assert isinstance(item.parent, py.test2.collect.Generator)
# a generative test yielded a non-callable
fn, lineno = item.parent._getpathlineno()
if root == fn:
Modified: py/branch/event/py/test2/rsession/hostmanage.py
==============================================================================
--- py/branch/event/py/test/rsession/hostmanage.py (original)
+++ py/branch/event/py/test2/rsession/hostmanage.py Wed Jan 30 20:38:14 2008
@@ -2,10 +2,10 @@
import py
import time
import thread, threading
-from py.__.test.rsession.master import MasterNode
-from py.__.test.rsession.slave import setup_slave
+from py.__.test2.rsession.master import MasterNode
+from py.__.test2.rsession.slave import setup_slave
-from py.__.test import repevent
+from py.__.test2 import repevent
class HostInfo(object):
""" Class trying to store all necessary attributes
Modified: py/branch/event/py/test2/rsession/local.py
==============================================================================
--- py/branch/event/py/test/rsession/local.py (original)
+++ py/branch/event/py/test2/rsession/local.py Wed Jan 30 20:38:14 2008
@@ -3,10 +3,10 @@
"""
import py
-from py.__.test.executor import BoxExecutor, RunExecutor,\
+from py.__.test2.executor import BoxExecutor, RunExecutor,\
ApigenExecutor
-from py.__.test import repevent
-from py.__.test.outcome import ReprOutcome
+from py.__.test2 import repevent
+from py.__.test2.outcome import ReprOutcome
# XXX copied from session.py
def startcapture(session):
Modified: py/branch/event/py/test2/rsession/master.py
==============================================================================
--- py/branch/event/py/test/rsession/master.py (original)
+++ py/branch/event/py/test2/rsession/master.py Wed Jan 30 20:38:14 2008
@@ -2,9 +2,9 @@
Node code for Master.
"""
import py
-from py.__.test.outcome import ReprOutcome
-from py.__.test import repevent
-from py.__.test.outcome import Skipped
+from py.__.test2.outcome import ReprOutcome
+from py.__.test2 import repevent
+from py.__.test2.outcome import Skipped
from py.builtin import GeneratorExit
class MasterNode(object):
Modified: py/branch/event/py/test2/rsession/rest.py
==============================================================================
--- py/branch/event/py/test/rsession/rest.py (original)
+++ py/branch/event/py/test2/rsession/rest.py Wed Jan 30 20:38:14 2008
@@ -5,8 +5,8 @@
import py
import sys
from StringIO import StringIO
-from py.__.test.reporter import AbstractReporter
-from py.__.test import repevent
+from py.__.test2.reporter import AbstractReporter
+from py.__.test2 import repevent
from py.__.rest.rst import *
class RestReporter(AbstractReporter):
@@ -71,7 +71,7 @@
def report_ItemStart(self, event):
item = event.item
- if isinstance(item, py.test.collect.Module):
+ if isinstance(item, py.test2.collect.Module):
lgt = len(list(item._tryiter()))
lns = item.listnames()[1:]
name = "/".join(lns)
Modified: py/branch/event/py/test2/rsession/rsession.py
==============================================================================
--- py/branch/event/py/test/rsession/rsession.py (original)
+++ py/branch/event/py/test2/rsession/rsession.py Wed Jan 30 20:38:14 2008
@@ -8,14 +8,14 @@
import re
import time
-from py.__.test import repevent
-from py.__.test.rsession.master import MasterNode, dispatch_loop
-from py.__.test.rsession.hostmanage import HostInfo, HostManager
-from py.__.test.rsession.local import local_loop, plain_runner, apigen_runner,\
+from py.__.test2 import repevent
+from py.__.test2.rsession.master import MasterNode, dispatch_loop
+from py.__.test2.rsession.hostmanage import HostInfo, HostManager
+from py.__.test2.rsession.local import local_loop, plain_runner, apigen_runner,\
box_runner
-from py.__.test.reporter import LocalReporter, RemoteReporter, TestReporter
-from py.__.test.session import AbstractSession, itemgen
-from py.__.test.outcome import Skipped, Failed
+from py.__.test2.reporter import LocalReporter, RemoteReporter, TestReporter
+from py.__.test2.session import AbstractSession, itemgen
+from py.__.test2.outcome import Skipped, Failed
class RSession(AbstractSession):
""" Remote version of session
Modified: py/branch/event/py/test2/rsession/slave.py
==============================================================================
--- py/branch/event/py/test/rsession/slave.py (original)
+++ py/branch/event/py/test2/rsession/slave.py Wed Jan 30 20:38:14 2008
@@ -3,9 +3,9 @@
"""
import py
-from py.__.test.executor import RunExecutor, BoxExecutor, AsyncExecutor
-from py.__.test.outcome import SerializableOutcome
-from py.__.test.outcome import Skipped
+from py.__.test2.executor import RunExecutor, BoxExecutor, AsyncExecutor
+from py.__.test2.outcome import SerializableOutcome
+from py.__.test2.outcome import Skipped
import thread
import os
@@ -38,7 +38,7 @@
node = nodes.get(item[0], None)
if node is not None:
return node
- col = py.test.collect.Directory(str(py.path.local(path).join(item[0])))
+ col = py.test2.collect.Directory(str(py.path.local(path).join(item[0])))
if config.option.boxed:
executor = BoxExecutor
else:
@@ -88,7 +88,7 @@
# setup defaults...
sys.path.insert(0, basedir)
import py
- config = py.test.config
+ config = py.test2.config
assert not config._initialized
config._initdirect(basedir, config_repr)
if hasattr(os, 'nice'):
@@ -96,7 +96,7 @@
os.nice(nice_level)
if not config.option.nomagic:
py.magic.invoke(assertion=1)
- from py.__.test.rsession.slave import slave_main
+ from py.__.test2.rsession.slave import slave_main
slave_main(channel.receive, channel.send, basedir, config)
if not config.option.nomagic:
py.magic.revoke(assertion=1)
Modified: py/branch/event/py/test2/rsession/testing/basetest.py
==============================================================================
--- py/branch/event/py/test/rsession/testing/basetest.py (original)
+++ py/branch/event/py/test2/rsession/testing/basetest.py Wed Jan 30 20:38:14 2008
@@ -14,7 +14,7 @@
raise AssertionError("hello world")
def funcskip():
- py.test.skip("skipped")
+ py.test2.skip("skipped")
def funcprint():
print "samfing"
@@ -24,7 +24,7 @@
asddsa
def funcoptioncustom():
- assert py.test.config.getvalue("custom")
+ assert py.test2.config.getvalue("custom")
def funchang():
import time
@@ -32,11 +32,11 @@
class BasicRsessionTest(object):
def setup_class(cls):
- tmpdir = py.test.ensuretemp(cls.__name__)
+ tmpdir = py.test2.ensuretemp(cls.__name__)
source = py.code.Source(func_source)[1:].deindent()
testonepath = tmpdir.ensure("test_one.py")
testonepath.write(source)
- cls.config = py.test.config._reparse([tmpdir])
+ cls.config = py.test2.config._reparse([tmpdir])
cls.collector_test_one = cls.config._getcollector(testonepath)
cls.doctest = tmpdir.ensure("xxx.txt").write(py.code.Source("""
Aha!!!!!!
Modified: py/branch/event/py/test2/rsession/testing/test_hostmanage.py
==============================================================================
--- py/branch/event/py/test/rsession/testing/test_hostmanage.py (original)
+++ py/branch/event/py/test2/rsession/testing/test_hostmanage.py Wed Jan 30 20:38:14 2008
@@ -3,14 +3,14 @@
"""
import py
-from py.__.test.rsession.hostmanage import HostRSync, HostInfo, HostManager
-from py.__.test.rsession.hostmanage import sethomedir, gethomedir, getpath_relto_home
-from py.__.test import repevent
+from py.__.test2.rsession.hostmanage import HostRSync, HostInfo, HostManager
+from py.__.test2.rsession.hostmanage import sethomedir, gethomedir, getpath_relto_home
+from py.__.test2 import repevent
class DirSetup:
def setup_method(self, method):
name = "%s.%s" %(self.__class__.__name__, method.func_name)
- self.tmpdir = py.test.ensuretemp(name)
+ self.tmpdir = py.test2.ensuretemp(name)
self.source = self.tmpdir.ensure("source", dir=1)
self.dest = self.tmpdir.join("dest")
@@ -53,7 +53,7 @@
def test_non_existing_hosts(self):
host = HostInfo("alskdjalsdkjasldkajlsd")
- py.test.raises((py.process.cmdexec.Error, IOError, EOFError),
+ py.test2.raises((py.process.cmdexec.Error, IOError, EOFError),
host.initgateway)
def test_remote_has_homedir_as_currentdir(self):
@@ -85,7 +85,7 @@
host.gw.exit()
def test_initgateway_ssh_and_remotepath(self):
- option = py.test.config.option
+ option = py.test2.config.option
if getattr(option, 'sshtarget', None) is None:
py.test.skip("no known ssh target, use -S to set one")
host = HostInfo("%s" % (option.sshtarget, ))
@@ -174,14 +174,14 @@
if dist_rsync_roots:
l.append("dist_rsync_roots = %r" % dist_rsync_roots)
self.source.join("conftest.py").write("\n".join(l))
- config = py.test.config._reparse([self.source])
+ config = py.test2.config._reparse([self.source])
assert config.topdir == self.source
hm = HostManager(config)
assert hm.hosts
return hm
def test_hostmanager_custom_hosts(self):
- config = py.test.config._reparse([self.source])
+ config = py.test2.config._reparse([self.source])
hm = HostManager(config, hosts=[1,2,3])
assert hm.hosts == [1,2,3]
@@ -220,7 +220,7 @@
self.source.join("conftest.py").write(py.code.Source("""
dist_rsync_roots = ['dir1/dir2']
"""))
- config = py.test.config._reparse([self.source])
+ config = py.test2.config._reparse([self.source])
hm = HostManager(config,
hosts=[HostInfo("localhost:" + str(self.dest))])
events = []
@@ -237,7 +237,7 @@
self.source.join("conftest.py").write(py.code.Source("""
dist_rsync_ignore = ['dir1/dir2', 'dir5/dir6']
"""))
- config = py.test.config._reparse([self.source])
+ config = py.test2.config._reparse([self.source])
hm = HostManager(config,
hosts=[HostInfo("localhost:" + str(self.dest))])
events = []
@@ -250,7 +250,7 @@
def test_hostmanage_optimise_localhost(self):
hosts = [HostInfo("localhost") for i in range(3)]
- config = py.test.config._reparse([self.source])
+ config = py.test2.config._reparse([self.source])
hm = HostManager(config, hosts=hosts)
events = []
hm.init_rsync(events.append)
@@ -262,7 +262,7 @@
def XXXtest_ssh_rsync_samehost_twice(self):
#XXX we have no easy way to have a temp directory remotely!
- option = py.test.config.option
+ option = py.test2.config.option
if option.sshtarget is None:
py.test.skip("no known ssh target, use -S to set one")
host1 = HostInfo("%s" % (option.sshtarget, ))
Modified: py/branch/event/py/test2/rsession/testing/test_master.py
==============================================================================
--- py/branch/event/py/test/rsession/testing/test_master.py (original)
+++ py/branch/event/py/test2/rsession/testing/test_master.py Wed Jan 30 20:38:14 2008
@@ -9,17 +9,17 @@
if sys.platform == 'win32':
py.test.skip("rsession is unsupported on Windows.")
-from py.__.test.rsession.master import dispatch_loop, MasterNode
-from py.__.test.rsession.slave import setup_slave
-from py.__.test.outcome import ReprOutcome, SerializableOutcome
-from py.__.test import repevent
-from py.__.test.rsession.hostmanage import HostInfo
+from py.__.test2.rsession.master import dispatch_loop, MasterNode
+from py.__.test2.rsession.slave import setup_slave
+from py.__.test2.outcome import ReprOutcome, SerializableOutcome
+from py.__.test2 import repevent
+from py.__.test2.rsession.hostmanage import HostInfo
def setup_module(mod):
# bind an empty config
- mod.tmpdir = tmpdir = py.test.ensuretemp(mod.__name__)
+ mod.tmpdir = tmpdir = py.test2.ensuretemp(mod.__name__)
# to avoid rsyncing
- config = py.test.config._reparse([tmpdir])
+ config = py.test2.config._reparse([tmpdir])
config.option.dist_taskspernode = 10
mod.rootcol = config._getcollector(tmpdir)
@@ -49,7 +49,7 @@
def _getremoteerror(self):
return "blah"
-class Item(py.test.collect.Item):
+class Item(py.test2.collect.Item):
def _get_collector_trail(self):
return (self.name,)
@@ -77,7 +77,7 @@
reportlist = []
mnode = MasterNode(ch, reportlist.append)
cap = py.io.StdCaptureFD()
- py.test.raises(IOError, 'mnode.send(Item("ok"))')
+ py.test2.raises(IOError, 'mnode.send(Item("ok"))')
out, err = cap.reset()
assert out.find("blah") != -1
@@ -118,7 +118,7 @@
class TestSlave:
def setup_class(cls):
- cls.tmpdir = tmpdir = py.test.ensuretemp(cls.__name__)
+ cls.tmpdir = tmpdir = py.test2.ensuretemp(cls.__name__)
cls.pkgpath = pkgpath = tmpdir.join("slavetestpkg")
pkgpath.ensure("__init__.py")
pkgpath.join("test_something.py").write(py.code.Source("""
@@ -128,7 +128,7 @@
def funcfail():
raise AssertionError("hello world")
"""))
- cls.config = py.test.config._reparse([tmpdir])
+ cls.config = py.test2.config._reparse([tmpdir])
assert cls.config.topdir == tmpdir
cls.rootcol = cls.config._getcollector(tmpdir)
@@ -153,7 +153,7 @@
host.gw_remotepath = ''
host.gw = gw
#gw.host.gw = gw
- config = py.test.config._reparse([tmpdir])
+ config = py.test2.config._reparse([tmpdir])
channel = setup_slave(host, config)
mn = MasterNode(channel, simple_report)
return mn
@@ -182,13 +182,13 @@
gw = py.execnet.PopenGateway()
gw.host = HostInfo("localhost")
gw.host.gw = gw
- config = py.test.config._reparse([tmpdir])
+ config = py.test2.config._reparse([tmpdir])
channel = setup_slave(gw.host, config)
mn = MasterNode(channel, reports.append, {})
return mn, gw, channel
mn, gw, channel = open_gw()
- rootcol = py.test.collect.Directory(pkgdir)
+ rootcol = py.test2.collect.Directory(pkgdir)
funchang_item = rootcol._getitembynames(funchang_spec)
mn.send(funchang_item)
mn.send(StopIteration)
Modified: py/branch/event/py/test2/rsession/testing/test_rest.py
==============================================================================
--- py/branch/event/py/test/rsession/testing/test_rest.py (original)
+++ py/branch/event/py/test2/rsession/testing/test_rest.py Wed Jan 30 20:38:14 2008
@@ -3,13 +3,13 @@
"""
import py
-from py.__.test.testing.test_reporter import AbstractTestReporter,\
+from py.__.test2.testing.test_reporter import AbstractTestReporter,\
DummyChannel
-from py.__.test import repevent
-from py.__.test.rsession.rest import RestReporter, NoLinkWriter
+from py.__.test2 import repevent
+from py.__.test2.rsession.rest import RestReporter, NoLinkWriter
from py.__.rest.rst import *
-from py.__.test.rsession.hostmanage import HostInfo
-from py.__.test.outcome import SerializableOutcome
+from py.__.test2.rsession.hostmanage import HostInfo
+from py.__.test2.outcome import SerializableOutcome
class Container(object):
def __init__(self, **args):
@@ -23,7 +23,7 @@
class TestRestUnits(object):
def setup_method(self, method):
- config = py.test.config._reparse(["some_sub"])
+ config = py.test2.config._reparse(["some_sub"])
config.option.verbose = False
self.config = config
hosts = [HostInfo('localhost')]
@@ -79,7 +79,7 @@
"""
def test_report_ItemStart(self):
- class FakeModule(py.test.collect.Module):
+ class FakeModule(py.test2.collect.Module):
def __init__(self, parent):
self.parent = parent
self.fspath = py.path.local('.')
Modified: py/branch/event/py/test2/rsession/testing/test_rsession.py
==============================================================================
--- py/branch/event/py/test/rsession/testing/test_rsession.py (original)
+++ py/branch/event/py/test2/rsession/testing/test_rsession.py Wed Jan 30 20:38:14 2008
@@ -3,11 +3,11 @@
"""
import py
-from py.__.test import repevent
-from py.__.test.rsession.rsession import RSession
-from py.__.test.rsession.hostmanage import HostManager, HostInfo
-from py.__.test.rsession.testing.basetest import BasicRsessionTest
-from py.__.test.rsession.testing.test_hostmanage import DirSetup
+from py.__.test2 import repevent
+from py.__.test2.rsession.rsession import RSession
+from py.__.test2.rsession.hostmanage import HostManager, HostInfo
+from py.__.test2.rsession.testing.basetest import BasicRsessionTest
+from py.__.test2.rsession.testing.test_hostmanage import DirSetup
def setup_module(mod):
mod.pkgdir = py.path.local(py.__file__).dirpath()
@@ -25,7 +25,7 @@
pass
def test_x():
import py
- py.test.skip("aaa")
+ py.test2.skip("aaa")
def test_2():
assert 0
def test_3():
@@ -33,7 +33,7 @@
def test_4(someargs):
pass
"""))
- config = py.test.config._reparse([self.source.join("sub"), '-x'])
+ config = py.test2.config._reparse([self.source.join("sub"), '-x'])
allevents = []
rsession = RSession(config)
rsession.main(allevents.append)
@@ -42,7 +42,7 @@
assert len(testevents) == 3
def test_distribution_rsync_roots_example(self):
- destdir = py.test.ensuretemp("example_dist_destdir")
+ destdir = py.test2.ensuretemp("example_dist_destdir")
subdir = "sub_example_dist"
tmpdir = self.source
tmpdir.ensure(subdir, "conftest.py").write(py.code.Source("""
@@ -66,7 +66,7 @@
# assert py.__file__ != '%s'
""" % (tmpdir.join(subdir), py.__file__)))
destdir.join("py").mksymlinkto(py.path.local(py.__file__).dirpath())
- config = py.test.config._reparse([tmpdir.join(subdir)])
+ config = py.test2.config._reparse([tmpdir.join(subdir)])
assert config.topdir == tmpdir
assert not tmpdir.join("__init__.py").check()
allevents = []
@@ -101,7 +101,7 @@
setup_events = []
teardown_events = []
tmpdir = self.source
- config = py.test.config._reparse([tmpdir])
+ config = py.test2.config._reparse([tmpdir])
hm = HostManager(config, hosts)
nodes = hm.setup_hosts(setup_events.append)
hm.teardown_hosts(teardown_events.append,
@@ -129,7 +129,7 @@
hm = HostManager(self.config, hosts=hosts)
nodes = hm.setup_hosts(allevents.append)
- from py.__.test.testing.test_executor \
+ from py.__.test2.testing.test_executor \
import ItemTestPassing, ItemTestFailing, ItemTestSkipping
itempass = self.getexample("pass")
@@ -175,7 +175,7 @@
assert os.nice(0) == 10
""")
- config = py.test.config._reparse([tmpdir])
+ config = py.test2.config._reparse([tmpdir])
rsession = RSession(config)
rsession.main(allevents.append)
testevents = [x for x in allevents
@@ -184,7 +184,7 @@
assert len(passevents) == 1
def test_rsession_no_disthost():
- tmpdir = py.test.ensuretemp("rsession_no_disthost")
+ tmpdir = py.test2.ensuretemp("rsession_no_disthost")
tmpdir.ensure("conftest.py")
- config = py.test.config._reparse([str(tmpdir), '-d'])
- py.test.raises(SystemExit, "config.initsession()")
+ config = py.test2.config._reparse([str(tmpdir), '-d'])
+ py.test2.raises(SystemExit, "config.initsession()")
Modified: py/branch/event/py/test2/rsession/testing/test_slave.py
==============================================================================
--- py/branch/event/py/test/rsession/testing/test_slave.py (original)
+++ py/branch/event/py/test2/rsession/testing/test_slave.py Wed Jan 30 20:38:14 2008
@@ -1,9 +1,9 @@
""" Testing the slave side node code (in a local way). """
-from py.__.test.rsession.slave import SlaveNode, slave_main, setup
-from py.__.test.outcome import ReprOutcome
+from py.__.test2.rsession.slave import SlaveNode, slave_main, setup
+from py.__.test2.outcome import ReprOutcome
import py, sys
-from py.__.test.rsession.testing.basetest import BasicRsessionTest
+from py.__.test2.rsession.testing.basetest import BasicRsessionTest
modlevel = []
import os
@@ -13,7 +13,7 @@
# ----------------------------------------------------------------------
-from py.__.test.executor import RunExecutor
+from py.__.test2.executor import RunExecutor
class TestSlave(BasicRsessionTest):
def gettestnode(self):
Modified: py/branch/event/py/test2/rsession/testing/test_web.py
==============================================================================
--- py/branch/event/py/test/rsession/testing/test_web.py (original)
+++ py/branch/event/py/test2/rsession/testing/test_web.py Wed Jan 30 20:38:14 2008
@@ -15,14 +15,14 @@
mod.commproxy.USE_MOCHIKIT = False
mod.rpython2javascript = rpython2javascript
mod.commproxy = mod.commproxy
- from py.__.test.rsession.web import TestHandler as _TestHandler
- from py.__.test.rsession.web import MultiQueue
+ from py.__.test2.rsession.web import TestHandler as _TestHandler
+ from py.__.test2.rsession.web import MultiQueue
mod._TestHandler = _TestHandler
mod.MultiQueue = MultiQueue
def test_js_generate():
- from py.__.test.rsession import webjs
- from py.__.test.rsession.web import FUNCTION_LIST, IMPORTED_PYPY
+ from py.__.test2.rsession import webjs
+ from py.__.test2.rsession.web import FUNCTION_LIST, IMPORTED_PYPY
source = rpython2javascript(webjs, FUNCTION_LIST, use_pdb=False)
assert source
@@ -36,7 +36,7 @@
assert h.parse_args('foo=bar%20baz') == {'foo': 'bar baz'}
assert h.parse_args('foo%20bar=baz') == {'foo bar': 'baz'}
assert h.parse_args('foo=bar%baz') == {'foo': 'bar\xbaz'}
- py.test.raises(ValueError, 'h.parse_args("foo")')
+ py.test2.raises(ValueError, 'h.parse_args("foo")')
class TestMultiQueue(object):
def test_get_one_sessid(self):
Modified: py/branch/event/py/test2/rsession/testing/test_webjs.py
==============================================================================
--- py/branch/event/py/test/rsession/testing/test_webjs.py (original)
+++ py/branch/event/py/test2/rsession/testing/test_webjs.py Wed Jan 30 20:38:14 2008
@@ -12,8 +12,8 @@
mod.dom = dom
mod.schedule_callbacks = schedule_callbacks
- from py.__.test.rsession import webjs
- from py.__.test.rsession.web import exported_methods
+ from py.__.test2.rsession import webjs
+ from py.__.test2.rsession.web import exported_methods
mod.webjs = webjs
mod.exported_methods = exported_methods
mod.here = py.magic.autopath().dirpath()
@@ -28,8 +28,8 @@
mod.dom = dom
dom.window = dom.Window(html)
dom.document = dom.window.document
- from py.__.test.rsession import webjs
- from py.__.test.rsession.web import exported_methods
+ from py.__.test2.rsession import webjs
+ from py.__.test2.rsession.web import exported_methods
mod.webjs = webjs
mod.exported_methods = exported_methods
Modified: py/branch/event/py/test2/rsession/web.py
==============================================================================
--- py/branch/event/py/test/rsession/web.py (original)
+++ py/branch/event/py/test2/rsession/web.py Wed Jan 30 20:38:14 2008
@@ -14,10 +14,10 @@
import socket
import py
-from py.__.test.rsession.rsession import RSession
-from py.__.test import repevent
-from py.__.test import collect
-from py.__.test.rsession.webdata import json
+from py.__.test2.rsession.rsession import RSession
+from py.__.test2 import repevent
+from py.__.test2 import collect
+from py.__.test2.rsession.webdata import json
DATADIR = py.path.local(__file__).dirpath("webdata")
FUNCTION_LIST = ["main", "show_skip", "show_traceback", "show_info", "hide_info",
@@ -59,7 +59,7 @@
return d
class MultiQueue(object):
- """ a tailor-made queue (internally using Queue) for py.test.rsession.web
+ """ a tailor-made queue (internally using Queue) for py.test2.rsession.web
API-wise the main difference is that the get() method gets a sessid
argument, which is used to determine what data to feed to the client
@@ -290,7 +290,7 @@
self.pending_events.put(event)
def report_ItemStart(self, event):
- if isinstance(event.item, py.test.collect.Module):
+ if isinstance(event.item, py.test2.collect.Module):
self.pending_events.put(event)
def report_unknown(self, event):
@@ -406,7 +406,7 @@
web_name = py.path.local(__file__).dirpath().join("webjs.py")
if IMPORTED_PYPY and web_name.mtime() > js_name.mtime() or \
(not js_name.check()):
- from py.__.test.rsession import webjs
+ from py.__.test2.rsession import webjs
javascript_source = rpython2javascript(webjs,
FUNCTION_LIST, use_pdb=False)
Modified: py/branch/event/py/test2/rsession/webjs.py
==============================================================================
--- py/branch/event/py/test/rsession/webjs.py (original)
+++ py/branch/event/py/test2/rsession/webjs.py Wed Jan 30 20:38:14 2008
@@ -1,14 +1,14 @@
-""" javascript source for py.test distributed
+""" javascript source for py.test2 distributed
"""
import py
-from py.__.test.rsession.web import exported_methods
+from py.__.test2.rsession.web import exported_methods
try:
from pypy.translator.js.modules import dom
from pypy.translator.js.helper import __show_traceback
except ImportError:
- py.test.skip("PyPy not found")
+ py.test2.skip("PyPy not found")
def create_elem(s):
return dom.document.createElement(s)
Modified: py/branch/event/py/test2/session.py
==============================================================================
--- py/branch/event/py/test/session.py (original)
+++ py/branch/event/py/test2/session.py Wed Jan 30 20:38:14 2008
@@ -1,11 +1,11 @@
import py
import sys
-from py.__.test.outcome import Outcome, Failed, Passed, Skipped
-from py.__.test.reporter import choose_reporter, TestReporter
-from py.__.test import repevent
-from py.__.test.outcome import SerializableOutcome, ReprOutcome
-from py.__.test.reporter import LocalReporter
-from py.__.test.executor import RunExecutor, BoxExecutor
+from py.__.test2.outcome import Outcome, Failed, Passed, Skipped
+from py.__.test2.reporter import choose_reporter, TestReporter
+from py.__.test2 import repevent
+from py.__.test2.outcome import SerializableOutcome, ReprOutcome
+from py.__.test2.reporter import LocalReporter
+from py.__.test2.executor import RunExecutor, BoxExecutor
""" The session implementation - reporter version:
@@ -22,7 +22,7 @@
GeneratorExit = StopIteration # I think
def itemgen(session, colitems, reporter, keyword=None):
- stopitems = py.test.collect.Item # XXX should be generator here as well
+ stopitems = py.test2.collect.Item # XXX should be generator here as well
while 1:
if not colitems:
break
@@ -110,7 +110,7 @@
def footer(self, colitems):
""" teardown any resources after a test run. """
- py.test.collect.Function._state.teardown_all()
+ py.test2.collect.Function._state.teardown_all()
if not self.config.option.nomagic:
py.magic.revoke(assertion=1)
self.reporter(repevent.TestFinished())
Modified: py/branch/event/py/test2/terminal/remote.py
==============================================================================
--- py/branch/event/py/test/terminal/remote.py (original)
+++ py/branch/event/py/test2/terminal/remote.py Wed Jan 30 20:38:14 2008
@@ -1,8 +1,8 @@
from __future__ import generators
import py
-from py.__.test.session import Session
-from py.__.test.terminal.out import getout
-from py.__.test.outcome import Failed, Passed, Skipped
+from py.__.test2.session import Session
+from py.__.test2.terminal.out import getout
+from py.__.test2.outcome import Failed, Passed, Skipped
def checkpyfilechange(rootdir, statcache={}):
""" wait until project files are changed. """
@@ -35,9 +35,9 @@
for rootpath, names in failures:
root = py.path.local(rootpath)
if root.check(dir=1):
- current = py.test.collect.Directory(root).Directory(root)
+ current = py.test2.collect.Directory(root).Directory(root)
elif root.check(file=1):
- current = py.test.collect.Module(root).Module(root)
+ current = py.test2.collect.Module(root).Module(root)
# root is fspath of names[0] -> pop names[0]
# slicing works with empty lists
names = names[1:]
@@ -99,7 +99,7 @@
def run_remote_session(self, failures):
gw, topdir = self._initslavegateway()
channel = gw.remote_exec("""
- from py.__.test.terminal.remote import slaverun_TerminalSession
+ from py.__.test2.terminal.remote import slaverun_TerminalSession
slaverun_TerminalSession(channel)
""", stdout=self.out, stderr=self.out)
try:
@@ -123,7 +123,7 @@
print "SLAVE: initializing ..."
topdir, repr, failures = channel.receive()
print "SLAVE: received configuration, using topdir:", topdir
- config = py.test.config
+ config = py.test2.config
config._initdirect(topdir, repr, failures)
config.option.session = None
config.option.looponfailing = False
Modified: py/branch/event/py/test2/testing/setupdata.py
==============================================================================
--- py/branch/event/py/test/testing/setupdata.py (original)
+++ py/branch/event/py/test2/testing/setupdata.py Wed Jan 30 20:38:14 2008
@@ -2,10 +2,10 @@
def setup_module(mod):
mod.datadir = setupdatadir()
- mod.tmpdir = py.test.ensuretemp(mod.__name__)
+ mod.tmpdir = py.test2.ensuretemp(mod.__name__)
def setupdatadir():
- datadir = py.test.ensuretemp("datadir")
+ datadir = py.test2.ensuretemp("datadir")
names = [x.basename for x in datadir.listdir()]
for name, content in namecontent:
if name not in names:
@@ -55,7 +55,7 @@
def test_explicit_bad_repr(self):
t = BrokenRepr1()
- py.test.raises(Exception, 'repr(t)')
+ py.test2.raises(Exception, 'repr(t)')
def test_implicit_bad_repr1(self):
t = BrokenRepr1()
Modified: py/branch/event/py/test2/testing/test_boxing.py
==============================================================================
--- py/branch/event/py/test/testing/test_boxing.py (original)
+++ py/branch/event/py/test2/testing/test_boxing.py Wed Jan 30 20:38:14 2008
@@ -7,12 +7,12 @@
if sys.platform == 'win32':
py.test.skip("rsession is unsupported on Windows.")
-from py.__.test.box import Box
-from py.__.test.testing import example2
+from py.__.test2.box import Box
+from py.__.test2.testing import example2
def setup_module(mod):
- tmpdir = py.test.ensuretemp("boxtests")
- mod.config = py.test.config._reparse([tmpdir])
+ tmpdir = py.test2.ensuretemp("boxtests")
+ mod.config = py.test2.config._reparse([tmpdir])
def test_basic_boxing():
# XXX: because we do not have option transfer
Modified: py/branch/event/py/test2/testing/test_collect.py
==============================================================================
--- py/branch/event/py/test/testing/test_collect.py (original)
+++ py/branch/event/py/test2/testing/test_collect.py Wed Jan 30 20:38:14 2008
@@ -1,9 +1,9 @@
from __future__ import generators
import py
from setupdata import setupdatadir
-from py.__.test.outcome import Skipped, Failed, Passed, Outcome
-from py.__.test.terminal.out import getout
-from py.__.test.repevent import ReceivedItemOutcome
+from py.__.test2.outcome import Skipped, Failed, Passed, Outcome
+from py.__.test2.terminal.out import getout
+from py.__.test2.repevent import ReceivedItemOutcome
def getpassed(all):
outcomes = [i.outcome for i in all if isinstance(i, ReceivedItemOutcome)]
@@ -12,16 +12,16 @@
def setup_module(mod):
mod.datadir = setupdatadir()
- mod.tmpdir = py.test.ensuretemp('test_collect')
+ mod.tmpdir = py.test2.ensuretemp('test_collect')
def test_failing_import_execfile():
dest = datadir / 'failingimport.py'
- col = py.test.collect.Module(dest)
- py.test.raises(ImportError, col.run)
- py.test.raises(ImportError, col.run)
+ col = py.test2.collect.Module(dest)
+ py.test2.raises(ImportError, col.run)
+ py.test2.raises(ImportError, col.run)
def test_collect_listnames_and_back():
- col1 = py.test.collect.Directory(datadir.dirpath())
+ col1 = py.test2.collect.Directory(datadir.dirpath())
col2 = col1.join(datadir.basename)
col3 = col2.join('filetest.py')
l = col3.listnames()
@@ -35,26 +35,26 @@
def test_finds_tests():
fn = datadir / 'filetest.py'
- col = py.test.collect.Module(fn)
+ col = py.test2.collect.Module(fn)
l = col.run()
assert len(l) == 2
assert l[0] == 'test_one'
assert l[1] == 'TestClass'
def test_found_certain_testfiles():
- tmp = py.test.ensuretemp("found_certain_testfiles")
+ tmp = py.test2.ensuretemp("found_certain_testfiles")
tmp.ensure('test_found.py')
tmp.ensure('found_test.py')
- colitem = py.test.collect.Directory(tmp)
- items = list(colitem._tryiter(py.test.collect.Module))
+ colitem = py.test2.collect.Directory(tmp)
+ items = list(colitem._tryiter(py.test2.collect.Module))
assert len(items) == 2
items = [item.name for item in items]
assert 'test_found.py' in items
assert 'found_test.py' in items
def test_ignored_certain_directories():
- tmp = py.test.ensuretemp("ignore_certain_directories")
+ tmp = py.test2.ensuretemp("ignore_certain_directories")
tmp.ensure("_darcs", 'test_notfound.py')
tmp.ensure("CVS", 'test_notfound.py')
tmp.ensure("{arch}", 'test_notfound.py')
@@ -63,45 +63,45 @@
tmp.ensure("normal", 'test_found.py')
tmp.ensure('test_found.py')
- colitem = py.test.collect.Directory(tmp)
- items = list(colitem._tryiter(py.test.collect.Module))
+ colitem = py.test2.collect.Directory(tmp)
+ items = list(colitem._tryiter(py.test2.collect.Module))
assert len(items) == 2
for item in items:
assert item.name == 'test_found.py'
def test_failing_import_directory():
- class MyDirectory(py.test.collect.Directory):
+ class MyDirectory(py.test2.collect.Directory):
def filefilter(self, p):
return p.check(fnmatch='testspecial*.py')
mydir = MyDirectory(datadir)
l = mydir.run()
assert len(l) == 1
item = mydir.join(l[0])
- assert isinstance(item, py.test.collect.Module)
- py.test.raises(ImportError, item.run)
+ assert isinstance(item, py.test2.collect.Module)
+ py.test2.raises(ImportError, item.run)
def test_module_file_not_found():
fn = datadir.join('nada','no')
- col = py.test.collect.Module(fn)
- py.test.raises(py.error.ENOENT, col.run)
+ col = py.test2.collect.Module(fn)
+ py.test2.raises(py.error.ENOENT, col.run)
def test_syntax_error_in_module():
- p = py.test.ensuretemp("syntaxerror1").join('syntax_error.py')
+ p = py.test2.ensuretemp("syntaxerror1").join('syntax_error.py')
p.write("\nthis is really not python\n")
modpath = datadir.join('syntax_error.py')
- col = py.test.collect.Module(modpath)
- py.test.raises(SyntaxError, col.run)
+ col = py.test2.collect.Module(modpath)
+ py.test2.raises(SyntaxError, col.run)
def test_disabled_class():
- col = py.test.collect.Module(datadir.join('disabled.py'))
+ col = py.test2.collect.Module(datadir.join('disabled.py'))
l = col.run()
assert len(l) == 1
colitem = col.join(l[0])
- assert isinstance(colitem, py.test.collect.Class)
+ assert isinstance(colitem, py.test2.collect.Class)
assert not colitem.run()
def test_disabled_module():
- col = py.test.collect.Module(datadir.join('disabled_module.py'))
+ col = py.test2.collect.Module(datadir.join('disabled_module.py'))
l = col.run()
assert len(l) == 0
@@ -112,7 +112,7 @@
#class TestWithCustomItem:
-# class Item(py.test.collect.Item):
+# class Item(py.test2.collect.Item):
# flag = []
# def execute(self, target, *args):
# self.flag.append(42)
@@ -139,18 +139,18 @@
yield func1, 17, 3*5
yield func1, 42, 6*7
"""))
- col = py.test.collect.Module(tfile)
+ col = py.test2.collect.Module(tfile)
l = col.run()
assert len(l) == 2
l = col.multijoin(l)
generator = l[0]
- assert isinstance(generator, py.test.collect.Generator)
+ assert isinstance(generator, py.test2.collect.Generator)
l2 = generator.run()
assert len(l2) == 2
l2 = generator.multijoin(l2)
- assert isinstance(l2[0], py.test.collect.Function)
- assert isinstance(l2[1], py.test.collect.Function)
+ assert isinstance(l2[0], py.test2.collect.Function)
+ assert isinstance(l2[1], py.test2.collect.Function)
assert l2[0].name == '[0]'
assert l2[1].name == '[1]'
@@ -161,12 +161,12 @@
classlist = l[1].multijoin(classlist)
cls = classlist[0]
generator = cls.join(cls.run()[0])
- assert isinstance(generator, py.test.collect.Generator)
+ assert isinstance(generator, py.test2.collect.Generator)
l2 = generator.run()
assert len(l2) == 2
l2 = generator.multijoin(l2)
- assert isinstance(l2[0], py.test.collect.Function)
- assert isinstance(l2[1], py.test.collect.Function)
+ assert isinstance(l2[0], py.test2.collect.Function)
+ assert isinstance(l2[1], py.test2.collect.Function)
assert l2[0].name == '[0]'
assert l2[1].name == '[1]'
@@ -174,9 +174,9 @@
o = tmpdir.ensure('customconfigtest', dir=1)
o.ensure('conftest.py').write("""if 1:
import py
- class MyFunction(py.test.collect.Function):
+ class MyFunction(py.test2.collect.Function):
pass
- class Directory(py.test.collect.Directory):
+ class Directory(py.test2.collect.Directory):
def filefilter(self, fspath):
return fspath.check(basestarts='check_', ext='.py')
class myfuncmixin:
@@ -184,10 +184,10 @@
def funcnamefilter(self, name):
return name.startswith('check_')
- class Module(myfuncmixin, py.test.collect.Module):
+ class Module(myfuncmixin, py.test2.collect.Module):
def classnamefilter(self, name):
return name.startswith('CustomTestClass')
- class Instance(myfuncmixin, py.test.collect.Instance):
+ class Instance(myfuncmixin, py.test2.collect.Instance):
pass
""")
checkfile = o.ensure('somedir', 'check_something.py')
@@ -200,16 +200,16 @@
""")
for x in (o, checkfile, checkfile.dirpath()):
- config = py.test.config._reparse([x])
+ config = py.test2.config._reparse([x])
#print "checking that %s returns custom items" % (x,)
col = config._getcollector(x)
- assert len(list(col._tryiter(py.test.collect.Item))) == 2
+ assert len(list(col._tryiter(py.test2.collect.Item))) == 2
#assert items[1].__class__.__name__ == 'MyFunction'
# test that running a session works from the directories
old = o.chdir()
try:
- config = py.test.config._reparse([])
+ config = py.test2.config._reparse([])
all = []
session = config._getsessionclass()(config)
session.main(all.append)
@@ -219,7 +219,7 @@
old.chdir()
# test that running the file directly works
- config = py.test.config._reparse([str(checkfile)])
+ config = py.test2.config._reparse([str(checkfile)])
all = []
session = config._getsessionclass()(config)
session.main(all.append)
@@ -230,11 +230,11 @@
o = tmpdir.ensure('customconfigtest_nonpython', dir=1)
o.ensure('conftest.py').write("""if 1:
import py
- class CustomItem(py.test.collect.Item):
+ class CustomItem(py.test2.collect.Item):
def run(self):
pass
- class Directory(py.test.collect.Directory):
+ class Directory(py.test2.collect.Directory):
def filefilter(self, fspath):
return fspath.check(basestarts='check_', ext='.txt')
def join(self, name):
@@ -248,15 +248,15 @@
for x in (o, checkfile, checkfile.dirpath()):
print "checking that %s returns custom items" % (x,)
- config = py.test.config._reparse([x])
+ config = py.test2.config._reparse([x])
col = config._getcollector(x)
- assert len(list(col._tryiter(py.test.collect.Item))) == 1
+ assert len(list(col._tryiter(py.test2.collect.Item))) == 1
#assert items[1].__class__.__name__ == 'MyFunction'
# test that running a session works from the directories
old = o.chdir()
try:
- config = py.test.config._reparse([])
+ config = py.test2.config._reparse([])
all = []
session = config._getsessionclass()(config)
session.main(all.append)
@@ -266,7 +266,7 @@
old.chdir()
# test that running the file directly works
- config = py.test.config._reparse([str(checkfile)])
+ config = py.test2.config._reparse([str(checkfile)])
all = []
session = config._getsessionclass()(config)
session.main(all.append)
@@ -292,7 +292,7 @@
yield list_append, i
yield assert_order_of_execution
"""))
- config = py.test.config._reparse([o])
+ config = py.test2.config._reparse([o])
all = []
session = config.initsession()
session.main(all.append)
@@ -325,7 +325,7 @@
yield list_append_2
yield assert_order_of_execution
"""))
- config = py.test.config._reparse([o])
+ config = py.test2.config._reparse([o])
all = []
session = config.initsession()
session.main(all.append)
@@ -341,60 +341,60 @@
old = conf.option.forcegen
try:
conf.option.forcegen = 1
- col = py.test.collect.Directory(rootdir)
- x = list(col._tryiter(yieldtype=py.test.collect.Function))
+ col = py.test2.collect.Directory(rootdir)
+ x = list(col._tryiter(yieldtype=py.test2.collect.Function))
finally:
conf.option.forcegen = old
def test__tryiter_ignores_skips():
- tmp = py.test.ensuretemp("_tryiterskip")
+ tmp = py.test2.ensuretemp("_tryiterskip")
tmp.ensure("subdir", "conftest.py").write(py.code.Source("""
import py
- class Directory(py.test.collect.Directory):
+ class Directory(py.test2.collect.Directory):
def run(self):
py.test.skip("intentional")
"""))
- col = py.test.collect.Directory(tmp)
+ col = py.test2.collect.Directory(tmp)
try:
list(col._tryiter())
except KeyboardInterrupt:
raise
except:
exc = py.code.ExceptionInfo()
- py.test.fail("should not have raised: %s" %(exc,))
+ py.test2.fail("should not have raised: %s" %(exc,))
def test__tryiter_ignores_failing_collectors():
- tmp = py.test.ensuretemp("_tryiterfailing")
+ tmp = py.test2.ensuretemp("_tryiterfailing")
tmp.ensure("subdir", "conftest.py").write(py.code.Source("""
bla bla bla
"""))
- col = py.test.collect.Directory(tmp)
+ col = py.test2.collect.Directory(tmp)
try:
list(col._tryiter())
except KeyboardInterrupt:
raise
except:
exc = py.code.ExceptionInfo()
- py.test.fail("should not have raised: %s" %(exc,))
+ py.test2.fail("should not have raised: %s" %(exc,))
l = []
def test_tryiter_handles_keyboardinterrupt():
- tmp = py.test.ensuretemp("tryiterkeyboard")
+ tmp = py.test2.ensuretemp("tryiterkeyboard")
tmp.ensure("subdir", "conftest.py").write(py.code.Source("""
raise KeyboardInterrupt()
"""))
- col = py.test.collect.Directory(tmp)
- py.test.raises(KeyboardInterrupt, list, col._tryiter())
+ col = py.test2.collect.Directory(tmp)
+ py.test2.raises(KeyboardInterrupt, list, col._tryiter())
def test_check_random_inequality():
- tmp = py.test.ensuretemp("ineq")
+ tmp = py.test2.ensuretemp("ineq")
tmp.ensure("test_x.py").write(py.code.Source("""def test_one():
pass
"""))
- col = py.test.collect.Directory(tmp)
+ col = py.test2.collect.Directory(tmp)
fn = col._tryiter().next()
assert fn != 3
assert fn != col
@@ -403,7 +403,7 @@
assert col != fn
def test_check_generator_collect_problems():
- tmp = py.test.ensuretemp("gener_coll")
+ tmp = py.test2.ensuretemp("gener_coll")
tmp.ensure("test_one.py").write(py.code.Source("""
def setup_module(mod):
mod.x = [1,2,3]
@@ -416,12 +416,12 @@
yield check, i
"""))
tmp.ensure("__init__.py")
- col = py.test.collect.Module(tmp.join("test_one.py"))
+ col = py.test2.collect.Module(tmp.join("test_one.py"))
assert len(col.join('test_one').run()) == 3
def test_generator_setup_invoked_twice():
py.test.skip("Test for generators not invoking setup, needs thinking")
- tmp = py.test.ensuretemp("generator_setup_invoke")
+ tmp = py.test2.ensuretemp("generator_setup_invoke")
tmp.ensure("test_one.py").write(py.code.Source("""
def setup_module(mod):
mod.x = []
@@ -433,12 +433,12 @@
yield lambda: None
"""))
tmp.ensure("__init__.py")
- col = py.test.collect.Module(tmp.join("test_one.py"))
+ col = py.test2.collect.Module(tmp.join("test_one.py"))
l = list(col._tryiter())
assert not hasattr(col.obj, 'x')
def test_check_collect_hashes():
- tmp = py.test.ensuretemp("check_collect_hashes")
+ tmp = py.test2.ensuretemp("check_collect_hashes")
tmp.ensure("test_one.py").write(py.code.Source("""
def test_1():
pass
@@ -454,7 +454,7 @@
pass
"""))
tmp.ensure("__init__.py")
- col = py.test.collect.Directory(tmp)
+ col = py.test2.collect.Directory(tmp)
l = list(col._tryiter())
assert len(l) == 4
for numi, i in enumerate(l):
@@ -465,7 +465,7 @@
def test_check_directory_ordered():
- tmpdir = py.test.ensuretemp("test_check_directory_ordered")
+ tmpdir = py.test2.ensuretemp("test_check_directory_ordered")
fnames = []
for i in range(9, -1, -1):
x = tmpdir.ensure("xdir%d" %(i, ), dir=1)
@@ -476,7 +476,7 @@
fnames.sort()
tmpdir.ensure('adir', dir=1)
fnames.insert(10, 'adir')
- col = py.test.collect.Directory(tmpdir)
+ col = py.test2.collect.Directory(tmpdir)
names = col.run()
assert names == fnames
Modified: py/branch/event/py/test2/testing/test_collectonly.py
==============================================================================
--- py/branch/event/py/test/testing/test_collectonly.py (original)
+++ py/branch/event/py/test2/testing/test_collectonly.py Wed Jan 30 20:38:14 2008
@@ -3,7 +3,7 @@
class TestCollectonly:
def setup_class(cls):
- tmp = py.test.ensuretemp('itemgentest')
+ tmp = py.test2.ensuretemp('itemgentest')
tmp.ensure("__init__.py")
tmp.ensure("test_one.py").write(py.code.Source("""
def test_one():
@@ -24,7 +24,7 @@
cls.tmp = tmp
def test_collectonly(self):
- config = py.test.config._reparse([self.tmp, '--collectonly'])
+ config = py.test2.config._reparse([self.tmp, '--collectonly'])
session = config.initsession()
# test it all in once
cap = py.io.StdCaptureFD()
Modified: py/branch/event/py/test2/testing/test_compat.py
==============================================================================
--- py/branch/event/py/test/testing/test_compat.py (original)
+++ py/branch/event/py/test2/testing/test_compat.py Wed Jan 30 20:38:14 2008
@@ -1,7 +1,7 @@
from __future__ import generators
import py
-from py.__.test.compat import TestCase
-from py.__.test.outcome import Failed
+from py.__.test2.compat import TestCase
+from py.__.test2.outcome import Failed
class TestCompatTestCaseSetupSemantics(TestCase):
globlist = []
Modified: py/branch/event/py/test2/testing/test_config.py
==============================================================================
--- py/branch/event/py/test/testing/test_config.py (original)
+++ py/branch/event/py/test2/testing/test_config.py Wed Jan 30 20:38:14 2008
@@ -1,22 +1,22 @@
from __future__ import generators
import py
-from py.__.test.config import gettopdir
+from py.__.test2.config import gettopdir
def test_tmpdir():
- d1 = py.test.ensuretemp('hello')
- d2 = py.test.ensuretemp('hello')
+ d1 = py.test2.ensuretemp('hello')
+ d2 = py.test2.ensuretemp('hello')
assert d1 == d2
assert d1.check(dir=1)
def test_config_cmdline_options():
- o = py.test.ensuretemp('configoptions')
+ o = py.test2.ensuretemp('configoptions')
o.ensure("conftest.py").write(py.code.Source("""
import py
def _callback(option, opt_str, value, parser, *args, **kwargs):
option.tdest = True
- Option = py.test.config.Option
- option = py.test.config.addoptions("testing group",
+ Option = py.test2.config.Option
+ option = py.test2.config.addoptions("testing group",
Option('-G', '--glong', action="store", default=42,
type="int", dest="gdest", help="g value."),
# XXX note: special case, option without a destination
@@ -26,53 +26,53 @@
"""))
old = o.chdir()
try:
- config = py.test.config._reparse(['-G', '17'])
+ config = py.test2.config._reparse(['-G', '17'])
finally:
old.chdir()
assert config.option.gdest == 17
def test_config_cmdline_options_only_lowercase():
- o = py.test.ensuretemp('test_config_cmdline_options_only_lowercase')
+ o = py.test2.ensuretemp('test_config_cmdline_options_only_lowercase')
o.ensure("conftest.py").write(py.code.Source("""
import py
- Option = py.test.config.Option
- options = py.test.config.addoptions("testing group",
+ Option = py.test2.config.Option
+ options = py.test2.config.addoptions("testing group",
Option('-g', '--glong', action="store", default=42,
type="int", dest="gdest", help="g value."),
)
"""))
old = o.chdir()
try:
- py.test.raises(ValueError, """
- py.test.config._reparse(['-g', '17'])
+ py.test2.raises(ValueError, """
+ py.test2.config._reparse(['-g', '17'])
""")
finally:
old.chdir()
def test_parsing_again_fails():
- dir = py.test.ensuretemp("parsing_again_fails")
- config = py.test.config._reparse([str(dir)])
- py.test.raises(AssertionError, "config.parse([])")
+ dir = py.test2.ensuretemp("parsing_again_fails")
+ config = py.test2.config._reparse([str(dir)])
+ py.test2.raises(AssertionError, "config.parse([])")
def test_config_getvalue_honours_conftest():
- o = py.test.ensuretemp('testconfigget')
+ o = py.test2.ensuretemp('testconfigget')
o.ensure("conftest.py").write("x=1")
o.ensure("sub", "conftest.py").write("x=2 ; y = 3")
- config = py.test.config._reparse([str(o)])
+ config = py.test2.config._reparse([str(o)])
assert config.getvalue("x") == 1
assert config.getvalue("x", o.join('sub')) == 2
- py.test.raises(KeyError, "config.getvalue('y')")
- config = py.test.config._reparse([str(o.join('sub'))])
+ py.test2.raises(KeyError, "config.getvalue('y')")
+ config = py.test2.config._reparse([str(o.join('sub'))])
assert config.getvalue("x") == 2
assert config.getvalue("y") == 3
assert config.getvalue("x", o) == 1
- py.test.raises(KeyError, 'config.getvalue("y", o)')
+ py.test2.raises(KeyError, 'config.getvalue("y", o)')
def test_siblingconftest_fails_maybe():
- from py.__.test import config
+ from py.__.test2 import config
cfg = config.Config()
- o = py.test.ensuretemp('siblingconftest')
+ o = py.test2.ensuretemp('siblingconftest')
o.ensure("__init__.py")
o.ensure("sister1", "__init__.py")
o.ensure("sister1", "conftest.py").write(py.code.Source("""
@@ -96,23 +96,23 @@
old.chdir()
def test_config_overwrite():
- o = py.test.ensuretemp('testconfigget')
+ o = py.test2.ensuretemp('testconfigget')
o.ensure("conftest.py").write("x=1")
- config = py.test.config._reparse([str(o)])
+ config = py.test2.config._reparse([str(o)])
assert config.getvalue('x') == 1
config.option.x = 2
assert config.getvalue('x') == 2
- config = py.test.config._reparse([str(o)])
+ config = py.test2.config._reparse([str(o)])
assert config.getvalue('x') == 1
def test_gettopdir():
- tmp = py.test.ensuretemp("topdir")
+ tmp = py.test2.ensuretemp("topdir")
assert gettopdir([tmp]) == tmp
topdir =gettopdir([tmp.join("hello"), tmp.join("world")])
assert topdir == tmp
def test_gettopdir_pypkg():
- tmp = py.test.ensuretemp("topdir2")
+ tmp = py.test2.ensuretemp("topdir2")
a = tmp.ensure('a', dir=1)
b = tmp.ensure('a', 'b', '__init__.py')
c = tmp.ensure('a', 'b', 'c.py')
@@ -122,19 +122,19 @@
def test_config_init_direct():
- tmp = py.test.ensuretemp("_initdirect")
+ tmp = py.test2.ensuretemp("_initdirect")
tmp.ensure("__init__.py")
tmp.ensure("conftest.py").write("x=1 ; y=2")
hello = tmp.ensure("test_hello.py")
- config = py.test.config._reparse([hello])
+ config = py.test2.config._reparse([hello])
repr = config._makerepr(conftestnames=['x', 'y'])
- config2 = py.test.config._reparse([tmp.dirpath()])
+ config2 = py.test2.config._reparse([tmp.dirpath()])
config2._initialized = False # we have to do that from tests
config2._initdirect(topdir=tmp.dirpath(), repr=repr)
for col1, col2 in zip(config.getcolitems(), config2.getcolitems()):
assert col1.fspath == col2.fspath
- py.test.raises(AssertionError, "config2._initdirect(None, None)")
- from py.__.test.config import Config
+ py.test2.raises(AssertionError, "config2._initdirect(None, None)")
+ from py.__.test2.config import Config
config3 = Config()
config3._initdirect(topdir=tmp.dirpath(), repr=repr,
coltrails=[(tmp.basename, (hello.basename,))])
@@ -148,107 +148,107 @@
assert col.parent.parent is None
def test_config_make_and__mergerepr():
- tmp = py.test.ensuretemp("reprconfig1")
+ tmp = py.test2.ensuretemp("reprconfig1")
tmp.ensure("__init__.py")
tmp.ensure("conftest.py").write("x=1")
- config = py.test.config._reparse([tmp])
+ config = py.test2.config._reparse([tmp])
repr = config._makerepr(conftestnames=['x'])
config.option.verbose = 42
repr2 = config._makerepr(conftestnames=[], optnames=['verbose'])
- config = py.test.config._reparse([tmp.dirpath()])
- py.test.raises(KeyError, "config.getvalue('x')")
+ config = py.test2.config._reparse([tmp.dirpath()])
+ py.test2.raises(KeyError, "config.getvalue('x')")
config._mergerepr(repr)
assert config.getvalue('x') == 1
config._mergerepr(repr2)
assert config.option.verbose == 42
def test_config_marshability():
- tmp = py.test.ensuretemp("configmarshal")
+ tmp = py.test2.ensuretemp("configmarshal")
tmp.ensure("__init__.py")
tmp.ensure("conftest.py").write("a = object()")
- config = py.test.config._reparse([tmp])
- py.test.raises(ValueError, "config._makerepr(conftestnames=['a'])")
+ config = py.test2.config._reparse([tmp])
+ py.test2.raises(ValueError, "config._makerepr(conftestnames=['a'])")
config.option.hello = lambda x: None
- py.test.raises(ValueError, "config._makerepr(conftestnames=[])")
+ py.test2.raises(ValueError, "config._makerepr(conftestnames=[])")
config._makerepr(conftestnames=[], optnames=[])
def test_config_rconfig():
- tmp = py.test.ensuretemp("rconfigopt")
+ tmp = py.test2.ensuretemp("rconfigopt")
tmp.ensure("__init__.py")
tmp.ensure("conftest.py").write(py.code.Source("""
import py
- Option = py.test.config.Option
- option = py.test.config.addoptions("testing group",
+ Option = py.test2.config.Option
+ option = py.test2.config.addoptions("testing group",
Option('-G', '--glong', action="store", default=42,
type="int", dest="gdest", help="g value."))
"""))
- config = py.test.config._reparse([tmp, "-G", "11"])
+ config = py.test2.config._reparse([tmp, "-G", "11"])
assert config.option.gdest == 11
repr = config._makerepr(conftestnames=[])
- config = py.test.config._reparse([tmp.dirpath()])
- py.test.raises(AttributeError, "config.option.gdest")
+ config = py.test2.config._reparse([tmp.dirpath()])
+ py.test2.raises(AttributeError, "config.option.gdest")
config._mergerepr(repr)
assert config.option.gdest == 11
class TestSessionAndOptions:
def setup_class(cls):
- cls.tmproot = py.test.ensuretemp(cls.__name__)
+ cls.tmproot = py.test2.ensuretemp(cls.__name__)
def setup_method(self, method):
self.tmpdir = self.tmproot.ensure(method.__name__, dir=1)
def test_sessionname_default(self):
- config = py.test.config._reparse([self.tmpdir])
+ config = py.test2.config._reparse([self.tmpdir])
assert config._getsessionname() == 'Session'
def test_sessionname_dist(self):
- config = py.test.config._reparse([self.tmpdir, '--dist'])
+ config = py.test2.config._reparse([self.tmpdir, '--dist'])
assert config._getsessionname() == 'RSession'
def test_implied_lsession(self):
#optnames = 'startserver runbrowser apigen=x rest boxed'.split()
#for x in optnames:
- # config = py.test.config._reparse([self.tmpdir, '--%s' % x])
+ # config = py.test2.config._reparse([self.tmpdir, '--%s' % x])
# assert config._getsessionname() == 'LSession'
for x in 'startserver runbrowser rest'.split():
- config = py.test.config._reparse([self.tmpdir, '--dist', '--%s' % x])
+ config = py.test2.config._reparse([self.tmpdir, '--dist', '--%s' % x])
assert config._getsessionname() == 'RSession'
def test_implied_different_sessions(self):
- config = py.test.config._reparse([self.tmpdir, '--looponfailing'])
+ config = py.test2.config._reparse([self.tmpdir, '--looponfailing'])
assert config._getsessionname() == 'RemoteTerminalSession'
- config = py.test.config._reparse([self.tmpdir, '--exec=x'])
+ config = py.test2.config._reparse([self.tmpdir, '--exec=x'])
assert config._getsessionname() == 'RemoteTerminalSession'
- config = py.test.config._reparse([self.tmpdir, '--dist', '--exec=x'])
+ config = py.test2.config._reparse([self.tmpdir, '--dist', '--exec=x'])
assert config._getsessionname() == 'RSession'
- config = py.test.config._reparse([self.tmpdir, '--collectonly'])
+ config = py.test2.config._reparse([self.tmpdir, '--collectonly'])
assert config._getsessionname() == 'CollectSession'
def test_sessionname_lookup_custom(self):
self.tmpdir.join("conftest.py").write(py.code.Source("""
- from py.__.test.session import Session
+ from py.__.test2.session import Session
class MySession(Session):
def __init__(self, config, reporter=None):
self.config = config
"""))
- config = py.test.config._reparse(["--session=MySession", self.tmpdir])
+ config = py.test2.config._reparse(["--session=MySession", self.tmpdir])
session = config.initsession()
assert session.__class__.__name__ == 'MySession'
def test_initsession(self):
- config = py.test.config._reparse([self.tmpdir])
+ config = py.test2.config._reparse([self.tmpdir])
session = config.initsession()
assert session.config is config
def test_boxed_option_default(self):
self.tmpdir.join("conftest.py").write("dist_hosts=[]")
tmpdir = self.tmpdir.ensure("subdir", dir=1)
- config = py.test.config._reparse([tmpdir])
+ config = py.test2.config._reparse([tmpdir])
config.initsession()
assert not config.option.boxed
- config = py.test.config._reparse(['--dist', tmpdir])
+ config = py.test2.config._reparse(['--dist', tmpdir])
config.initsession()
assert not config.option.boxed
@@ -259,7 +259,7 @@
dist_hosts = []
dist_boxed = True
"""))
- config = py.test.config._reparse(['--dist', tmpdir])
+ config = py.test2.config._reparse(['--dist', tmpdir])
config.initsession()
assert config.option.boxed
@@ -268,21 +268,21 @@
tmpdir.join("conftest.py").write(py.code.Source("""
dist_boxed = False
"""))
- config = py.test.config._reparse([tmpdir, '--box'])
+ config = py.test2.config._reparse([tmpdir, '--box'])
assert config.option.boxed
config.initsession()
assert config.option.boxed
def test_dist_session_no_capturedisable(self):
- config = py.test.config._reparse([self.tmpdir, '-d', '-s'])
- py.test.raises(SystemExit, "config.initsession()")
+ config = py.test2.config._reparse([self.tmpdir, '-d', '-s'])
+ py.test2.raises(SystemExit, "config.initsession()")
def test_getvalue_pathlist(self):
tmpdir = self.tmpdir
somepath = tmpdir.join("x", "y", "z")
p = tmpdir.join("conftest.py")
p.write("pathlist = ['.', %r]" % str(somepath))
- config = py.test.config._reparse([p])
+ config = py.test2.config._reparse([p])
assert config.getvalue_pathlist('notexist') is None
pl = config.getvalue_pathlist('pathlist')
print pl
@@ -296,13 +296,13 @@
def test_config_iocapturing(self):
self.tmpdir
- config = py.test.config._reparse([self.tmpdir])
+ config = py.test2.config._reparse([self.tmpdir])
assert config.getvalue("conf_iocapture")
tmpdir = self.tmpdir.ensure("sub-with-conftest", dir=1)
tmpdir.join("conftest.py").write(py.code.Source("""
conf_iocapture = "sys"
"""))
- config = py.test.config._reparse([tmpdir])
+ config = py.test2.config._reparse([tmpdir])
assert config.getvalue("conf_iocapture") == "sys"
class dummy: pass
config._startcapture(dummy)
@@ -311,7 +311,7 @@
config._finishcapture(dummy)
assert dummy._captured_out.strip() == "42"
- config = py.test.config._reparse([tmpdir.dirpath()])
+ config = py.test2.config._reparse([tmpdir.dirpath()])
config._startcapture(dummy, path=tmpdir)
print 42
py.std.os.write(1, "23")
@@ -320,22 +320,22 @@
class TestConfigColitems:
def setup_class(cls):
- cls.tmproot = py.test.ensuretemp(cls.__name__)
+ cls.tmproot = py.test2.ensuretemp(cls.__name__)
def setup_method(self, method):
self.tmpdir = self.tmproot.mkdir(method.__name__)
def test_getcolitems_onedir(self):
- config = py.test.config._reparse([self.tmpdir])
+ config = py.test2.config._reparse([self.tmpdir])
colitems = config.getcolitems()
assert len(colitems) == 1
col = colitems[0]
- assert isinstance(col, py.test.collect.Directory)
+ assert isinstance(col, py.test2.collect.Directory)
for col in col.listchain():
assert col._config is config
def test_getcolitems_twodirs(self):
- config = py.test.config._reparse([self.tmpdir, self.tmpdir])
+ config = py.test2.config._reparse([self.tmpdir, self.tmpdir])
colitems = config.getcolitems()
assert len(colitems) == 2
col1, col2 = colitems
@@ -344,7 +344,7 @@
def test_getcolitems_curdir_and_subdir(self):
a = self.tmpdir.ensure("a", dir=1)
- config = py.test.config._reparse([self.tmpdir, a])
+ config = py.test2.config._reparse([self.tmpdir, a])
colitems = config.getcolitems()
assert len(colitems) == 2
col1, col2 = colitems
@@ -356,9 +356,9 @@
def test__getcol_global_file(self):
x = self.tmpdir.ensure("x.py")
- config = py.test.config._reparse([x])
+ config = py.test2.config._reparse([x])
col = config._getcollector(x)
- assert isinstance(col, py.test.collect.Module)
+ assert isinstance(col, py.test2.collect.Module)
assert col.name == 'x.py'
assert col.parent.name == self.tmpdir.basename
assert col.parent.parent is None
@@ -367,9 +367,9 @@
def test__getcol_global_dir(self):
x = self.tmpdir.ensure("a", dir=1)
- config = py.test.config._reparse([x])
+ config = py.test2.config._reparse([x])
col = config._getcollector(x)
- assert isinstance(col, py.test.collect.Directory)
+ assert isinstance(col, py.test2.collect.Directory)
print col.listchain()
assert col.name == 'a'
assert col.parent is None
@@ -378,9 +378,9 @@
def test__getcol_pkgfile(self):
x = self.tmpdir.ensure("x.py")
self.tmpdir.ensure("__init__.py")
- config = py.test.config._reparse([x])
+ config = py.test2.config._reparse([x])
col = config._getcollector(x)
- assert isinstance(col, py.test.collect.Module)
+ assert isinstance(col, py.test2.collect.Module)
assert col.name == 'x.py'
assert col.parent.name == x.dirpath().basename
assert col.parent.parent is None
@@ -391,7 +391,7 @@
a = self.tmpdir.ensure("a", dir=1)
self.tmpdir.ensure("a", "__init__.py")
x = self.tmpdir.ensure("a", "trail.py")
- config = py.test.config._reparse([x])
+ config = py.test2.config._reparse([x])
col = config._getcollector(x)
trail = config.get_collector_trail(col)
assert len(trail) == 2
@@ -401,7 +401,7 @@
assert col2.listnames() == col.listnames()
def test_get_collector_trail_topdir_and_beyond(self):
- config = py.test.config._reparse([self.tmpdir])
+ config = py.test2.config._reparse([self.tmpdir])
col = config._getcollector(config.topdir)
trail = config.get_collector_trail(col)
assert len(trail) == 2
@@ -411,6 +411,6 @@
assert col2.fspath == config.topdir
assert len(col2.listchain()) == 1
col3 = config._getcollector(config.topdir.dirpath())
- py.test.raises(ValueError,
+ py.test2.raises(ValueError,
"config.get_collector_trail(col3)")
Modified: py/branch/event/py/test2/testing/test_conftesthandle.py
==============================================================================
--- py/branch/event/py/test/testing/test_conftesthandle.py (original)
+++ py/branch/event/py/test2/testing/test_conftesthandle.py Wed Jan 30 20:38:14 2008
@@ -1,5 +1,5 @@
import py
-from py.__.test.conftesthandle import Conftest
+from py.__.test2.conftesthandle import Conftest
class TestConftestValueAccessGlobal:
def setup_class(cls):
@@ -7,7 +7,7 @@
# and thus no further import scope) it should still all work
# because "global" conftests are imported with a
# mangled module name (related to their actual path)
- cls.basedir = d = py.test.ensuretemp(cls.__name__)
+ cls.basedir = d = py.test2.ensuretemp(cls.__name__)
d.ensure("adir/conftest.py").write("a=1 ; Directory = 3")
d.ensure("adir/b/conftest.py").write("b=2 ; a = 1.5")
@@ -30,18 +30,18 @@
def test_default_Module_setting_is_visible_always(self):
for path in self.basedir.parts():
conftest = Conftest(path)
- #assert conftest.lget("Module") == py.test.collect.Module
- assert conftest.rget("Module") == py.test.collect.Module
+ #assert conftest.lget("Module") == py.test2.collect.Module
+ assert conftest.rget("Module") == py.test2.collect.Module
def test_default_has_lower_prio(self):
conftest = Conftest(self.basedir.join("adir"))
assert conftest.rget('Directory') == 3
- #assert conftest.lget('Directory') == py.test.collect.Directory
+ #assert conftest.lget('Directory') == py.test2.collect.Directory
def test_value_access_not_existing(self):
conftest = Conftest(self.basedir)
- py.test.raises(KeyError, "conftest.rget('a')")
- #py.test.raises(KeyError, "conftest.lget('a')")
+ py.test2.raises(KeyError, "conftest.rget('a')")
+ #py.test2.raises(KeyError, "conftest.lget('a')")
def test_value_access_by_path(self):
conftest = Conftest(self.basedir)
@@ -50,7 +50,7 @@
assert conftest.rget("a", self.basedir.join('adir', 'b')) == 1.5
#assert conftest.lget("a", self.basedir.join('adir', 'b')) == 1
#assert conftest.lget("b", self.basedir.join('adir', 'b')) == 2
- #assert py.test.raises(KeyError,
+ #assert py.test2.raises(KeyError,
# 'conftest.lget("b", self.basedir.join("a"))'
#)
Modified: py/branch/event/py/test2/testing/test_deprecated.py
==============================================================================
--- py/branch/event/py/test/testing/test_deprecated.py (original)
+++ py/branch/event/py/test2/testing/test_deprecated.py Wed Jan 30 20:38:14 2008
@@ -11,11 +11,11 @@
filename="hello", lineno=3)
def test_deprecated_call_raises():
- py.test.raises(AssertionError,
- "py.test.deprecated_call(dep, 3)")
+ py.test2.raises(AssertionError,
+ "py.test2.deprecated_call(dep, 3)")
def test_deprecated_call():
- py.test.deprecated_call(dep, 0)
+ py.test2.deprecated_call(dep, 0)
def test_deprecated_call_preserves():
r = py.std.warnings.onceregistry.copy()
@@ -26,10 +26,10 @@
assert f == py.std.warnings.filters
def test_deprecated_explicit_call_raises():
- py.test.raises(AssertionError,
- "py.test.deprecated_call(dep_explicit, 3)")
+ py.test2.raises(AssertionError,
+ "py.test2.deprecated_call(dep_explicit, 3)")
def test_deprecated_explicit_call():
- py.test.deprecated_call(dep_explicit, 0)
- py.test.deprecated_call(dep_explicit, 0)
+ py.test2.deprecated_call(dep_explicit, 0)
+ py.test2.deprecated_call(dep_explicit, 0)
Modified: py/branch/event/py/test2/testing/test_doctest.py
==============================================================================
--- py/branch/event/py/test/testing/test_doctest.py (original)
+++ py/branch/event/py/test2/testing/test_doctest.py Wed Jan 30 20:38:14 2008
@@ -1,7 +1,7 @@
import py
-from py.__.test.doctest import DoctestText
-from py.__.test.outcome import Skipped, Failed, Passed, Outcome
+from py.__.test2.doctest import DoctestText
+from py.__.test2.outcome import Skipped, Failed, Passed, Outcome
def test_simple_docteststring():
testitem = DoctestText(name="dummy", parent=None)
@@ -20,11 +20,11 @@
>>> i + 1
2
""")
- py.test.raises(Failed, "testitem.run()")
+ py.test2.raises(Failed, "testitem.run()")
def test_collect_doctest_files_with_test_prefix():
- o = py.test.ensuretemp("testdoctest")
+ o = py.test2.ensuretemp("testdoctest")
checkfile = o.ensure("test_something.txt")
o.ensure("whatever.txt")
checkfile.write(py.code.Source("""
@@ -35,9 +35,9 @@
"""))
for x in (o, checkfile):
#print "checking that %s returns custom items" % (x,)
- config = py.test.config._reparse([x])
+ config = py.test2.config._reparse([x])
col = config._getcollector(x)
- items = list(col._tryiter(py.test.collect.Item))
+ items = list(col._tryiter(py.test2.collect.Item))
assert len(items) == 1
assert isinstance(items[0], DoctestText)
Modified: py/branch/event/py/test2/testing/test_executor.py
==============================================================================
--- py/branch/event/py/test/testing/test_executor.py (original)
+++ py/branch/event/py/test2/testing/test_executor.py Wed Jan 30 20:38:14 2008
@@ -2,17 +2,17 @@
import py
import example1
-from py.__.test.executor import RunExecutor, BoxExecutor,\
+from py.__.test2.executor import RunExecutor, BoxExecutor,\
AsyncExecutor, ApigenExecutor
-from py.__.test.outcome import ReprOutcome
-from py.__.test.rsession.testing.basetest import BasicRsessionTest
-from py.__.test.outcome import Failed
+from py.__.test2.outcome import ReprOutcome
+from py.__.test2.rsession.testing.basetest import BasicRsessionTest
+from py.__.test2.outcome import Failed
def setup_module(mod):
if py.std.sys.platform == "win32":
py.test.skip("skipping executor tests (some require os.fork)")
-class Item(py.test.collect.Item):
+class Item(py.test2.collect.Item):
def __init__(self, name, config):
super(Item, self).__init__(name)
self._config = config
@@ -27,7 +27,7 @@
class ItemTestSkipping(Item):
def run(self):
- py.test.skip("hello")
+ py.test2.skip("hello")
class ItemTestPrinting(Item):
def run(self):
@@ -39,7 +39,7 @@
class ItemTestFailingExplicitEmpty(Item):
def run(self):
- py.test.raises(ValueError, lambda : 123)
+ py.test2.raises(ValueError, lambda : 123)
class TestExecutor(BasicRsessionTest):
def test_run_executor(self):
@@ -118,7 +118,7 @@
def end_tracing(self):
self.ends += 1
- tmpdir = py.test.ensuretemp("apigen_executor")
+ tmpdir = py.test2.ensuretemp("apigen_executor")
tmpdir.ensure("__init__.py")
tmpdir.ensure("test_one.py").write(py.code.Source("""
def g():
@@ -137,7 +137,7 @@
def test_raise(self):
1/0
"""))
- config = py.test.config._reparse([tmpdir])
+ config = py.test2.config._reparse([tmpdir])
rootcol = config._getcollector(tmpdir)
tracer = Tracer()
item = rootcol._getitembynames("test_one.py/test_1")
Modified: py/branch/event/py/test2/testing/test_itemgen.py
==============================================================================
--- py/branch/event/py/test/testing/test_itemgen.py (original)
+++ py/branch/event/py/test2/testing/test_itemgen.py Wed Jan 30 20:38:14 2008
@@ -1,7 +1,7 @@
import py
-from py.__.test.session import itemgen
-from py.__.test import repevent
+from py.__.test2.session import itemgen
+from py.__.test2 import repevent
class TestItemgen:
def setup_class(cls):
@@ -20,14 +20,15 @@
"""))
tmp.ensure("test_two.py").write(py.code.Source("""
import py
- py.test.skip('xxx')
+ py.test2.skip('xxx')
"""))
tmp.ensure("test_three.py").write("xxxdsadsadsadsa")
cls.tmp = tmp
def test_itemgen(self):
+ py.test.skip("itemgen test needs revamp but itemgen needs refactoring anyway")
l = []
- colitems = [py.test.collect.Directory(self.tmp)]
+ colitems = [py.test2.collect.Directory(self.tmp)]
gen = itemgen(None, colitems, l.append)
items = [i for i in gen]
assert len([i for i in l if isinstance(i, repevent.SkippedTryiter)]) == 1
Modified: py/branch/event/py/test2/testing/test_outcome.py
==============================================================================
--- py/branch/event/py/test/testing/test_outcome.py (original)
+++ py/branch/event/py/test2/testing/test_outcome.py Wed Jan 30 20:38:14 2008
@@ -1,6 +1,6 @@
import py
-from py.__.test.outcome import SerializableOutcome, ReprOutcome, ExcInfoRepr
+from py.__.test2.outcome import SerializableOutcome, ReprOutcome, ExcInfoRepr
import marshal
import py
Modified: py/branch/event/py/test2/testing/test_remote.py
==============================================================================
--- py/branch/event/py/test/testing/test_remote.py (original)
+++ py/branch/event/py/test2/testing/test_remote.py Wed Jan 30 20:38:14 2008
@@ -1,5 +1,5 @@
import py
-from py.__.test.testing.setupdata import setup_module
+from py.__.test2.testing.setupdata import setup_module
class TestRemote:
def test_exec(self):
@@ -10,7 +10,7 @@
assert 1 == 0
"""))
print py.std.sys.executable
- config = py.test.config._reparse(
+ config = py.test2.config._reparse(
['--exec=' + py.std.sys.executable,
o])
cls = config._getsessionclass()
@@ -21,7 +21,7 @@
if s.find('1 failed') != -1:
break
else:
- py.test.fail("did not see test_1 failure in output")
+ py.test2.fail("did not see test_1 failure in output")
assert failures
def test_looponfailing(self):
@@ -32,7 +32,7 @@
assert 1 == 0
"""))
print py.std.sys.executable
- config = py.test.config._reparse(['--looponfailing', str(o)])
+ config = py.test2.config._reparse(['--looponfailing', str(o)])
cls = config._getsessionclass()
out = py.std.Queue.Queue()
session = cls(config, out.put)
@@ -44,7 +44,7 @@
break
print s
else:
- py.test.fail("did not see test_1 failure")
+ py.test2.fail("did not see test_1 failure")
# XXX we would like to have a cleaner way to finish
try:
reply.get(timeout=5.0)
Modified: py/branch/event/py/test2/testing/test_repevent.py
==============================================================================
--- py/branch/event/py/test/testing/test_repevent.py (original)
+++ py/branch/event/py/test2/testing/test_repevent.py Wed Jan 30 20:38:14 2008
@@ -1,7 +1,7 @@
""" test reporting functionality. """
import py
-from py.__.test import repevent
+from py.__.test2 import repevent
def test_wrapcall_ok():
l = []
@@ -19,7 +19,7 @@
l = []
def fail(x):
raise ValueError
- py.test.raises(ValueError, "repevent.wrapcall(l.append, fail, 1)")
+ py.test2.raises(ValueError, "repevent.wrapcall(l.append, fail, 1)")
assert len(l) == 2
assert isinstance(l[0], repevent.CallStart)
assert isinstance(l[1], repevent.CallException)
@@ -27,7 +27,7 @@
def test_reporter_methods_sanity():
""" Checks if all the methods of reporter are sane
"""
- from py.__.test.reporter import RemoteReporter
+ from py.__.test2.reporter import RemoteReporter
for method in dir(RemoteReporter):
@@ -35,7 +35,7 @@
assert method[len('report_'):] in repevent.__dict__
def test_repevent_failures():
- from py.__.test.outcome import SerializableOutcome, ReprOutcome
+ from py.__.test2.outcome import SerializableOutcome, ReprOutcome
assert not repevent.ReportEvent().is_failure()
assert not repevent.CallEvent(None, None, None).is_failure()
Modified: py/branch/event/py/test2/testing/test_reporter.py
==============================================================================
--- py/branch/event/py/test/testing/test_reporter.py (original)
+++ py/branch/event/py/test2/testing/test_reporter.py Wed Jan 30 20:38:14 2008
@@ -18,13 +18,13 @@
import py, os
-from py.__.test.session import AbstractSession, itemgen
-from py.__.test.reporter import RemoteReporter, LocalReporter, choose_reporter
-from py.__.test import repevent
-from py.__.test.outcome import ReprOutcome, SerializableOutcome
-from py.__.test.rsession.hostmanage import HostInfo
-from py.__.test.box import Box
-from py.__.test.rsession.testing.basetest import BasicRsessionTest
+from py.__.test2.session import AbstractSession, itemgen
+from py.__.test2.reporter import RemoteReporter, LocalReporter, choose_reporter
+from py.__.test2 import repevent
+from py.__.test2.outcome import ReprOutcome, SerializableOutcome
+from py.__.test2.rsession.hostmanage import HostInfo
+from py.__.test2.box import Box
+from py.__.test2.rsession.testing.basetest import BasicRsessionTest
import sys
from StringIO import StringIO
@@ -113,7 +113,7 @@
return out
def _test_full_module(self):
- tmpdir = py.test.ensuretemp("repmod")
+ tmpdir = py.test2.ensuretemp("repmod")
tmpdir.ensure("__init__.py")
tmpdir.ensure("test_one.py").write(py.code.Source("""
def test_x():
@@ -128,8 +128,8 @@
"""))
def boxfun():
- config = py.test.config._reparse([str(tmpdir)])
- rootcol = py.test.collect.Directory(tmpdir)
+ config = py.test2.config._reparse([str(tmpdir)])
+ rootcol = py.test2.collect.Directory(tmpdir)
hosts = self.get_hosts()
r = self.reporter(config, hosts)
list(itemgen(MockSession(r), [rootcol], r.report))
@@ -141,14 +141,14 @@
return out
def test_failed_to_load(self):
- tmpdir = py.test.ensuretemp("failedtoload")
+ tmpdir = py.test2.ensuretemp("failedtoload")
tmpdir.ensure("__init__.py")
tmpdir.ensure("test_three.py").write(py.code.Source("""
sadsadsa
"""))
def boxfun():
- config = py.test.config._reparse([str(tmpdir)])
- rootcol = py.test.collect.Directory(tmpdir)
+ config = py.test2.config._reparse([str(tmpdir)])
+ rootcol = py.test2.collect.Directory(tmpdir)
hosts = self.get_hosts()
r = self.reporter(config, hosts)
r.report(repevent.TestStarted(hosts, config, ["a"]))
@@ -165,16 +165,16 @@
assert out.find("NameError: name 'sadsadsa' is not defined") != -1
def _test_verbose(self):
- tmpdir = py.test.ensuretemp("reporterverbose")
+ tmpdir = py.test2.ensuretemp("reporterverbose")
tmpdir.ensure("__init__.py")
tmpdir.ensure("test_one.py").write("def test_x(): pass")
cap = py.io.StdCaptureFD()
- config = py.test.config._reparse([str(tmpdir), '-v'])
+ config = py.test2.config._reparse([str(tmpdir), '-v'])
hosts = self.get_hosts()
r = self.reporter(config, hosts)
r.report(repevent.TestStarted(hosts, config, []))
r.report(repevent.RsyncFinished())
- rootcol = py.test.collect.Directory(tmpdir)
+ rootcol = py.test2.collect.Directory(tmpdir)
list(itemgen(MockSession(r), [rootcol], r.report))
r.report(repevent.TestFinished())
out, err = cap.reset()
@@ -183,10 +183,10 @@
assert i in out
def _test_still_to_go(self):
- tmpdir = py.test.ensuretemp("stilltogo")
+ tmpdir = py.test2.ensuretemp("stilltogo")
tmpdir.ensure("__init__.py")
cap = py.io.StdCaptureFD()
- config = py.test.config._reparse([str(tmpdir)])
+ config = py.test2.config._reparse([str(tmpdir)])
hosts = [HostInfo(i) for i in ["host1", "host2", "host3"]]
for host in hosts:
host.gw_remotepath = ''
@@ -268,13 +268,13 @@
"\nSkipped ('reason') repmod/test_two.py") != -1
def test_reporter_choice():
- from py.__.test.rsession.web import WebReporter
- from py.__.test.rsession.rest import RestReporter
+ from py.__.test2.rsession.web import WebReporter
+ from py.__.test2.rsession.rest import RestReporter
choices = [
(['-d', '--rest'], RestReporter),
(['-w'], WebReporter),
(['-r'], WebReporter)]
for opts, reporter in choices:
- config = py.test.config._reparse(['xxx'] + opts)
+ config = py.test2.config._reparse(['xxx'] + opts)
assert choose_reporter(None, config) is reporter
Modified: py/branch/event/py/test2/testing/test_repr.py
==============================================================================
--- py/branch/event/py/test/testing/test_repr.py (original)
+++ py/branch/event/py/test2/testing/test_repr.py Wed Jan 30 20:38:14 2008
@@ -1,15 +1,15 @@
import py
-from py.__.test.representation import Presenter
-from py.__.test.terminal.out import getout
+from py.__.test2.representation import Presenter
+from py.__.test2.terminal.out import getout
from StringIO import StringIO
import sys
def newconfig(*args):
- tmpdir = py.test.ensuretemp("newconfig")
+ tmpdir = py.test2.ensuretemp("newconfig")
args = list(args)
args.append(tmpdir)
- return py.test.config._reparse(args)
+ return py.test2.config._reparse(args)
def test_repr_source():
source = py.code.Source("""
@@ -58,7 +58,7 @@
def XXXtest_repr_traceback_long():
py.test.skip("unfinished")
- config = py.test.config._reparse([])
+ config = py.test2.config._reparse([])
s = StringIO()
out = getout(s)
p = Presenter(out, config)
Modified: py/branch/event/py/test2/testing/test_session.py
==============================================================================
--- py/branch/event/py/test/testing/test_session.py (original)
+++ py/branch/event/py/test2/testing/test_session.py Wed Jan 30 20:38:14 2008
@@ -1,8 +1,8 @@
import py
from setupdata import setup_module # sets up global 'tmpdir'
-from py.__.test.outcome import Skipped, Failed, Passed, Outcome
-from py.__.test.terminal.out import getout
-from py.__.test.repevent import ReceivedItemOutcome, SkippedTryiter,\
+from py.__.test2.outcome import Skipped, Failed, Passed, Outcome
+from py.__.test2.terminal.out import getout
+from py.__.test2.repevent import ReceivedItemOutcome, SkippedTryiter,\
FailedTryiter
implied_options = {
@@ -38,8 +38,8 @@
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 = py.test2.config._reparse(opts + [datadir/'filetest.py'])
+ py.test2.raises((ValueError, SystemExit), """
config.initsession()
""")
@@ -48,7 +48,7 @@
yield check_implied_option, [key], expr
def check_implied_option(opts, expr):
- config = py.test.config._reparse(opts + [datadir/'filetest.py'])
+ config = py.test2.config._reparse(opts + [datadir/'filetest.py'])
session = config.initsession()
assert eval(expr, session.config.option.__dict__)
@@ -59,7 +59,7 @@
yield runfiletest, opts
def runfiletest(opts):
- config = py.test.config._reparse(opts + [datadir/'filetest.py'])
+ config = py.test2.config._reparse(opts + [datadir/'filetest.py'])
all = []
session = config.initsession()
session.main(all.append)
@@ -67,13 +67,13 @@
assert not getskipped(all)
def test_is_not_boxed_by_default():
- config = py.test.config._reparse([datadir])
+ config = py.test2.config._reparse([datadir])
assert not config.option.boxed
class TestKeywordSelection:
def test_select_simple(self):
def check(keyword, name):
- config = py.test.config._reparse([datadir/'filetest.py',
+ config = py.test2.config._reparse([datadir/'filetest.py',
'-s', '-k', keyword])
all = []
session = config._getsessionclass()(config)
@@ -99,13 +99,13 @@
"""))
conftest = o.join('conftest.py').write(py.code.Source("""
import py
- class Class(py.test.collect.Class):
+ class Class(py.test2.collect.Class):
def _keywords(self):
return ['xxx', self.name]
"""))
for keyword in ('xxx', 'xxx test_2', 'TestClass', 'xxx -test_1',
'TestClass test_2', 'xxx TestClass test_2',):
- config = py.test.config._reparse([o, '-s', '-k', keyword])
+ config = py.test2.config._reparse([o, '-s', '-k', keyword])
all = []
session = config._getsessionclass()(config)
session.main(all.append)
@@ -118,7 +118,7 @@
assert l[0].item.name == 'test_1'
def test_select_starton(self):
- config = py.test.config._reparse([datadir/'testmore.py',
+ config = py.test2.config._reparse([datadir/'testmore.py',
'-j', '-k', "test_two"])
all = []
session = config._getsessionclass()(config)
@@ -129,9 +129,9 @@
class TestTerminalSession:
def mainsession(self, *args):
- from py.__.test.session import Session
- from py.__.test.terminal.out import getout
- config = py.test.config._reparse(list(args))
+ from py.__.test2.session import Session
+ from py.__.test2.terminal.out import getout
+ config = py.test2.config._reparse(list(args))
all = []
session = Session(config)
session.main(all.append)
@@ -186,7 +186,7 @@
"""))
conftest = o.join('conftest.py').write(py.code.Source("""
import py
- class Function(py.test.collect.Function):
+ class Function(py.test2.collect.Function):
def startcapture(self):
self._mycapture = None
@@ -202,7 +202,7 @@
assert hasattr(item, '_testmycapture')
print item._testmycapture
- assert isinstance(item.parent, py.test.collect.Module)
+ assert isinstance(item.parent, py.test2.collect.Module)
def test_raises_output(self):
o = tmpdir.ensure('raisestest', dir=1)
@@ -210,14 +210,14 @@
tfile.write(py.code.Source("""
import py
def test_raises_doesnt():
- py.test.raises(ValueError, int, "3")
+ py.test2.raises(ValueError, int, "3")
"""))
session, all = self.mainsession(o)
outcomes = getoutcomes(all)
out = outcomes[0].excinfo.exconly()
if not out.find("DID NOT RAISE") != -1:
print out
- py.test.fail("incorrect raises() output")
+ py.test2.fail("incorrect raises() output")
def test_order_of_execution(self):
o = tmpdir.ensure('ordertest', dir=1)
@@ -267,7 +267,7 @@
def test_safe_repr(self):
session, all = self.mainsession(datadir/'brokenrepr.py')
- #print 'Output of simulated "py.test brokenrepr.py":'
+ #print 'Output of simulated "py.test2 brokenrepr.py":'
#print all
l = getfailed(all)
Modified: py/branch/event/py/test2/testing/test_session2.py
==============================================================================
--- py/branch/event/py/test/testing/test_session2.py (original)
+++ py/branch/event/py/test2/testing/test_session2.py Wed Jan 30 20:38:14 2008
@@ -1,15 +1,15 @@
-""" test of local version of py.test distributed
+""" test of local version of py.test2 distributed
"""
import py
-from py.__.test import repevent
-#from py.__.test.rsession.local import box_runner, plain_runner, apigen_runner
-import py.__.test.custompdb
-from py.__.test.session import Session
+from py.__.test2 import repevent
+#from py.__.test2.rsession.local import box_runner, plain_runner, apigen_runner
+import py.__.test2.custompdb
+from py.__.test2.session import Session
def setup_module(mod):
- mod.tmp = py.test.ensuretemp("lsession_module")
+ mod.tmp = py.test2.ensuretemp("lsession_module")
class TestSession(object):
# XXX: Some tests of that should be run as well on RSession, while
@@ -35,7 +35,7 @@
args = [str(tmpdir.join(dirname))]
if boxed:
args.append('--boxed')
- config = py.test.config._reparse(args)
+ config = py.test2.config._reparse(args)
lsession = Session(config)
allevents = []
lsession.main(reporter=allevents.append)
@@ -82,7 +82,7 @@
"""))
args = [str(tmpdir.join(dirname))]
args.append('--boxed')
- config = py.test.config._reparse(args)
+ config = py.test2.config._reparse(args)
lsession = Session(config)
allevents = []
lsession.main(reporter=allevents.append)
@@ -108,10 +108,10 @@
l.append(args)
try:
- post_mortem = py.__.test.custompdb.post_mortem
- py.__.test.custompdb.post_mortem = some_fun
+ post_mortem = py.__.test2.custompdb.post_mortem
+ py.__.test2.custompdb.post_mortem = some_fun
args = [str(tmpdir.join(subdir)), '--pdb']
- config = py.test.config._reparse(args)
+ config = py.test2.config._reparse(args)
lsession = Session(config)
allevents = []
#try:
@@ -119,13 +119,13 @@
#except SystemExit:
# pass
#else:
- # py.test.fail("Didn't raise system exit")
+ # py.test2.fail("Didn't raise system exit")
failure_events = [event for event in allevents if isinstance(event,
repevent.ImmediateFailure)]
assert len(failure_events) == 1
assert len(l) == 1
finally:
- py.__.test.custompdb.post_mortem = post_mortem
+ py.__.test2.custompdb.post_mortem = post_mortem
def test_minus_x(self):
if not hasattr(py.std.os, 'fork'):
@@ -144,7 +144,7 @@
pass
"""))
args = [str(tmpdir.join(subdir)), '-x']
- config = py.test.config._reparse(args)
+ config = py.test2.config._reparse(args)
assert config.option.exitfirst
lsession = Session(config)
allevents = []
@@ -174,7 +174,7 @@
pass
"""))
args = [str(tmpdir.join("sub3")), '-k', 'test_one']
- config = py.test.config._reparse(args)
+ config = py.test2.config._reparse(args)
lsession = Session(config)
allevents = []
@@ -202,7 +202,7 @@
"""))
args = [str(tmpdir.join("sub4"))]
- config = py.test.config._reparse(args)
+ config = py.test2.config._reparse(args)
lsession = Session(config)
allevents = []
allruns = []
@@ -228,7 +228,7 @@
"""))
args = [str(tmpdir.join("sub5"))]
- config = py.test.config._reparse(args)
+ config = py.test2.config._reparse(args)
lsession = Session(config)
allevents = []
lsession.main(reporter=allevents.append)
@@ -254,7 +254,7 @@
assert [0] == x
"""))
args = [str(tmpdir.join("sub6"))]
- config = py.test.config._reparse(args)
+ config = py.test2.config._reparse(args)
lsession = Session(config)
allevents = []
lsession.main(reporter=allevents.append)
@@ -275,7 +275,7 @@
print 3
"""))
args = [str(tmpdir.join("sub7"))]
- config = py.test.config._reparse(args)
+ config = py.test2.config._reparse(args)
lsession = Session(config)
allevents = []
lsession.main(reporter=allevents.append)
Modified: py/branch/event/py/test2/web/webcheck.py
==============================================================================
--- py/branch/event/py/test/web/webcheck.py (original)
+++ py/branch/event/py/test2/web/webcheck.py Wed Jan 30 20:38:14 2008
@@ -6,7 +6,7 @@
def check_html(string):
"""check an HTML string for wellformedness and validity"""
- tempdir = py.test.ensuretemp('check_html')
+ tempdir = py.test2.ensuretemp('check_html')
filename = 'temp%s.html' % (hash(string), )
tempfile = tempdir.join(filename)
tempfile.write(string)
@@ -22,7 +22,7 @@
valid = match.group(1) is None
text = match.group(2).strip()
if not valid:
- temp = py.test.ensuretemp('/w3_results_%s.html' % hash(html), dir=0)
+ temp = py.test2.ensuretemp('/w3_results_%s.html' % hash(html), dir=0)
temp.write(html)
raise HTMLError(
"The html is not valid. See the report file at '%s'" % temp)
More information about the py-svn
mailing list