Regress test failures on OpenBSD -current/(amd64|sparc64)

Issue #457 resolved
Former user created an issue

I'm porting the latest release of sqlalchemy to OpenBSD and have run into test failures on the amd64 and sparc64 platforms. OpenBSD ships with Python 2.4.3, which is used to run the tests. The port's Makefile runs the tests using the following:

PYTHONPATH=./test/ ${MODPY_BIN} test/alltests.py --db sqlite

${MODPY_BIN} points to the Python 2.4.3 executable.

These tests fail:

testforupdate (sql.select.SelectTest) ... FAIL
testorderby (orm.mapper.EagerTest) ... FAIL
testorderby_desc (orm.mapper.EagerTest) ... FAIL
Doctest: sqlalchemy.ext.sqlsoup ... FAIL

And this test errors:

testbadargs (engine.parseconnect.CreateEngineTest) ... ERROR

I'm happy to test patches; I'll keep looking and see if I can find the problem.

Thanks!

Here's the log of the failing regress tests:

======================================================================                                                                       
ERROR: testbadargs (engine.parseconnect.CreateEngineTest)                                                                                    
----------------------------------------------------------------------                                                                       
Traceback (most recent call last):                                                                                                           
  File "/home/smestdag/objports/py-sqlalchemy-0.3.3/SQLAlchemy-0.3.3/test/engine/parseconnect.py", line 101, in testbadargs                  
    e = create_engine('mysql://', use_unicode=True)                                                                                          
  File "./lib/sqlalchemy/engine/__init__.py", line 91, in create_engine                                                                      
    return strategy.create(*args, **kwargs)                                                                                                  
  File "./lib/sqlalchemy/engine/strategies.py", line 44, in create                                                                           
    (cargs, cparams) = dialect.create_connect_args(u)                                                                                        
  File "./lib/sqlalchemy/databases/mysql.py", line 276, in create_connect_args                                                               
    client_flag |= CLIENT_FLAGS.FOUND_ROWS                                                                                                   
NameError: global name 'CLIENT_FLAGS' is not defined

