[py-svn] r51398 - py/branch/event/py/test2/testing
hpk at codespeak.net
hpk at codespeak.net
Mon Feb 11 21:03:19 CET 2008
Author: hpk
Date: Mon Feb 11 21:03:17 2008
New Revision: 51398
Removed:
py/branch/event/py/test2/testing/test_collectonly.py
py/branch/event/py/test2/testing/test_raises.py
Modified:
py/branch/event/py/test2/testing/test_collect.py
py/branch/event/py/test2/testing/test_outcome.py
Log:
merge test files a bit
Modified: py/branch/event/py/test2/testing/test_collect.py
==============================================================================
--- py/branch/event/py/test2/testing/test_collect.py (original)
+++ py/branch/event/py/test2/testing/test_collect.py Mon Feb 11 21:03:17 2008
@@ -4,6 +4,8 @@
from py.__.test2.outcome import Skipped, Failed, Passed, Outcome
from py.__.test2.terminal.out import getout
from py.__.test2.repevent import ItemFinish
+from test_session import getevents_runmain
+from py.__.test2 import repevent
def getpassed(session):
hub = session.config.hub
@@ -474,5 +476,41 @@
col = py.test2.collect.Directory(tmpdir)
names = col.run()
assert names == fnames
+
+class TestCollectonly:
+ def setup_class(cls):
+ tmp = py.test2.ensuretemp('itemgentest')
+ tmp.ensure("__init__.py")
+ tmp.ensure("test_one.py").write(py.code.Source("""
+ def test_one():
+ pass
+
+ class TestX:
+ def test_method_one(self):
+ pass
+
+ class TestY(TestX):
+ pass
+ """))
+ tmp.ensure("test_two.py").write(py.code.Source("""
+ import py
+ py.test.skip('xxx')
+ """))
+ tmp.ensure("test_three.py").write("xxxdsadsadsadsa")
+ cls.tmp = tmp
+
+ def test_collectonly(self):
+ config = py.test2.config._reparse([self.tmp, '--collectonly'])
+ session = config.initsession()
+ # test it all in once
+ allevents = getevents_runmain(session)
+ started = finished = 0
+ for event in allevents:
+ assert not isinstance(event, repevent.ItemFinish)
+ if isinstance(event, repevent.CollectionStart):
+ started += 1
+ elif isinstance(event, repevent.CollectionFinish):
+ finished += 1
-
+ print started
+ assert started == finished
Deleted: /py/branch/event/py/test2/testing/test_collectonly.py
==============================================================================
--- /py/branch/event/py/test2/testing/test_collectonly.py Mon Feb 11 21:03:17 2008
+++ (empty file)
@@ -1,44 +0,0 @@
-
-import py
-
-
-from test_session import getevents_runmain
-from py.__.test2 import repevent
-
-class TestCollectonly:
- def setup_class(cls):
- tmp = py.test2.ensuretemp('itemgentest')
- tmp.ensure("__init__.py")
- tmp.ensure("test_one.py").write(py.code.Source("""
- def test_one():
- pass
-
- class TestX:
- def test_method_one(self):
- pass
-
- class TestY(TestX):
- pass
- """))
- tmp.ensure("test_two.py").write(py.code.Source("""
- import py
- py.test.skip('xxx')
- """))
- tmp.ensure("test_three.py").write("xxxdsadsadsadsa")
- cls.tmp = tmp
-
- def test_collectonly(self):
- config = py.test2.config._reparse([self.tmp, '--collectonly'])
- session = config.initsession()
- # test it all in once
- allevents = getevents_runmain(session)
- started = finished = 0
- for event in allevents:
- assert not isinstance(event, repevent.ItemFinish)
- if isinstance(event, repevent.CollectionStart):
- started += 1
- elif isinstance(event, repevent.CollectionFinish):
- finished += 1
-
- print started
- assert started == finished
Modified: py/branch/event/py/test2/testing/test_outcome.py
==============================================================================
--- py/branch/event/py/test2/testing/test_outcome.py (original)
+++ py/branch/event/py/test2/testing/test_outcome.py Mon Feb 11 21:03:17 2008
@@ -68,3 +68,16 @@
s = repr(out)
assert s.lower().find("skip") != -1
+class TestRaises:
+ def test_raises(self):
+ py.test.raises(ValueError, "int('qwe')")
+
+ def test_raises_exec(self):
+ py.test.raises(ValueError, "a,x = []")
+
+ def test_raises_syntax_error(self):
+ py.test.raises(SyntaxError, "qwe qwe qwe")
+
+ def test_raises_function(self):
+ py.test.raises(ValueError, int, 'hello')
+
Deleted: /py/branch/event/py/test2/testing/test_raises.py
==============================================================================
--- /py/branch/event/py/test2/testing/test_raises.py Mon Feb 11 21:03:17 2008
+++ (empty file)
@@ -1,18 +0,0 @@
-from py import test
-
-def somefunc(x, y):
- assert x == y
-
-class TestClass:
- def test_raises(self):
- test.raises(ValueError, "int('qwe')")
-
- def test_raises_exec(self):
- test.raises(ValueError, "a,x = []")
-
- def test_raises_syntax_error(self):
- test.raises(SyntaxError, "qwe qwe qwe")
-
- def test_raises_function(self):
- test.raises(ValueError, int, 'hello')
-
More information about the pytest-commit
mailing list