[py-svn] r9647 - in py/branch/py-collect: . path/local/testing path/testing test test2 test2/report/testing test2/report/text test2/testing test2/tool test2/tool/testing
hpk at codespeak.net
hpk at codespeak.net
Fri Mar 4 20:13:31 CET 2005
Author: hpk
Date: Fri Mar 4 20:13:30 2005
New Revision: 9647
Removed:
py/branch/py-collect/test/
Modified:
py/branch/py-collect/__init__.py
py/branch/py-collect/path/local/testing/test_local.py
py/branch/py-collect/path/testing/fscommon.py
py/branch/py-collect/test2/cmdline.py
py/branch/py-collect/test2/collect.py
py/branch/py-collect/test2/config.py
py/branch/py-collect/test2/defaultconfig.py
py/branch/py-collect/test2/drive.py
py/branch/py-collect/test2/item.py
py/branch/py-collect/test2/raises.py
py/branch/py-collect/test2/report/testing/test_memo.py
py/branch/py-collect/test2/report/text/reporter.py
py/branch/py-collect/test2/report/text/summary.py
py/branch/py-collect/test2/run.py
py/branch/py-collect/test2/terminal.py
py/branch/py-collect/test2/testing/test_api.py
py/branch/py-collect/test2/testing/test_collect.py
py/branch/py-collect/test2/testing/test_config.py
py/branch/py-collect/test2/testing/test_drive.py
py/branch/py-collect/test2/tool/optparse.py
py/branch/py-collect/test2/tool/testing/test_outerrcapture.py
Log:
intermediate checking, heading towards merging the branch now
Modified: py/branch/py-collect/__init__.py
==============================================================================
--- py/branch/py-collect/__init__.py (original)
+++ py/branch/py-collect/__init__.py Fri Mar 4 20:13:30 2005
@@ -6,41 +6,18 @@
'test.fail' : ('./test/item.py', 'fail'),
'test.exit' : ('./test/drive.py', 'exit'),
'test.config' : ('./test/config.py', 'config'),
- 'test.compat.TestCase' : ('./test/compat.py', 'TestCase'),
- 'test.collect.Directory' : ('./test/collect.py', 'Directory'),
- 'test.collect.PyCollector': ('./test/collect.py', 'PyCollector'),
- 'test.collect.Module' : ('./test/collect.py', 'Module'),
- 'test.collect.Class' : ('./test/collect.py', 'Class'),
- 'test.collect.Error' : ('./test/collect.py', 'Error'),
- 'test.collect.Collector' : ('./test/collect.py', 'Collector'),
- 'test.TextReporter' : ('./test/report/text/reporter.py',
- 'TextReporter'),
'test.Option' : ('./test/tool/optparse.py', 'Option'),
- 'test.MemoReporter' : ('./test/report/memo.py', 'MemoReporter'),
- 'test.Item' : ('./test/item.py', 'Item'),
- 'test.GenItem' : ('./test/item.py', 'GenItem'),
'test.Driver' : ('./test/drive.py', 'Driver'),
+ 'test.TerminalDriver' : ('./test/terminal.py', 'TerminalDriver'),
- 'test2.skip' : ('./test2/item.py', 'skip'),
- 'test2.skip_on_error' : ('./test2/item.py', 'skip_on_error'),
- 'test2.raises' : ('./test2/raises.py', 'raises'),
- 'test2.fail' : ('./test2/item.py', 'fail'),
- 'test2.exit' : ('./test2/drive.py', 'exit'),
- 'test2.config' : ('./test2/config.py', 'config'),
- 'test2.Option' : ('./test2/tool/optparse.py', 'Option'),
- 'test2.Driver' : ('./test2/drive.py', 'Driver'),
- 'test2.TerminalDriver' : ('./test2/terminal.py', 'TerminalDriver'),
- #'test2.TextReporter' : ('./test2/report/text/reporter.py',
- # 'TextReporter'),
-
- 'test2.Collector' : ('./test2/collect.py', 'Collector'),
- 'test2.Directory' : ('./test2/collect.py', 'Directory'),
- 'test2.Module' : ('./test2/collect.py', 'Module'),
- 'test2.Class' : ('./test2/collect.py', 'Class'),
- 'test2.Instance' : ('./test2/collect.py', 'Instance'),
- 'test2.Generator' : ('./test2/collect.py', 'Generator'),
- 'test2.Item' : ('./test2/item.py', 'Item'),
- 'test2.Function' : ('./test2/item.py', 'Function'),
+ 'test.Collector' : ('./test/collect.py', 'Collector'),
+ 'test.Directory' : ('./test/collect.py', 'Directory'),
+ 'test.Module' : ('./test/collect.py', 'Module'),
+ 'test.Class' : ('./test/collect.py', 'Class'),
+ 'test.Instance' : ('./test/collect.py', 'Instance'),
+ 'test.Generator' : ('./test/collect.py', 'Generator'),
+ 'test.Item' : ('./test/item.py', 'Item'),
+ 'test.Function' : ('./test/item.py', 'Function'),
'std' : ('./misc/std.py', 'std'),
Modified: py/branch/py-collect/path/local/testing/test_local.py
==============================================================================
--- py/branch/py-collect/path/local/testing/test_local.py (original)
+++ py/branch/py-collect/path/local/testing/test_local.py Fri Mar 4 20:13:30 2005
@@ -108,7 +108,7 @@
def test_ensure_filepath_withdir(self):
tmpdir = self.tmpdir
- newfile = tmpdir.join('test1','test2')
+ newfile = tmpdir.join('test1','test')
newfile.ensure()
assert newfile.check(file=1)
newfile.write("42")
@@ -124,7 +124,7 @@
def test_ensure_dirpath(self):
tmpdir = self.tmpdir
- newfile = tmpdir.join('test1','test2file')
+ newfile = tmpdir.join('test1','testfile')
t = newfile.ensure(dir=1)
assert t == newfile
assert newfile.check(dir=1)
Modified: py/branch/py-collect/path/testing/fscommon.py
==============================================================================
--- py/branch/py-collect/path/testing/fscommon.py (original)
+++ py/branch/py-collect/path/testing/fscommon.py Fri Mar 4 20:13:30 2005
@@ -191,10 +191,10 @@
assert new.check(dir=1)
new.remove()
- new = tmpdir.mkdir('mktest2')
+ new = tmpdir.mkdir('mktest')
assert new.check(dir=1)
new.remove()
- assert tmpdir.join('mktest2') == new
+ assert tmpdir.join('mktest') == new
def test_move_file(self):
p = self.root.join('samplefile')
Modified: py/branch/py-collect/test2/cmdline.py
==============================================================================
--- py/branch/py-collect/test2/cmdline.py (original)
+++ py/branch/py-collect/test2/cmdline.py Fri Mar 4 20:13:30 2005
@@ -1,7 +1,7 @@
from __future__ import generators
import py
import sys
-from py.__impl__.test2 import run
+from py.__impl__.test import run
#
# main entry point
@@ -9,11 +9,11 @@
def main():
args = py.std.sys.argv[1:]
- py.test2.config.readconfiguration(*run.getanchors(args))
- filenames = py.test2.config.parseargs(args)
+ py.test.config.readconfiguration(*run.getanchors(args))
+ filenames = py.test.config.parseargs(args)
if not filenames:
filenames.append(str(py.path.local()))
- option = py.test2.config.option
+ option = py.test.config.option
try:
if option.session or option.executable:
run.session(args, filenames)
Modified: py/branch/py-collect/test2/collect.py
==============================================================================
--- py/branch/py-collect/test2/collect.py (original)
+++ py/branch/py-collect/test2/collect.py Fri Mar 4 20:13:30 2005
@@ -35,7 +35,7 @@
def configproperty(name):
def fget(self):
#print "retrieving %r property from %s" %(name, self.fspath)
- return py.test2.config.getconfigvalue(self.fspath, name)
+ return py.test.config.getconfigvalue(self.fspath, name)
return property(fget)
def getfscollector(fspath):
@@ -143,7 +143,7 @@
def iteritems(self):
""" yield all Items from flattended collector instance. """
- if isinstance(self, py.test2.Item):
+ if isinstance(self, py.test.Item):
yield self
else:
for x in self.run():
Modified: py/branch/py-collect/test2/config.py
==============================================================================
--- py/branch/py-collect/test2/config.py (original)
+++ py/branch/py-collect/test2/config.py Fri Mar 4 20:13:30 2005
@@ -1,7 +1,7 @@
from __future__ import generators
import py
-from py.__impl__.test2.tool import optparse
+from py.__impl__.test.tool import optparse
defaultconfig = py.magic.autopath().dirpath('defaultconfig.py')
defaultconfig = py.path.extpy(defaultconfig)
Modified: py/branch/py-collect/test2/defaultconfig.py
==============================================================================
--- py/branch/py-collect/test2/defaultconfig.py (original)
+++ py/branch/py-collect/test2/defaultconfig.py Fri Mar 4 20:13:30 2005
@@ -1,15 +1,15 @@
import py
-Option = py.test2.Option
+Option = py.test.Option
-Module = py.test2.Module
-Directory = py.test2.Directory
-Class = py.test2.Class
-Generator = py.test2.Generator
-Function = py.test2.Function
-Instance = py.test2.Instance
+Module = py.test.Module
+Directory = py.test.Directory
+Class = py.test.Class
+Generator = py.test.Generator
+Function = py.test.Function
+Instance = py.test.Instance
def getreporter():
- return py.test2.TextReporter()
+ return py.test.TextReporter()
additionalinfo = None
Modified: py/branch/py-collect/test2/drive.py
==============================================================================
--- py/branch/py-collect/test2/drive.py (original)
+++ py/branch/py-collect/test2/drive.py Fri Mar 4 20:13:30 2005
@@ -1,5 +1,5 @@
import py
-from py.__impl__.test2.tool.outerrcapture import SimpleOutErrCapture
+from py.__impl__.test.tool.outerrcapture import SimpleOutErrCapture
class ShadowOptions(object):
def __init__(self, obj):
@@ -14,7 +14,7 @@
"""
def __init__(self):
self._memo = []
- self.option = ShadowOptions(py.test2.config.option)
+ self.option = ShadowOptions(py.test.config.option)
def shouldclose(self):
return False
@@ -26,12 +26,12 @@
def footer(self):
""" teardown any resources we know about. """
- py.test2.Item.state.teardown_all()
+ py.test.Item.state.teardown_all()
if not self.option.nomagic:
py.magic.revoke(assertion=1)
def start(self, colitem):
- if not self.option.nocapture and isinstance(colitem, py.test2.Item):
+ if not self.option.nocapture and isinstance(colitem, py.test.Item):
assert not hasattr(colitem, 'iocapture')
colitem.iocapture = SimpleOutErrCapture()
@@ -49,7 +49,7 @@
raise Warning(msg)
def runpath(self, path):
- from py.__impl__.test2.collect import getfscollector
+ from py.__impl__.test.collect import getfscollector
col = getfscollector(path)
return self.run(col)
@@ -88,7 +88,7 @@
self.finish(colitem, res)
def runinner(self, colitem):
- if self.option.collectonly and isinstance(colitem, py.test2.Item):
+ if self.option.collectonly and isinstance(colitem, py.test.Item):
return
res = colitem.run()
try:
Modified: py/branch/py-collect/test2/item.py
==============================================================================
--- py/branch/py-collect/test2/item.py (original)
+++ py/branch/py-collect/test2/item.py Fri Mar 4 20:13:30 2005
@@ -27,7 +27,7 @@
col.setup()
self.stack.append(col)
-class Item(py.test2.Collector):
+class Item(py.test.Collector):
state = SetupState()
class Function(Item):
@@ -92,7 +92,7 @@
#
def skip(msg="unknown reason", tbindex=-2):
""" skip with the given Message. """
- raise py.test2.Item.Skipped(msg=msg, tbindex=tbindex)
+ raise py.test.Item.Skipped(msg=msg, tbindex=tbindex)
def skip_on_error(func, *args, **kwargs):
""" skip test if the given call fails. """
@@ -101,9 +101,9 @@
except Exception, e:
s = py.code.ExceptionInfo().exconly()
name = getattr(func, '__name__', func)
- py.test2.skip("%s(...) -> %s" %(name, s.rstrip(), ), tbindex=-3)
+ py.test.skip("%s(...) -> %s" %(name, s.rstrip(), ), tbindex=-3)
def fail(msg="unknown failure"):
""" fail with the given Message. """
- raise py.test2.Item.Failed(msg=msg, tbindex=-2)
+ raise py.test.Item.Failed(msg=msg, tbindex=-2)
Modified: py/branch/py-collect/test2/raises.py
==============================================================================
--- py/branch/py-collect/test2/raises.py (original)
+++ py/branch/py-collect/test2/raises.py Fri Mar 4 20:13:30 2005
@@ -1,6 +1,6 @@
import sys
import py
-ExceptionFailure = py.test2.Item.ExceptionFailure
+ExceptionFailure = py.test.Item.ExceptionFailure
def raises(ExpectedException, *args, **kwargs):
""" raise AssertionError, if target code does not raise the expected
Modified: py/branch/py-collect/test2/report/testing/test_memo.py
==============================================================================
--- py/branch/py-collect/test2/report/testing/test_memo.py (original)
+++ py/branch/py-collect/test2/report/testing/test_memo.py Fri Mar 4 20:13:30 2005
@@ -14,10 +14,10 @@
# try:
#
def XXtest_memoreporter():
- reporter = py.test2.MemoReporter()
+ reporter = py.test.MemoReporter()
p = tmpdir.join('memoimport.py')
p.write('raise IOError')
- collector = py.test2.collect.Module(p)
+ collector = py.test.collect.Module(p)
#main(collector=collector, reporter=reporter)
#collect_errors = reporter.getlist(collect.Error)
#assert len(collect_errors) == 1
Modified: py/branch/py-collect/test2/report/text/reporter.py
==============================================================================
--- py/branch/py-collect/test2/report/text/reporter.py (original)
+++ py/branch/py-collect/test2/report/text/reporter.py Fri Mar 4 20:13:30 2005
@@ -1,7 +1,7 @@
from __future__ import generators
import py
-Item = py.test2.Item
-Collector = py.test2.collect.Collector
+Item = py.test.Item
+Collector = py.test.collect.Collector
from time import time as now
# lazy relative Implementation imports
@@ -29,11 +29,11 @@
self.out = getout(f)
self._started = {}
self.summary = self.Summary(self.out)
- self.summary.option = self.option = py.test2.config.option
+ self.summary.option = self.option = py.test.config.option
def start(self):
self.out.sep("=", "test process starts")
- option = py.test2.config.option
+ option = py.test.config.option
if option.session:
mode = 'session/child process'
elif option.executable:
@@ -48,9 +48,9 @@
self.out.line("using py lib: %s <rev %s>" % (
py.path.local(py.__file__).dirpath(), rev))
- for i, x in py.builtin.enumerate(py.test2.config.configpaths):
+ for i, x in py.builtin.enumerate(py.test.config.configpaths):
self.out.line("initial testconfig %d: %s" %(i, x))
- additional = py.test2.config.getfirst('additionalinfo')
+ additional = py.test.config.getfirst('additionalinfo')
if additional:
for key, descr in additional():
self.out.line("%s: %s" %(key, descr))
@@ -114,7 +114,7 @@
print "Item", item.extpy.modpath
return
if not self.option.nocapture:
- from py.__impl__.test2.tool.outerrcapture import SimpleOutErrCapture
+ from py.__impl__.test.tool.outerrcapture import SimpleOutErrCapture
item.iocapture = SimpleOutErrCapture()
if self.out.tty:
realpath, lineno = item.extpy.getfilelineno()
@@ -138,9 +138,9 @@
restype, c = self.processresult(result)
writeinfo = None
if self.out.tty:
- if not isinstance(result, py.test2.Item.Passed) or self.option.verbose >=1:
+ if not isinstance(result, py.test.Item.Passed) or self.option.verbose >=1:
writeinfo = '\n'
- elif isinstance(result, py.test2.Item.Passed):
+ elif isinstance(result, py.test.Item.Passed):
writeinfo = ''
elif self.option.verbose >= 1:
writeinfo = '\n'
Modified: py/branch/py-collect/test2/report/text/summary.py
==============================================================================
--- py/branch/py-collect/test2/report/text/summary.py (original)
+++ py/branch/py-collect/test2/report/text/summary.py Fri Mar 4 20:13:30 2005
@@ -1,6 +1,6 @@
from __future__ import generators
import py
-Item = py.test2.Item
+Item = py.test.Item
from py.__impl__.magic import exprinfo, assertion
class Summary(object):
@@ -31,7 +31,7 @@
self.out.line("[%s:%d]" % (err.filename, err.lineno))
def summary_collect_errors(self):
- for error in self.getlist(py.test2.collect.Error):
+ for error in self.getlist(py.test.collect.Error):
self.repr_collect_error(error)
def render(self):
Modified: py/branch/py-collect/test2/run.py
==============================================================================
--- py/branch/py-collect/test2/run.py (original)
+++ py/branch/py-collect/test2/run.py Fri Mar 4 20:13:30 2005
@@ -1,8 +1,8 @@
from __future__ import generators
import py
from py.__impl__.execnet.channel import ChannelFile, receive2file
-from py.__impl__.test2.config import configbasename
-from py.__impl__.test2.collect import getfscollector
+from py.__impl__.test.config import configbasename
+from py.__impl__.test.collect import getfscollector
import sys
def checkpyfilechange(rootdir, statcache):
@@ -28,7 +28,7 @@
changed = True
return changed
-class FailingCollector(py.test2.Collector):
+class FailingCollector(py.test.Collector):
def __init__(self, faileditems):
self._faileditems = faileditems
@@ -76,13 +76,13 @@
channel.gateway.exit()
def failure_master(args, filenames, failures):
- exe = py.test2.config.option.executable
+ exe = py.test.config.option.executable
gw = py.execnet.PopenGateway(python=exe or sys.executable)
outproxy = StdouterrProxy(gw)
outproxy.setup()
try:
channel = gw.remote_exec("""
- from py.__impl__.test2.run import failure_slave
+ from py.__impl__.test.run import failure_slave
failure_slave(channel)
""")
channel.send((args, filenames, failures))
@@ -94,18 +94,18 @@
""" we run this on the other side. """
args, filenames, failures = channel.receive()
filenames = map(py.path.local, filenames)
- py.test2.config.readconfiguration(*filenames)
- py.test2.config.parseargs(args)
+ py.test.config.readconfiguration(*filenames)
+ py.test.config.parseargs(args)
if failures:
col = FailureCollector(failures)
else:
col = list(getcollectors(filenames))
- driver = py.test2.Driver(channel)
+ driver = py.test.Driver(channel)
failures = driver.run(col)
channel.send(failures)
-class FailureCollector(py.test2.Collector):
+class FailureCollector(py.test.Collector):
def __init__(self, failures):
self.failures = failures
def __iter__(self):
@@ -138,22 +138,22 @@
""" we run this on the other side. """
print "inprocess"
fncollectors = list(getcollectors(filenames))
- driver = py.test2.TerminalDriver()
+ driver = py.test.TerminalDriver()
driver.run(*fncollectors)
def session(args, filenames):
statcache = {}
# XXX find out rootdir automatically with
# something like py.magic.autopath() ?
- rootdir = py.path.local(py.test2.config.getfirst('rootdir', py.path.local()))
+ rootdir = py.path.local(py.test.config.getfirst('rootdir', py.path.local()))
l = len(str(rootdir))
failures = []
while 1:
- if py.test2.config.option.session:
+ if py.test.config.option.session:
while not checkpyfilechange(rootdir, statcache):
py.std.time.sleep(0.4)
failures = failure_master(args, filenames, failures)
- if not py.test2.config.option.session:
+ if not py.test.config.option.session:
break
print "#" * 60
print "# session mode: %d failures remaining" % len(failures)
Modified: py/branch/py-collect/test2/terminal.py
==============================================================================
--- py/branch/py-collect/test2/terminal.py (original)
+++ py/branch/py-collect/test2/terminal.py Fri Mar 4 20:13:30 2005
@@ -1,10 +1,10 @@
import py
-from py.__impl__.test2.report.text.out import getout
+from py.__impl__.test.report.text.out import getout
from time import time as now
-Item = py.test2.Item
+Item = py.test.Item
-class TerminalDriver(py.test2.Driver):
+class TerminalDriver(py.test.Driver):
def __init__(self, file=None):
super(TerminalDriver, self).__init__()
if file is None:
@@ -57,7 +57,7 @@
def start_Item(self, colitem):
if self.option.verbose >= 1:
- if isinstance(colitem, py.test2.Item):
+ if isinstance(colitem, py.test.Item):
realpath, lineno = colitem.getpathlineno()
location = "%s:%d" % (realpath.basename, lineno+1)
self.out.rewrite("%-20s %s " % (
@@ -84,9 +84,9 @@
pdb.post_mortem(result.excinfo._excinfo[2])
if isinstance(result, (colitem.Failed,)):
if self.option.exitfirstproblem:
- py.test2.exit("exit on first problem configured.", item=colitem)
- if result is None or not isinstance(colitem, py.test2.Item):
- if isinstance(colitem, py.test2.Module) and self.option.verbose == 0:
+ py.test.exit("exit on first problem configured.", item=colitem)
+ if result is None or not isinstance(colitem, py.test.Item):
+ if isinstance(colitem, py.test.Module) and self.option.verbose == 0:
self.out.line()
return
else:
@@ -119,9 +119,9 @@
self.out.line("using py lib: %s <rev %s>" % (
py.path.local(py.__file__).dirpath(), rev))
- for i, x in py.builtin.enumerate(py.test2.config.configpaths):
+ for i, x in py.builtin.enumerate(py.test.config.configpaths):
self.out.line("initial testconfig %d: %s" %(i, x))
- additional = py.test2.config.getfirst('additionalinfo')
+ additional = py.test.config.getfirst('additionalinfo')
if additional:
for key, descr in additional():
self.out.line("%s: %s" %(key, descr))
Modified: py/branch/py-collect/test2/testing/test_api.py
==============================================================================
--- py/branch/py-collect/test2/testing/test_api.py (original)
+++ py/branch/py-collect/test2/testing/test_api.py Fri Mar 4 20:13:30 2005
@@ -4,13 +4,13 @@
def test_skipfailure():
def f():
raise ValueError()
- excinfo = py.test2.raises(
- py.test2.Item.Skipped,
- "py.test2.skip_on_error(f)")
+ excinfo = py.test.raises(
+ py.test.Item.Skipped,
+ "py.test.skip_on_error(f)")
print excinfo
assert str(excinfo).find("ValueError") != -1
def test_skip_on_error_with_no_failure():
def f():
return 42
- assert py.test2.skip_on_error(f) == 42
+ assert py.test.skip_on_error(f) == 42
Modified: py/branch/py-collect/test2/testing/test_collect.py
==============================================================================
--- py/branch/py-collect/test2/testing/test_collect.py (original)
+++ py/branch/py-collect/test2/testing/test_collect.py Fri Mar 4 20:13:30 2005
@@ -4,17 +4,17 @@
def test_failing_import_execfile():
fn = datadir / 'failingimport.py'
- col = py.test2.Module(fn)
+ col = py.test.Module(fn)
def _import():
- py.test2.raises(ImportError, col.run)
+ py.test.raises(ImportError, col.run)
_import()
_import()
def XXXtest_finds_root():
fn = datadir / 'filetest.py'
- col = py.test2.Module(fn)
+ col = py.test.Module(fn)
root, namelist = col.fromroot()
- assert isinstance(root, py.test2.Directory)
+ assert isinstance(root, py.test.Directory)
cur = root
for x in namelist:
cur = cur.join(x)
@@ -24,7 +24,7 @@
def test_finds_tests():
fn = datadir / 'filetest.py'
- col = py.test2.Module(fn)
+ col = py.test.Module(fn)
l = col.run()
assert len(l) == 2
items = list(col.iteritems())
@@ -35,28 +35,28 @@
assert l[1].fspath == fn
def test_failing_import_directory():
- class MyDirectory(py.test2.Directory):
+ class MyDirectory(py.test.Directory):
filefilter = py.path.checker(fnmatch='testspecial*.py')
l = MyDirectory(datadir).run()
assert len(l) == 1
- assert isinstance(l[0], py.test2.Module)
- py.test2.raises(ImportError, l[0].run)
+ assert isinstance(l[0], py.test.Module)
+ py.test.raises(ImportError, l[0].run)
def test_module_file_not_found():
fn = datadir.join('nada','no')
- col = py.test2.Module(fn)
- py.test2.raises(py.error.ENOENT, col.run)
+ col = py.test.Module(fn)
+ py.test.raises(py.error.ENOENT, col.run)
def test_syntax_error_in_module():
modpath = py.path.extpy(datadir.join('syntax_error.py'))
- col = py.test2.Module(modpath)
- py.test2.raises(SyntaxError, col.run)
+ col = py.test.Module(modpath)
+ py.test.raises(SyntaxError, col.run)
def test_disabled_class():
- col = py.test2.Module(datadir.join('disabled.py'))
+ col = py.test.Module(datadir.join('disabled.py'))
l = col.run()
assert len(l) == 1
- assert isinstance(l[0], py.test2.Class)
+ assert isinstance(l[0], py.test.Class)
assert not l[0].run()
class Testsomeclass:
@@ -66,7 +66,7 @@
#class TestWithCustomItem:
-# class Item(py.test2.Item):
+# class Item(py.test.Item):
# flag = []
# def execute(self, target, *args):
# self.flag.append(42)
@@ -77,7 +77,7 @@
#
def test_generative_simple():
- o = py.test2.config.tmpdir.ensure('generativetest', dir=1)
+ o = py.test.config.tmpdir.ensure('generativetest', dir=1)
tfile = o.join('test_generative.py')
tfile.write(py.code.Source("""
def func1(arg, arg2):
@@ -92,38 +92,38 @@
yield func1, 17, 3*5
yield func1, 42, 6*7
"""))
- col = py.test2.Module(tfile)
+ col = py.test.Module(tfile)
l = col.run()
assert len(l) == 2
generator = l[0]
print l
- assert isinstance(generator, py.test2.Generator)
+ assert isinstance(generator, py.test.Generator)
l2 = generator.run()
assert len(l2) == 2
- assert isinstance(l2[0], py.test2.Function)
- assert isinstance(l2[1], py.test2.Function)
+ assert isinstance(l2[0], py.test.Function)
+ assert isinstance(l2[1], py.test.Function)
assert l2[0].name == '[0]'
assert l2[1].name == '[1]'
classlist = l[1].run()
assert len(classlist) == 1
generator = classlist[0].run()[0]
- assert isinstance(generator, py.test2.Generator)
+ assert isinstance(generator, py.test.Generator)
l2 = generator.run()
assert len(l2) == 2
- assert isinstance(l2[0], py.test2.Function)
- assert isinstance(l2[1], py.test2.Function)
+ assert isinstance(l2[0], py.test.Function)
+ assert isinstance(l2[1], py.test.Function)
assert l2[0].name == '[0]'
assert l2[1].name == '[1]'
def test_custom_collection_from_conftest():
- o = py.test2.config.tmpdir.ensure('customconfigtest', dir=1)
+ o = py.test.config.tmpdir.ensure('customconfigtest', dir=1)
o.ensure('conftest.py').write("""if 1:
import py
- class MyFunction(py.test2.Function):
+ class MyFunction(py.test.Function):
pass
- class Directory(py.test2.Directory):
+ class Directory(py.test.Directory):
def filefilter(self, fspath):
return fspath.check(basestarts='check_')
class myfuncmixin:
@@ -131,10 +131,10 @@
def funcnamefilter(self, name):
return name.startswith('check_')
- class Module(myfuncmixin, py.test2.Module):
+ class Module(myfuncmixin, py.test.Module):
def classnamefilter(self, name):
return name.startswith('CustomTestClass')
- class Instance(myfuncmixin, py.test2.Instance):
+ class Instance(myfuncmixin, py.test.Instance):
pass
""")
o.ensure('somedir', 'check_something').write("""if 1:
@@ -144,7 +144,7 @@
def check_method(self):
assert 23 == 23
""")
- from py.__impl__.test2.collect import getfscollector
+ from py.__impl__.test.collect import getfscollector
items = list(getfscollector(o).iteritems())
assert len(items) == 2
assert items[1].__class__.__name__ == 'MyFunction'
Modified: py/branch/py-collect/test2/testing/test_config.py
==============================================================================
--- py/branch/py-collect/test2/testing/test_config.py (original)
+++ py/branch/py-collect/test2/testing/test_config.py Fri Mar 4 20:13:30 2005
@@ -1,6 +1,6 @@
from __future__ import generators
import py
-config = py.test2.config
+config = py.test.config
class MyClass:
def getoptions(self):
@@ -28,8 +28,8 @@
assert d1 == d2
def test_config_order():
- from py.__impl__.test2 import config
- o = py.test2.config.tmpdir.ensure('configorder', dir=1)
+ from py.__impl__.test import config
+ o = py.test.config.tmpdir.ensure('configorder', dir=1)
o.ensure('conftest.py').write('x=1 ; import py ; py._x = [x]')
o.ensure('a/conftest.py').write('x=2 ; import py ; py._x.append(x)')
o.ensure('a/b/c/conftest.py').write('x=3 ; import py ; py._x.append(x)')
@@ -44,9 +44,9 @@
assert py._x == [1,2,3]
def test_getconfigvalue():
- from py.__impl__.test2 import config
+ from py.__impl__.test import config
cfg = config.Config()
- o = py.test2.config.tmpdir.ensure('configtest', dir=1)
+ o = py.test.config.tmpdir.ensure('configtest', dir=1)
o.ensure('conftest.py').write('x=1')
assert cfg.getconfigvalue(o, 'x') == 1
- py.test2.raises(ValueError, "cfg.getconfigvalue(o, 'y')")
+ py.test.raises(ValueError, "cfg.getconfigvalue(o, 'y')")
Modified: py/branch/py-collect/test2/testing/test_drive.py
==============================================================================
--- py/branch/py-collect/test2/testing/test_drive.py (original)
+++ py/branch/py-collect/test2/testing/test_drive.py Fri Mar 4 20:13:30 2005
@@ -4,48 +4,48 @@
class TestDefaultDriver:
def test_simple(self):
- drive = py.test2.Driver()
+ drive = py.test.Driver()
drive.option.nocapture = True
drive.runpath(datadir / 'filetest.py')
- l = drive.getresults(py.test2.Item.Failed)
+ l = drive.getresults(py.test.Item.Failed)
assert len(l) == 2
- l = drive.getresults(py.test2.Item.Passed)
+ l = drive.getresults(py.test.Item.Passed)
assert not l
class TestTerminalDriver:
def test_terminal(self):
c = StringIO()
- drive = py.test2.TerminalDriver(file=c)
+ drive = py.test.TerminalDriver(file=c)
drive.runpath(datadir / 'filetest.py')
out = c.getvalue()
print "memo"
print drive._memo
print "out"
print out
- l = drive.getresults(py.test2.Item.Failed)
+ l = drive.getresults(py.test.Item.Failed)
assert len(l) == 2
assert out.find('2 failed') != -1
def test_exit_first_problem(self):
- drive = py.test2.TerminalDriver()
+ drive = py.test.TerminalDriver()
if drive.option.usepdb:
- py.test2.skip("options of sub-runs are not isolated")
+ py.test.skip("options of sub-runs are not isolated")
drive.option.exitfirstproblem = True
drive.runpath(str(datadir / 'filetest.py'))
- l = drive.getresults(py.test2.Item.Failed)
+ l = drive.getresults(py.test.Item.Failed)
assert len(l) == 1
- l = drive.getresults(py.test2.Item.Passed)
+ l = drive.getresults(py.test.Item.Passed)
assert not l
def test_collectonly(self):
c = StringIO()
- drive = py.test2.TerminalDriver(file=c)
+ drive = py.test.TerminalDriver(file=c)
drive.option.collectonly = True
drive.runpath(str(datadir / 'filetest.py'))
out = c.getvalue()
print out
- l = drive.getresults(py.test2.Item.Failed)
+ l = drive.getresults(py.test.Item.Failed)
#if l:
# x = l[0][1].excinfo
# print x.exconly()
@@ -56,7 +56,7 @@
assert out.find(line)
def test_order_of_execution():
- o = py.test2.config.tmpdir.ensure('ordertest', dir=1)
+ o = py.test.config.tmpdir.ensure('ordertest', dir=1)
tfile = o.join('test_orderofexecution.py')
tfile.write(py.code.Source("""
l = []
@@ -78,11 +78,11 @@
assert self.reslist == [1,2,1,2,3]
"""))
- drive = py.test2.Driver()
+ drive = py.test.Driver()
drive.runpath(o)
- l = drive.getresults(py.test2.Item.Failed)
+ l = drive.getresults(py.test.Item.Failed)
assert len(l) == 0
- l = drive.getresults(py.test2.Item.Passed)
+ l = drive.getresults(py.test.Item.Passed)
assert len(l) == 7
# also test listnames() here ...
item, result = l[-1]
Modified: py/branch/py-collect/test2/tool/optparse.py
==============================================================================
--- py/branch/py-collect/test2/tool/optparse.py (original)
+++ py/branch/py-collect/test2/tool/optparse.py Fri Mar 4 20:13:30 2005
@@ -69,7 +69,7 @@
import sys, os
import types
-from py.__impl__.test2.tool import textwrap
+from py.__impl__.test.tool import textwrap
class OptParseError (Exception):
def __init__ (self, msg):
Modified: py/branch/py-collect/test2/tool/testing/test_outerrcapture.py
==============================================================================
--- py/branch/py-collect/test2/tool/testing/test_outerrcapture.py (original)
+++ py/branch/py-collect/test2/tool/testing/test_outerrcapture.py Fri Mar 4 20:13:30 2005
@@ -1,6 +1,6 @@
import sys
import py
-from py.__impl__.test2.tool.outerrcapture import SimpleOutErrCapture
+from py.__impl__.test.tool.outerrcapture import SimpleOutErrCapture
def test_capturing_simple():
cap = SimpleOutErrCapture()
@@ -14,7 +14,7 @@
cap = SimpleOutErrCapture()
print "hello"
cap.reset()
- py.test2.raises(AttributeError, "cap.reset()")
+ py.test.raises(AttributeError, "cap.reset()")
def test_capturing_modify_sysouterr_in_between():
oldout = sys.stdout
@@ -37,4 +37,4 @@
cap2 = SimpleOutErrCapture()
print "hello"
cap2.reset()
- py.test2.raises(AttributeError, "cap2.reset()")
+ py.test.raises(AttributeError, "cap2.reset()")
More information about the pytest-commit
mailing list