======================================================================                                                                       
FAIL: testforupdate (sql.select.SelectTest)                                                                                                  
----------------------------------------------------------------------                                                                       
Traceback (most recent call last):                                                                                                           
  File "/home/smestdag/objports/py-sqlalchemy-0.3.3/SQLAlchemy-0.3.3/test/sql/select.py", line 258, in testforupdate                         
    self.runtest(table1.select(table1.c.myid==7, for_update="read"), "SELECT mytable.myid, mytable.name, mytable.description FROM mytable    
+WHERE mytable.myid = %s LOCK IN SHARE MODE", dialect=mysql.dialect())                                                                       
  File "/home/smestdag/objports/py-sqlalchemy-0.3.3/SQLAlchemy-0.3.3/test/sql/select.py", line 58, in runtest                                
    self.assert_(cc == result, "\n'" + cc + "'\n does not match \n'" + result + "'")                                                         
AssertionError:                                                                                                                              
'SELECT mytable.myid, mytable.name, mytable.description FROM mytable WHERE mytable.myid = :mytable_myid LOCK IN SHARE MODE'                  
 does not match                                                                                                                              
'SELECT mytable.myid, mytable.name, mytable.description FROM mytable WHERE mytable.myid = %s LOCK IN SHARE MODE'

======================================================================                                                                       
FAIL: testorderby (orm.mapper.EagerTest)                                                                                                     
----------------------------------------------------------------------                                                                       
Traceback (most recent call last):                                                                                                           
  File "/home/smestdag/objports/py-sqlalchemy-0.3.3/SQLAlchemy-0.3.3/test/orm/mapper.py", line 942, in testorderby                           
    {'user_id' : 9, 'addresses' : (Address, [                                                                                            
  File "/home/smestdag/objports/py-sqlalchemy-0.3.3/SQLAlchemy-0.3.3/test/testbase.py", line 172, in assert_result                           
    self.assert_list(result, class_, objects)                                                                                                
  File "/home/smestdag/objports/py-sqlalchemy-0.3.3/SQLAlchemy-0.3.3/test/testbase.py", line 176, in assert_list                             
    self.assert_row(class_, result[i](])}), list[i](i))                                                                                              
  File "/home/smestdag/objports/py-sqlalchemy-0.3.3/SQLAlchemy-0.3.3/test/testbase.py", line 182, in assert_row                              
    self.assert_list(getattr(rowobj, key), value[0](0), value[1](1))                                                                               
  File "/home/smestdag/objports/py-sqlalchemy-0.3.3/SQLAlchemy-0.3.3/test/testbase.py", line 176, in assert_list                             
    self.assert_row(class_, result[i](i), list[i](i))                                                                                              
  File "/home/smestdag/objports/py-sqlalchemy-0.3.3/SQLAlchemy-0.3.3/test/testbase.py", line 186, in assert_row                              
    self.assert_(getattr(rowobj, key) == value, "attribute %s value %s does not match %s" % (key, getattr(rowobj, key), value))              
AssertionError: attribute email_address value ed@wood.com does not match ed@bettyboop.com

======================================================================                                                                       
FAIL: testorderby_desc (orm.mapper.EagerTest)                                                                                                
----------------------------------------------------------------------                                                                       
Traceback (most recent call last):                                                                                                           
  File "/home/smestdag/objports/py-sqlalchemy-0.3.3/SQLAlchemy-0.3.3/test/orm/mapper.py", line 971, in testorderby_desc                      
    {'user_id' : 9, 'addresses' : (Address, [                                                                                           
  File "/home/smestdag/objports/py-sqlalchemy-0.3.3/SQLAlchemy-0.3.3/test/testbase.py", line 172, in assert_result                           
    self.assert_list(result, class_, objects)                                                                                                
  File "/home/smestdag/objports/py-sqlalchemy-0.3.3/SQLAlchemy-0.3.3/test/testbase.py", line 176, in assert_list                             
    self.assert_row(class_, result[i](])},), list[i](i))                                                                                              
  File "/home/smestdag/objports/py-sqlalchemy-0.3.3/SQLAlchemy-0.3.3/test/testbase.py", line 182, in assert_row                              
    self.assert_list(getattr(rowobj, key), value[0](0), value[1](1))                                                                               
  File "/home/smestdag/objports/py-sqlalchemy-0.3.3/SQLAlchemy-0.3.3/test/testbase.py", line 176, in assert_list                             
    self.assert_row(class_, result[i](i), list[i](i))                                                                                              
  File "/home/smestdag/objports/py-sqlalchemy-0.3.3/SQLAlchemy-0.3.3/test/testbase.py", line 186, in assert_row                              
    self.assert_(getattr(rowobj, key) == value, "attribute %s value %s does not match %s" % (key, getattr(rowobj, key), value))              
AssertionError: attribute email_address value ed@bettyboop.com does not match ed@lala.com

======================================================================                                                                       
FAIL: Doctest: sqlalchemy.ext.sqlsoup                                                                                                        
----------------------------------------------------------------------                                                                       
Traceback (most recent call last):                                                                                                           
  File "/usr/local/lib/python2.4/doctest.py", line 2157, in runTest                                                                          
    raise self.failureException(self.format_failure(new.getvalue()))                                                                         
AssertionError: Failed doctest test for sqlalchemy.ext.sqlsoup                                                                               
  File "./lib/sqlalchemy/ext/sqlsoup.py", line 0, in sqlsoup

----------------------------------------------------------------------                                                                       
File "./lib/sqlalchemy/ext/sqlsoup.py", line 38, in sqlalchemy.ext.sqlsoup                                                                   
Failed example:                                                                                                                              
    users                                                                                                                                    
Exception raised:                                                                                                                            
    Traceback (most recent call last):                                                                                                       
      File "/usr/local/lib/python2.4/doctest.py", line 1248, in __run                                                                        
        compileflags, 1) in test.globs                                                                                                       
      File "<doctest sqlalchemy.ext.sqlsoup[8](8)>", line 1, in ?                                                                               
        users                                                                                                                                
      File "./lib/sqlalchemy/ext/sqlsoup.py", line 358, in __repr__                                                                          
        value = value.encode(encoding)                                                                                                       
    TypeError: encode() argument 1 must be string, not None                                                                                  
