[py-svn] commit/pytest: hpk42: draft example for skipping py2 and py3 only tests on

Bitbucket commits-noreply at bitbucket.org
Wed May 23 23:40:51 CEST 2012


1 new commit in pytest:


https://bitbucket.org/hpk42/pytest/changeset/79a5b776a6f3/
changeset:   79a5b776a6f3
user:        hpk42
date:        2012-05-23 23:40:41
summary:     draft example for skipping py2 and py3 only tests on
a per-module level.
affected #:  4 files

diff -r 1433a6971560ecce6d9ae0bebbb13d66ba6eacfa -r 79a5b776a6f3f34f8699e130cfe5440b1ff67336 doc/example/py2py3/conftest.py
--- /dev/null
+++ b/doc/example/py2py3/conftest.py
@@ -0,0 +1,16 @@
+import sys
+import pytest
+
+py3 = sys.version_info[0] >= 3
+
+class DummyCollector(pytest.collect.File):
+    def collect(self):
+        return []
+
+def pytest_pycollect_makemodule(path, parent):
+    bn = path.basename
+    if "py3" in bn and not py3 or ("py2" in bn and py3):
+        return DummyCollector(path, parent=parent)
+
+
+


diff -r 1433a6971560ecce6d9ae0bebbb13d66ba6eacfa -r 79a5b776a6f3f34f8699e130cfe5440b1ff67336 doc/example/py2py3/test_py2.py
--- /dev/null
+++ b/doc/example/py2py3/test_py2.py
@@ -0,0 +1,7 @@
+
+def test_exception_syntax():
+    try:
+        0/0
+    except ZeroDivisionError, e:
+        assert 0, e
+


diff -r 1433a6971560ecce6d9ae0bebbb13d66ba6eacfa -r 79a5b776a6f3f34f8699e130cfe5440b1ff67336 doc/example/py2py3/test_py2.pyc
Binary file doc/example/py2py3/test_py2.pyc has changed


diff -r 1433a6971560ecce6d9ae0bebbb13d66ba6eacfa -r 79a5b776a6f3f34f8699e130cfe5440b1ff67336 doc/example/py2py3/test_py3.py
--- /dev/null
+++ b/doc/example/py2py3/test_py3.py
@@ -0,0 +1,7 @@
+
+def test_exception_syntax():
+    try:
+        0/0
+    except ZeroDivisionError as e:
+        assert 0, e
+

Repository URL: https://bitbucket.org/hpk42/pytest/

--

This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.



More information about the pytest-commit mailing list