1. Michael Bayer
  2. sqlalchemy

Issues

Issue #2830 resolved

Warnings in test suite

Anonymous created an issue

When warnings are enabled (using e.g. PYTHONWARNINGS="d" environmental variable), then test suite of SQLAlchemy triggers 2 DeprecationWarnings and 2 ResourceWarnings.

Results for SQLAlchemy trunk:

$ python3.3 -Wd sqla_nose.py
sqla_nose.py:21: DeprecationWarning: imp.load_source() is deprecated; use importlib.machinery.SourceFileLoader(name, pathname).load_module() instead
  noseplugin = imp.load_source("noseplugin", path)
.SSSSSSS.......S.......SS.SSS...........SS..........................................................................................................................................................................................S.............SSSS..........SSSS........S.......................SSSS.SS.S.S.S.S..SS...............................SSSSSSS..SSSSSSSSS.............................SSSSS.SSSS......S.......SSS..SSS..................SS.......SSSSSSS.SSSS.................................................../tmp/sqlalchemy/./lib/sqlalchemy/testing/engines.py:37: UserWarning: testing_reaper couldn't rollback/close connection: Cannot operate on a closed database.
  "rollback/close connection: %s" % e)
.........S.SS.S.S.SS..SSS.S.S.S.S............S..S...................S...S...........................................................................S..........S.....................................S...S../tmp/sqlalchemy/test/engine/test_parseconnect.py:108: DeprecationWarning: This method will be removed in future versions.  Use 'parser.read_file()' instead.
  ini.readfp(StringIO(raw))
................................................................................SS.................................SS.....SS..................................................S.SSSSS....SSSS..................SS.......S.S....SS.SS....S.SS..................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................Error emptying table d: OperationalError('(OperationalError) no such table: d',)
Error emptying table c: OperationalError('(OperationalError) no such table: c',)
Error emptying table b: OperationalError('(OperationalError) no such table: b',)
Error emptying table a: OperationalError('(OperationalError) no such table: a',)
.Error emptying table d: OperationalError('(OperationalError) no such table: d',)
Error emptying table c: OperationalError('(OperationalError) no such table: c',)
Error emptying table b: OperationalError('(OperationalError) no such table: b',)
Error emptying table a: OperationalError('(OperationalError) no such table: a',)
.................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................S..................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................S.......S..S.SSS.S..................................................................................................................................................................................................................................................................................................................................................................................................................................................................................S................................S..S.....................S...................................................................................SSS.S.........SSSSSSSS......SSSSSSS........SS...SS...............S.............................S.....................................................SS.S...................................................................................................S..............................................................................................................................................................................................................................S...SS...S.S...S....SS......................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................S......S...........................................S.....................SS.....S...........................................S..SSSS......................................................................................................................................S......................./tmp/sqlalchemy/test/sql/test_types.py:978: ResourceWarning: unclosed file <_io.BufferedReader name='/tmp/sqlalchemy/test/sql/../binary_data_one.dat'>
  return open(f, mode='rb').read()
/tmp/sqlalchemy/test/sql/test_types.py:978: ResourceWarning: unclosed file <_io.BufferedReader name='/tmp/sqlalchemy/test/sql/../binary_data_two.dat'>
  return open(f, mode='rb').read()
..............................................................................SSSSSS...............
----------------------------------------------------------------------
Ran 5323 tests in 455.797s

OK (SKIP=198)

Comments (8)

  1. matt chisholm

    I'm seeing one PendingDeprecationWarning and two ResourceWarnings under Python 3.4:

    $ python3.4 -Wd sqla_nose.py
    /opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/imp.py:32: PendingDeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
      PendingDeprecationWarning)
    SSSSS..........S.......SSSSSSSSSSSSSSSSS..SS...........................................................................................................................................................................................................................S.............SSSS..........SSSS........S..............................S..SSS..SS.S.S.S...S.....SS....................................SSSSSSS..SSSSSSSSS.............................SSS........SSS.SSSS......S........SSS.SS.......................SS.......SSSSSSS.SSSS.................................................../Users/matt/local/src/sqlalchemy/./lib/sqlalchemy/testing/engines.py:46: UserWarning: testing_reaper couldn't rollback/close connection: Cannot operate on a closed database.
      "rollback/close connection: %s" % e)
    ................S.SS.S.S.SS..SSS..S.S.S.S.....................S..S............................S.....S..............................................................................................S...........S.............................S.......................................................................................................................................................................SS.....SS...........................S........................S.S.SSSSS....SSSS.........SSS...S.SSS..........SS.......S.S....SS.SS..S..S.SS.................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................S..........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................S.......S..S.SSS.S.........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................S................................S..S........................S.......................................................................................SSS.S.........SSSSSSSS......SSSSSSS........SS...SS...............S.............................S.........................................................SS.SS..............................................................................................................S...................................................................................................................................................................................................................................S...SS...S.S...S....SS...................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................S......S.........................................S......................SS.....S.............................................S..SSSS..................................................................................................................................................................................................S......................../Users/matt/local/src/sqlalchemy/test/sql/test_types.py:1221: ResourceWarning: unclosed file <_io.BufferedReader name='/Users/matt/local/src/sqlalchemy/test/sql/../binary_data_one.dat'>
      return open(f, mode='rb').read()
    /Users/matt/local/src/sqlalchemy/test/sql/test_types.py:1221: ResourceWarning: unclosed file <_io.BufferedReader name='/Users/matt/local/src/sqlalchemy/test/sql/../binary_data_two.dat'>
      return open(f, mode='rb').read()
    ........................................................................................................SSSSSSSS..............
    ----------------------------------------------------------------------
    Ran 5895 tests in 117.664s
    
    OK (SKIP=218)
    
  2. matt chisholm

    The PendingDeprecationWarning is coming from pkg_resources which apparently still imports imp in Python 3.4;

    Traceback (most recent call last):
      File "sqla_nose.py", line 10, in <module>
        import nose
      File "/Users/matt/.virtualenvs/sqlalchemy34/lib/python3.4/site-packages/nose/__init__.py", line 1, in <module>
        from nose.core import collector, main, run, run_exit, runmodule
      File "/Users/matt/.virtualenvs/sqlalchemy34/lib/python3.4/site-packages/nose/core.py", line 11, in <module>
        from nose.config import Config, all_config_files
      File "/Users/matt/.virtualenvs/sqlalchemy34/lib/python3.4/site-packages/nose/config.py", line 9, in <module>
        from nose.plugins.manager import NoPlugins
      File "/Users/matt/.virtualenvs/sqlalchemy34/lib/python3.4/site-packages/nose/plugins/__init__.py", line 185, in <module>
        from nose.plugins.manager import *
      File "/Users/matt/.virtualenvs/sqlalchemy34/lib/python3.4/site-packages/nose/plugins/manager.py", line 418, in <module>
        import pkg_resources
      File "/Users/matt/.virtualenvs/sqlalchemy34/lib/python3.4/site-packages/pkg_resources.py", line 21, in <module>
        import imp
    
  3. Log in to comment