----------------------------------------------------------------------                                                                       
File "./lib/sqlalchemy/ext/sqlsoup.py", line 43, in sqlalchemy.ext.sqlsoup                                                                   
Failed example:                                                                                                                              
    db.users.select(order_by=[db.users.c.name](db.users.c.name))                                                                                              
Exception raised:                                                                                                                            
    Traceback (most recent call last):                                                                                                       
      File "/usr/local/lib/python2.4/doctest.py", line 1248, in __run                                                                        
        compileflags, 1) in test.globs                                                                                                       
      File "<doctest sqlalchemy.ext.sqlsoup[9](9)>", line 1, in ?                                                                               
        db.users.select(order_by=[db.users.c.name](db.users.c.name))                                                                                          
      File "./lib/sqlalchemy/ext/sqlsoup.py", line 358, in __repr__                                                                          
        value = value.encode(encoding)                                                                                                       
    TypeError: encode() argument 1 must be string, not None                                                                                  
----------------------------------------------------------------------                                                                       
File "./lib/sqlalchemy/ext/sqlsoup.py", line 56, in sqlalchemy.ext.sqlsoup                                                                   
Failed example:                                                                                                                              
    db.users.select(where, order_by=[desc(db.users.c.name)](desc(db.users.c.name)))                                                                                 
Exception raised:                                                                                                                            
    Traceback (most recent call last):                                                                                                       
      File "/usr/local/lib/python2.4/doctest.py", line 1248, in __run                                                                        
        compileflags, 1) in test.globs                                                                                                       
      File "<doctest sqlalchemy.ext.sqlsoup[13](13)>", line 1, in ?                                                                              
        db.users.select(where, order_by=[desc(db.users.c.name)](desc(db.users.c.name)))                                                                             
      File "./lib/sqlalchemy/ext/sqlsoup.py", line 358, in __repr__                                                                          
        value = value.encode(encoding)                                                                                                       
    TypeError: encode() argument 1 must be string, not None                                                                                  
----------------------------------------------------------------------                                                                       
File "./lib/sqlalchemy/ext/sqlsoup.py", line 62, in sqlalchemy.ext.sqlsoup                                                                   
Failed example:                                                                                                                              
    db.users.selectone_by(name='Bhargan Basepair')                                                                                           
Exception raised:                                                                                                                            
    Traceback (most recent call last):                                                                                                       
      File "/usr/local/lib/python2.4/doctest.py", line 1248, in __run                                                                        
        compileflags, 1) in test.globs                                                                                                       
      File "<doctest sqlalchemy.ext.sqlsoup[14](14)>", line 1, in ?                                                                              
        db.users.selectone_by(name='Bhargan Basepair')                                                                                       
      File "./lib/sqlalchemy/ext/sqlsoup.py", line 358, in __repr__                                                                          
        value = value.encode(encoding)                                                                                                       
    TypeError: encode() argument 1 must be string, not None                                                                                  
----------------------------------------------------------------------                                                                       
File "./lib/sqlalchemy/ext/sqlsoup.py", line 91, in sqlalchemy.ext.sqlsoup                                                                   
Failed example:                                                                                                                              
    user.email = 'basepair+nospam@example.edu'                                                                                               
Exception raised:                                                                                                                            
    Traceback (most recent call last):                                                                                                       
      File "/usr/local/lib/python2.4/doctest.py", line 1248, in __run                                                                        
        compileflags, 1) in test.globs                                                                                                       
      File "<doctest sqlalchemy.ext.sqlsoup[16](16)>", line 1, in ?                                                                              
        user.email = 'basepair+nospam@example.edu'                                                                                           
    AttributeError: 'NoneType' object has no attribute 'email'                                                                               
----------------------------------------------------------------------                                                                       
File "./lib/sqlalchemy/ext/sqlsoup.py", line 101, in sqlalchemy.ext.sqlsoup                                                                  
Failed example:                                                                                                                              
    db.loans.insert(book_id=book_id, user_name=user.name)                                                                                    
