#271 tests faling in sqlobject-1.3.1

closed-works-for-me
Oleg Broytman
General (125)
5
2014-10-26
2012-06-06
Ian Delaney
No

first is sqlobject/tests/test_sqlbuilder_joins_instances.py line 36.

assert list(SBAddress.select(AND(SBPerson.q.id==SBAddress.q.personID, SBPerson.q.name=='Julia'))) == \ list(SBPerson.selectBy(name='Julia').throughTo.addresses)

Julia is the second name listed in
mod.ppl = inserts(SBPerson, [('James',),
('Julia',)],

Unless I'm wrong the test data has it wrong. It should have the 1st name and then read through .throughTo.addresses).
Repalcing Julia with James sees the test pass.

Second is similar, line :56.

E assert [<SBAddress 2...' personID=2>] == [<SBAddress 3 ...' personID=2>]
E At index 0 diff: <SBAddress 2 city='Chicago' personID=2> != <SBAddress 3 city='Abu Dhabi' personID=2>

Replacing Jilia with James sees it pass.

Third; sqlobject/tests/test_transactions.py line 27
This 1 is REALLY cute. Run it in isolation;
# PYTHONPATH=.:sqlobject/tests/ py.test sqlobject/tests/test_transactions.py
It passes.
======================================================= 2 failed, 2 passed in 0.23 seconds ==================

run the whole test suite

archtester SQLObject-1.3.1 # PYTHONPATH=.:sqlobject/tests/ py.test sqlobject/tests/
TestSOTrans._connection.autoCommit = 'exception'
TestSOTrans(name='joe', connection=trans)
trans.rollback()
trans.begin()
> assert ([n.name for n in TestSOTrans.select(connection=trans)]
== ['bob','tim'])
E assert [] == ['bob', 'tim']
E Right contains more items, first extra item: 'bob'

sqlobject/tests/test_transactions.py:26: AssertionError
and it fails. go figure.

As for the last two I can't figure what's going on here;

____________________________________________________________ test_transaction_delete ____________________________

close = False

def test_transaction_delete(close=False):
if not supports('transactions'):
return
setupClass(TestSOTrans)
trans = TestSOTrans._connection.transaction()
try:
TestSOTrans(name='bob')
bIn = TestSOTrans.byName('bob', connection=trans)
bIn.destroySelf()
bOut = TestSOTrans.select(TestSOTrans.q.name=='bob')
> assert bOut.count() == 1
E assert 0 == 1
E + where 0 = <bound method SelectResults.count of <SelectResults at 19c9810>>()
E + where <bound method SelectResults.count of <SelectResults at 19c9810>> = <SelectResults at 19c9810>.count

sqlobject/tests/test_transactions.py:64: AssertionError
_______________________________________________________ test_transaction_delete_with_close __________________________

def test_transaction_delete_with_close():
> test_transaction_delete(close=True)

sqlobject/tests/test_transactions.py:76:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

close = True

def test_transaction_delete(close=False):
if not supports('transactions'):
return
setupClass(TestSOTrans)
trans = TestSOTrans._connection.transaction()
try:
TestSOTrans(name='bob')
bIn = TestSOTrans.byName('bob', connection=trans)
bIn.destroySelf()
bOut = TestSOTrans.select(TestSOTrans.q.name=='bob')
> assert bOut.count() == 1
E assert 0 == 1
E + where 0 = <bound method SelectResults.count of <SelectResults at 1ca8c50>>()
E + where <bound method SelectResults.count of <SelectResults at 1ca8c50>> = <SelectResults at 1ca8c50>.count

sqlobject/tests/test_transactions.py:64: AssertionError

set close = True OR False, && it fails. The real problem is in

> assert bOut.count() == 1
E assert 0 == 1

so the error msg indicates assert bOut.count() evaluates to 0.
set assert bOut.count() == 0 and it goes completely carzy reporting an out of index error from another core sqlobject func.

I gather test_transaction_delete failure invokes test_transaction_delete_with_close failure, and I have no idea what
assert bOut.count()
need be set to for success. I can't find a value.

Discussion

  • Ian Delaney
    Ian Delaney
    2012-06-06

    • labels: --> 519515
    • milestone: --> SQLObject_from_repository
    • assigned_to: nobody --> novalis_dt
     
  • Oleg Broytman
    Oleg Broytman
    2012-06-22

    • labels: 519515 --> General
    • assigned_to: novalis_dt --> phd
     
  • Oleg Broytman
    Oleg Broytman
    2012-06-24

    Hi. Both tests work for me:

    ============================= test session starts ==============================
    platform linux2 -- Python 2.6.6 -- pytest-1.3.3
    test path 1: test_sqlbuilder_joins_instances.py

    test_sqlbuilder_joins_instances.py .......

    =========================== 7 passed in 0.57 seconds ===========================

    ============================= test session starts ==============================
    platform linux2 -- Python 2.6.6 -- pytest-1.3.3
    test path 1: test_transactions.py

    test_transactions.py ....

    =========================== 4 passed in 0.19 seconds ===========================

    So you problems might be somewhere else.

     
  • Oleg Broytman
    Oleg Broytman
    2012-06-24

    • status: open --> open-works-for-me
     
  • Oleg Broytman
    Oleg Broytman
    2014-10-26

    • status: open-works-for-me --> closed-works-for-me