Skip to content

Commit b1de2ed

Browse files
committed
Merge branch 'pytest-skip' into flake8-fixes
2 parents 6720c05 + b959a26 commit b1de2ed

22 files changed

Lines changed: 169 additions & 151 deletions

sqlobject/inheritance/tests/test_deep_inheritance.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from py.test import raises
1+
from py.test import raises, skip
22
from sqlobject import *
33
from sqlobject.tests.dbtest import *
44
from sqlobject.inheritance import InheritableSQLObject
@@ -52,7 +52,7 @@ def test_creation_fail2():
5252
assert persons.count() == 1
5353

5454
if not supports('transactions'):
55-
return
55+
skip("Transactions aren't supported")
5656
transaction = DIPerson._connection.transaction()
5757
kwargs ={'firstName': 'John', 'lastName': 'Doe III', 'position': 'Project Manager'}
5858
raises(Exception, DIManager, connection=transaction, **kwargs)

sqlobject/tests/dbtest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def getcwd():
2929
3030
def test_featureX():
3131
if not supports('featureX'):
32-
return
32+
py.test.skip("Doesn't support featureX")
3333
"""
3434
supportsMatrix = {
3535
'+exceptions': 'mysql postgres sqlite',

sqlobject/tests/test_SQLMultipleJoin.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import py.test
12
from sqlobject import *
23
from sqlobject.tests.dbtest import *
34

@@ -44,7 +45,7 @@ def test_1():
4445

4546
def test_multiple_join_transaction():
4647
if not supports('transactions'):
47-
return
48+
py.test.skip("Transactions aren't supported")
4849
createAllTables()
4950
trans = Race._connection.transaction()
5051
try:

sqlobject/tests/test_SQLRelatedJoin.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import py.test
12
from sqlobject import *
23
from sqlobject.tests.dbtest import *
34

@@ -45,7 +46,7 @@ def test_1():
4546

4647
def test_related_join_transaction():
4748
if not supports('transactions'):
48-
return
49+
py.test.skip("Transactions aren't supported")
4950
createAllTables()
5051
trans = Tourtment._connection.transaction()
5152
try:

sqlobject/tests/test_basic.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import py.test
12
from sqlobject import *
23
from sqlobject.tests.dbtest import *
34

@@ -188,7 +189,7 @@ def test_foreignKeyDestroySelfCascade():
188189

189190
def testForeignKeyDropTableCascade():
190191
if not supports('dropTableCascade'):
191-
return
192+
py.test.skip("dropTableCascade isn't supported")
192193
setupClass(TestSO7)
193194
setupClass(TestSO6)
194195
setupClass(TestSO5)

sqlobject/tests/test_blob.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import py.test
12
from sqlobject import *
23
from sqlobject.tests.dbtest import *
34

@@ -10,7 +11,7 @@ class ImageData(SQLObject):
1011

1112
def test_BLOBCol():
1213
if not supports('blobData'):
13-
return
14+
py.test.skip("blobData isn't supported")
1415
setupClass(ImageData)
1516
data = ''.join([chr(x) for x in range(256)])
1617

sqlobject/tests/test_cyclic_reference.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import py.test
12
from sqlobject import *
23
from sqlobject.tests.dbtest import *
34

@@ -25,7 +26,7 @@ class sqlmeta(sqlmeta):
2526

2627
def test_cyclic_reference():
2728
if not supports('dropTableCascade'):
28-
return
29+
py.test.skip("dropTableCascade isn't supported")
2930
conn = getConnection()
3031
TestCyclicReferenceA.setConnection(conn)
3132
TestCyclicReferenceB.setConnection(conn)

sqlobject/tests/test_decimal.py

Lines changed: 37 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
# -*- coding: koi8-r -*-
2-
31
from decimal import Decimal
42
from sqlobject import *
53
from sqlobject.tests.dbtest import *
@@ -8,44 +6,47 @@
86
## Decimal columns
97
########################################
108

9+
if not supports('decimalColumn'):
10+
import py.test
11+
pytestmark = py.test.mark.skipif('True')
12+
1113
class DecimalTable(SQLObject):
1214
name = UnicodeCol(length=255)
1315
col1 = DecimalCol(size=6, precision=4)
1416
col2 = DecimalStringCol(size=6, precision=4)
1517
col3 = DecimalStringCol(size=6, precision=4, quantize=True)
1618

17-
if supports('decimalColumn'):
18-
def test_1_decimal():
19-
setupClass(DecimalTable)
20-
d = DecimalTable(name='test', col1=21.12, col2='10.01', col3='10.01')
21-
# psycopg2 returns float as Decimal
22-
if isinstance(d.col1, Decimal):
23-
assert d.col1 == Decimal("21.12")
24-
else:
25-
assert d.col1 == 21.12
26-
assert d.col2 == Decimal("10.01")
27-
assert DecimalTable.sqlmeta.columns['col2'].to_python('10.01',
28-
d._SO_validatorState) == Decimal("10.01")
29-
assert DecimalTable.sqlmeta.columns['col2'].from_python('10.01',
30-
d._SO_validatorState) == "10.01"
31-
assert d.col3 == Decimal("10.01")
32-
assert DecimalTable.sqlmeta.columns['col3'].to_python('10.01',
33-
d._SO_validatorState) == Decimal("10.01")
34-
assert DecimalTable.sqlmeta.columns['col3'].from_python('10.01',
35-
d._SO_validatorState) == "10.0100"
36-
37-
def test_2_decimal():
38-
setupClass(DecimalTable)
39-
d = DecimalTable(name='test', col1=Decimal("21.12"),
40-
col2=Decimal('10.01'), col3=Decimal('10.01'))
19+
def test_1_decimal():
20+
setupClass(DecimalTable)
21+
d = DecimalTable(name='test', col1=21.12, col2='10.01', col3='10.01')
22+
# psycopg2 returns float as Decimal
23+
if isinstance(d.col1, Decimal):
4124
assert d.col1 == Decimal("21.12")
42-
assert d.col2 == Decimal("10.01")
43-
assert DecimalTable.sqlmeta.columns['col2'].to_python(Decimal('10.01'),
44-
d._SO_validatorState) == Decimal("10.01")
45-
assert DecimalTable.sqlmeta.columns['col2'].from_python(Decimal('10.01'),
46-
d._SO_validatorState) == "10.01"
47-
assert d.col3 == Decimal("10.01")
48-
assert DecimalTable.sqlmeta.columns['col3'].to_python(Decimal('10.01'),
49-
d._SO_validatorState) == Decimal("10.01")
50-
assert DecimalTable.sqlmeta.columns['col3'].from_python(Decimal('10.01'),
51-
d._SO_validatorState) == "10.0100"
25+
else:
26+
assert d.col1 == 21.12
27+
assert d.col2 == Decimal("10.01")
28+
assert DecimalTable.sqlmeta.columns['col2'].to_python('10.01',
29+
d._SO_validatorState) == Decimal("10.01")
30+
assert DecimalTable.sqlmeta.columns['col2'].from_python('10.01',
31+
d._SO_validatorState) == "10.01"
32+
assert d.col3 == Decimal("10.01")
33+
assert DecimalTable.sqlmeta.columns['col3'].to_python('10.01',
34+
d._SO_validatorState) == Decimal("10.01")
35+
assert DecimalTable.sqlmeta.columns['col3'].from_python('10.01',
36+
d._SO_validatorState) == "10.0100"
37+
38+
def test_2_decimal():
39+
setupClass(DecimalTable)
40+
d = DecimalTable(name='test', col1=Decimal("21.12"),
41+
col2=Decimal('10.01'), col3=Decimal('10.01'))
42+
assert d.col1 == Decimal("21.12")
43+
assert d.col2 == Decimal("10.01")
44+
assert DecimalTable.sqlmeta.columns['col2'].to_python(Decimal('10.01'),
45+
d._SO_validatorState) == Decimal("10.01")
46+
assert DecimalTable.sqlmeta.columns['col2'].from_python(Decimal('10.01'),
47+
d._SO_validatorState) == "10.01"
48+
assert d.col3 == Decimal("10.01")
49+
assert DecimalTable.sqlmeta.columns['col3'].to_python(Decimal('10.01'),
50+
d._SO_validatorState) == Decimal("10.01")
51+
assert DecimalTable.sqlmeta.columns['col3'].from_python(Decimal('10.01'),
52+
d._SO_validatorState) == "10.0100"

sqlobject/tests/test_empty.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import py.test
12
from sqlobject import *
23
from sqlobject.tests.dbtest import *
34

@@ -7,7 +8,7 @@ class EmptyClass(SQLObject):
78

89
def test_empty():
910
if not supports('emptyTable'):
10-
return
11+
py.test.skip("emptyTable isn't supported")
1112
setupClass(EmptyClass)
1213
e1 = EmptyClass()
1314
e2 = EmptyClass()

sqlobject/tests/test_exceptions.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import py.test
12
from sqlobject import *
23
from sqlobject.dberrors import *
34
from sqlobject.tests.dbtest import *
@@ -14,7 +15,7 @@ class TestExceptionWithNonexistingTable(SQLObject):
1415

1516
def test_exceptions():
1617
if not supports("exceptions"):
17-
return
18+
py.test.skip("exceptions aren't supported")
1819
setupClass(TestException)
1920
TestException(name="test")
2021
raises(DuplicateEntryError, TestException, name="test")

0 commit comments

Comments
 (0)