Exception raised:                                                                                                                            
    Traceback (most recent call last):                                                                                                       
      File "/usr/local/lib/python2.4/doctest.py", line 1248, in __run                                                                        
        compileflags, 1) in test.globs                                                                                                       
      File "<doctest sqlalchemy.ext.sqlsoup[19](19)>", line 1, in ?                                                                              
        db.loans.insert(book_id=book_id, user_name=user.name)                                                                                
    AttributeError: 'NoneType' object has no attribute 'name'                                                                                
----------------------------------------------------------------------                                                                       
File "./lib/sqlalchemy/ext/sqlsoup.py", line 105, in sqlalchemy.ext.sqlsoup                                                                  
Failed example:                                                                                                                              
    loan = db.loans.selectone_by(book_id=2, user_name='Bhargan Basepair')                                                                    
Exception raised:                                                                                                                            
    Traceback (most recent call last):                                                                                                       
      File "/usr/local/lib/python2.4/doctest.py", line 1248, in __run                                                                        
        compileflags, 1) in test.globs                                                                                                       
      File "<doctest sqlalchemy.ext.sqlsoup[21](21)>", line 1, in ?                                                                              
        loan = db.loans.selectone_by(book_id=2, user_name='Bhargan Basepair')                                                                
      File "./lib/sqlalchemy/orm/query.py", line 201, in selectone_by                                                                        
        raise exceptions.InvalidRequestError('No rows returned for selectone_by')                                                            
    InvalidRequestError: No rows returned for selectone_by                                                                                   
----------------------------------------------------------------------                                                                       
File "./lib/sqlalchemy/ext/sqlsoup.py", line 106, in sqlalchemy.ext.sqlsoup                                                                  
Failed example:                                                                                                                              
    db.delete(loan)                                                                                                                          
Exception raised:                                                                                                                            
    Traceback (most recent call last):                                                                                                       
      File "/usr/local/lib/python2.4/doctest.py", line 1248, in __run                                                                        
        compileflags, 1) in test.globs                                                                                                       
      File "<doctest sqlalchemy.ext.sqlsoup[22](22)>", line 1, in ?                                                                              
        db.delete(loan)                                                                                                                      
    NameError: name 'loan' is not defined                                                                                                    
----------------------------------------------------------------------                                                                       
File "./lib/sqlalchemy/ext/sqlsoup.py", line 115, in sqlalchemy.ext.sqlsoup                                                                  
Failed example:                                                                                                                              
    db.loans.insert(book_id=book_id, user_name=user.name)                                                                                    
Exception raised:                                                                                                                            
    Traceback (most recent call last):                                                                                                       
      File "/usr/local/lib/python2.4/doctest.py", line 1248, in __run                                                                        
        compileflags, 1) in test.globs                                                                                                       
      File "<doctest sqlalchemy.ext.sqlsoup[24](24)>", line 1, in ?                                                                              
        db.loans.insert(book_id=book_id, user_name=user.name)                                                                                
    AttributeError: 'NoneType' object has no attribute 'name'                                                                                
----------------------------------------------------------------------                                                                       
File "./lib/sqlalchemy/ext/sqlsoup.py", line 123, in sqlalchemy.ext.sqlsoup                                                                  
Failed example:                                                                                                                              
    db.loans.select_by(db.loans.c.book_id==1)                                                                                                
Exception raised:                                                                                                                            
    Traceback (most recent call last):                                                                                                       
      File "/usr/local/lib/python2.4/doctest.py", line 1248, in __run                                                                        
        compileflags, 1) in test.globs                                                                                                       
      File "<doctest sqlalchemy.ext.sqlsoup[28](28)>", line 1, in ?                                                                              
        db.loans.select_by(db.loans.c.book_id==1)                                                                                            
      File "./lib/sqlalchemy/ext/sqlsoup.py", line 358, in __repr__                                                                          
        value = value.encode(encoding)                                                                                                       
    TypeError: encode() argument 1 must be string, not None                                                                                  
----------------------------------------------------------------------                                                                       
File "./lib/sqlalchemy/ext/sqlsoup.py", line 138, in sqlalchemy.ext.sqlsoup                                                                  
Failed example:                                                                                                                              
    join1.select_by(name='Joe Student')                                                                                                      
