draft example for skipping py2 and py3 only tests on

a per-module level.
This commit is contained in:
holger krekel 2012-05-23 23:40:41 +02:00
parent f5f3fe54d5
commit 42d63832b7
4 changed files with 30 additions and 0 deletions

View File

@ -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)

View File

@ -0,0 +1,7 @@
def test_exception_syntax():
try:
0/0
except ZeroDivisionError, e:
assert 0, e

Binary file not shown.

View File

@ -0,0 +1,7 @@
def test_exception_syntax():
try:
0/0
except ZeroDivisionError as e:
assert 0, e