Exception raised:                                                                                                                            
    Traceback (most recent call last):                                                                                                       
      File "/usr/local/lib/python2.4/doctest.py", line 1248, in __run                                                                        
        compileflags, 1) in test.globs                                                                                                       
      File "<doctest sqlalchemy.ext.sqlsoup[30](30)>", line 1, in ?                                                                              
        join1.select_by(name='Joe Student')                                                                                                  
      File "./lib/sqlalchemy/ext/sqlsoup.py", line 358, in __repr__                                                                          
        value = value.encode(encoding)                                                                                                       
    TypeError: encode() argument 1 must be string, not None                                                                                  
----------------------------------------------------------------------                                                                       
File "./lib/sqlalchemy/ext/sqlsoup.py", line 153, in sqlalchemy.ext.sqlsoup                                                                  
Failed example:                                                                                                                              
    join2.select()                                                                                                                           
Exception raised:                                                                                                                            
    Traceback (most recent call last):                                                                                                       
      File "/usr/local/lib/python2.4/doctest.py", line 1248, in __run                                                                        
        compileflags, 1) in test.globs                                                                                                       
      File "<doctest sqlalchemy.ext.sqlsoup[33](33)>", line 1, in ?                                                                              
        join2.select()                                                                                                                       
      File "./lib/sqlalchemy/ext/sqlsoup.py", line 358, in __repr__                                                                          
        value = value.encode(encoding)                                                                                                       
    TypeError: encode() argument 1 must be string, not None                                                                                  
----------------------------------------------------------------------                                                                       
File "./lib/sqlalchemy/ext/sqlsoup.py", line 176, in sqlalchemy.ext.sqlsoup                                                                  
Failed example:                                                                                                                              
    years_with_count.select_by(published_year='1989')                                                                                        
Exception raised:                                                                                                                            
    Traceback (most recent call last):                                                                                                       
      File "/usr/local/lib/python2.4/doctest.py", line 1248, in __run                                                                        
        compileflags, 1) in test.globs                                                                                                       
      File "<doctest sqlalchemy.ext.sqlsoup[40](40)>", line 1, in ?                                                                              
        years_with_count.select_by(published_year='1989')                                                                                    
      File "./lib/sqlalchemy/ext/sqlsoup.py", line 358, in __repr__                                                                          
        value = value.encode(encoding)                                                                                                       
    TypeError: encode() argument 1 must be string, not None                                                                                  
----------------------------------------------------------------------                                                                       
File "./lib/sqlalchemy/ext/sqlsoup.py", line 191, in sqlalchemy.ext.sqlsoup                                                                  
Failed example:                                                                                                                              
    for name, email in rp.fetchall(): print name, email                                                                                      
Expected:                                                                                                                                    
    Bhargan Basepair basepair+nospam@example.edu                                                                                             
    Joe Student student@example.edu                                                                                                          
Got:                                                                                                                                         
    Bhargan Basepair basepair@example.edu                                                                                                    
    Joe Student student@example.edu                                                                                                          
----------------------------------------------------------------------                                                                       
File "./lib/sqlalchemy/ext/sqlsoup.py", line 203, in sqlalchemy.ext.sqlsoup                                                                  
Failed example:                                                                                                                              
    db.users.select(db.users.c.classname==None, order_by=[db.users.c.name](db.users.c.name))                                                                  
Exception raised:                                                                                                                            
    Traceback (most recent call last):                                                                                                       
      File "/usr/local/lib/python2.4/doctest.py", line 1248, in __run                                                                        
        compileflags, 1) in test.globs                                                                                                       
      File "<doctest sqlalchemy.ext.sqlsoup[43](43)>", line 1, in ?                                                                              
        db.users.select(db.users.c.classname==None, order_by=[db.users.c.name](db.users.c.name))                                                              
      File "./lib/sqlalchemy/ext/sqlsoup.py", line 358, in __repr__                                                                          
        value = value.encode(encoding)                                                                                                       
    TypeError: encode() argument 1 must be string, not None


----------------------------------------------------------------------                                                                       
Ran 427 tests in 14.883s

FAILED (failures=4, errors=1)

Comments (12)

  1. Mike Bayer repo owner

    some of those errors are related to the fact that one system had MySQLDB installed and another does not, so its getting unexpected behavior for what it thinks is a mysql dbapi. the sqlsoup issue im not sure about but all those errors seem to stem from one source. and the others I suspect are due to your pysqlite and/or sqlite version, since certain versions of sqlite have ordering issues. any changes there ?

  2. Mike Bayer repo owner

    also 0.3.4 is the latest release and those stack traces seem to be against an 0.3.3 installation.

  3. Former user Account Deleted

    Thanks for the feedback. Looks like we need to have py-mysql present for the regress tests to work (even when run, as above, with --db sqlite). With that change, I only get the sqlsoup failure on 0.3.4.

    I think the sqlsoup failure is the same on 0.3.4 as on 0.3.3, but I'll attach a log in case there's a difference I'm overlooking. Anything I should do to make hunting down the sqlsoup stuff easier?

    Thanks!

  4. Mike Bayer repo owner

    well thats a little weird about the pyMySQL because if I force the import to fail in mysql.py, I get the testbadargs and testforupdate failures which make sense, but not the order by or sqlsoup issues. if the ordering issues arise again, you need to look into what version of sqlite/pysqlite youre using.

    ive made fixes in changeset:2292 and changeset:2296 to have a missing mysql DBAPI not cause any failures. see if the trunk works better for you (and we can extract those changes if youre looking to make a patch against 0.3.4....)

    the sqlsoup error looks like it may be due to this:

    import locale
    encoding = locale.getdefaultlocale()[1](1)
    

    does your environment have a default locale + encoding set up ?

  5. Former user Account Deleted

    I think the orderby failures are (as you suggested earlier) related to the sqlite3 version. I get them consistently with version sqlite3-3.3.12, but can't reproduce them with version sqlite3-3.3.7. Should this be considered a bug in sqlite3?

    With regard to encodings, no, OpenBSD doesn't have very good locale support.

    ~ % python -c 'import locale; print locale.getdefaultlocale()'                                                             
    (None, None)
    

    I'll pull trunk to verify that the tests pass now (though the changes look good to me). It wouldn't be worth patching on our side; it's not unreasonable to depend on py-mysql for regress tests. It wouldn't make things any harder for our users.

    Thanks again!

  6. Former user Account Deleted

    Here's some oddness; with trunk (2296), when I first run the tests, I get 5 failures (with sqlite3-3.3.12 and no py-mysql installed):

    testorderby (orm.mapper.EagerTest) ... FAIL
    testorderby_desc (orm.mapper.EagerTest) ... FAIL
    testrelationonbaseclass_j1_nodata (orm.inheritance5.RelationTest3) ... FAIL
    testrelationonbaseclass_j2_data (orm.inheritance5.RelationTest3) ... FAIL
    Doctest: sqlalchemy.ext.sqlsoup ... FAIL
    

    When I run the tests again (without cleaning up), I get 4 failures:

    testorderby (orm.mapper.EagerTest) ... FAIL
    testorderby_desc (orm.mapper.EagerTest) ... FAIL
    testrelationonbaseclass_j1_data (orm.inheritance5.RelationTest3) ... FAIL
    Doctest: sqlalchemy.ext.sqlsoup ... FAIL
    

    When I run the tests for a third time (again without cleaning up), I get only 3 failures:

    testorderby (orm.mapper.EagerTest) ... FAIL
    testorderby_desc (orm.mapper.EagerTest) ... FAIL
    Doctest: sqlalchemy.ext.sqlsoup ... FAIL
    

    At least the testforupdate problem seems to be resolved. ;)

  7. Mike Bayer repo owner

    i put a default encoding of "ascii" into sqlsoup.py changeset:2297. im on sqlite 3.2.7 so ill try upgrading. sqlite frequently has problems with ordering complicated joins so its distressing that they are re-introducing issues that were previously fixed.

  8. Former user Account Deleted

    I can confirm that with trunk (and 2297) I'm only seeing orderby fail. I sometimes see testrelationonbaseclass_j1_data fail, though I can't consistently reproduce it.

    Thanks for your help!

  9. Mike Bayer repo owner

    theyve got a fix in and closed the ticket....when next sqlite release comes out we'll try to close this.

  10. Mike Bayer repo owner

    OK sqlite released 3.3.13, with the headline news referring to this bug. ive installed and all tests pass on this end.

  11. Log in to comment