Skip to content
This repository

Nose test error in alchemy scaffolding with python 3 #635

Closed
lab10 opened this Issue July 13, 2012 · 3 comments

2 participants

lab10 Chris McDonough
lab10
lab10 commented July 13, 2012

Nose reported a repeatable error in the test coverage when i used scaffolding with alchemy and python 3:
RuntimeError: dictionary changed size during iteration

$ pcreate -s alchemy pm
[suppressed, nothing interesting here]
$ python setup.py develop
[suppressed, nothing interesting here]
$ python setup.py test -q
running test
running egg_info
writing requirements to pm.egg-info/requires.txt
writing pm.egg-info/PKG-INFO
writing top-level names to pm.egg-info/top_level.txt
writing dependency_links to pm.egg-info/dependency_links.txt
writing entry points to pm.egg-info/entry_points.txt
reading manifest file 'pm.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no files found matching '*.rst'
warning: no files found matching '*.jpg' under directory 'pm'
warning: no files found matching '*.txt' under directory 'pm'
warning: no files found matching '*.mak' under directory 'pm'
warning: no files found matching '*.mako' under directory 'pm'
warning: no files found matching '*.js' under directory 'pm'
warning: no files found matching '*.html' under directory 'pm'
warning: no files found matching '*.xml' under directory 'pm'
writing manifest file 'pm.egg-info/SOURCES.txt'
running build_ext
.
----------------------------------------------------------------------
Ran 1 test in 0.016s

OK
$ nosetests --cover-package=pm --cover-erase --with-coverage                                                                                                                              
E
======================================================================
ERROR: test_it (pm.tests.TestMyView)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/jklinck/git/pm/pm/tests.py", line 28, in test_it
    from .views import my_view
  File "/home/jklinck/git/pm/pm/views.py", line 11, in <module>
    @view_config(route_name='home', renderer='templates/mytemplate.pt')
  File "/home/jklinck/git/env/lib/python3.2/site-packages/pyramid-1.3.2-py3.2.egg/pyramid/view.py", line 205, in __init__
    for k, v in L.items():
RuntimeError: dictionary changed size during iteration
-------------------- >> begin captured logging << --------------------
txn.140398452541184: DEBUG: new transaction
txn.140398452541184: DEBUG: commit <zope.sqlalchemy.datamanager.SessionDataManager object at 0x4068190>
txn.140398452541184: DEBUG: commit
--------------------- >> end captured logging << ---------------------

Name         Stmts   Miss  Cover   Missing
------------------------------------------
pm              11      7    36%   9-15
pm.models       14      0   100%   
pm.scripts       0      0   100%   
pm.tests        24      4    83%   29-32
------------------------------------------
TOTAL           49     11    78%   
----------------------------------------------------------------------
Ran 1 test in 2.689s

FAILED (errors=1)
Chris McDonough
Owner
mcdonc commented July 13, 2012

Can't replicate with a Python 3.2.3 vitualenv (env32 below):

[chrism@thinko env32]$ bin/pcreate -s alchemy pm
Creating directory /home/chrism/projects/pyramid/env32/pm
  Recursing into +package+
    Creating /home/chrism/projects/pyramid/env32/pm/pm/
    Copying __init__.py to /home/chrism/projects/pyramid/env32/pm/pm/__init__.py
    Copying models.py to /home/chrism/projects/pyramid/env32/pm/pm/models.py
    Recursing into scripts
      Creating /home/chrism/projects/pyramid/env32/pm/pm/scripts/
      Copying __init__.py to /home/chrism/projects/pyramid/env32/pm/pm/scripts/__init__.py
      Copying initializedb.py to /home/chrism/projects/pyramid/env32/pm/pm/scripts/initializedb.py
    Recursing into static
      Creating /home/chrism/projects/pyramid/env32/pm/pm/static/
      Copying favicon.ico to /home/chrism/projects/pyramid/env32/pm/pm/static/favicon.ico
      Copying footerbg.png to /home/chrism/projects/pyramid/env32/pm/pm/static/footerbg.png
      Copying headerbg.png to /home/chrism/projects/pyramid/env32/pm/pm/static/headerbg.png
      Copying ie6.css to /home/chrism/projects/pyramid/env32/pm/pm/static/ie6.css
      Copying middlebg.png to /home/chrism/projects/pyramid/env32/pm/pm/static/middlebg.png
      Copying pylons.css to /home/chrism/projects/pyramid/env32/pm/pm/static/pylons.css
      Copying pyramid-small.png to /home/chrism/projects/pyramid/env32/pm/pm/static/pyramid-small.png
      Copying pyramid.png to /home/chrism/projects/pyramid/env32/pm/pm/static/pyramid.png
      Copying transparent.gif to /home/chrism/projects/pyramid/env32/pm/pm/static/transparent.gif
    Recursing into templates
      Creating /home/chrism/projects/pyramid/env32/pm/pm/templates/
      Copying mytemplate.pt_tmpl to /home/chrism/projects/pyramid/env32/pm/pm/templates/mytemplate.pt
    Copying tests.py_tmpl to /home/chrism/projects/pyramid/env32/pm/pm/tests.py
    Copying views.py_tmpl to /home/chrism/projects/pyramid/env32/pm/pm/views.py
  Copying CHANGES.txt_tmpl to /home/chrism/projects/pyramid/env32/pm/CHANGES.txt
  Copying MANIFEST.in_tmpl to /home/chrism/projects/pyramid/env32/pm/MANIFEST.in
  Copying README.txt_tmpl to /home/chrism/projects/pyramid/env32/pm/README.txt
  Copying development.ini_tmpl to /home/chrism/projects/pyramid/env32/pm/development.ini
  Copying production.ini_tmpl to /home/chrism/projects/pyramid/env32/pm/production.ini
  Copying setup.cfg_tmpl to /home/chrism/projects/pyramid/env32/pm/setup.cfg
  Copying setup.py_tmpl to /home/chrism/projects/pyramid/env32/pm/setup.py
Welcome to Pyramid.  Sorry for the convenience.
[chrism@thinko env32]$ cd pm/
[chrism@thinko pm]$ ../bin/python setup.py develop
running develop
running egg_info
creating pm.egg-info
writing requirements to pm.egg-info/requires.txt
writing pm.egg-info/PKG-INFO
writing top-level names to pm.egg-info/top_level.txt
writing dependency_links to pm.egg-info/dependency_links.txt
writing entry points to pm.egg-info/entry_points.txt
writing manifest file 'pm.egg-info/SOURCES.txt'
reading manifest file 'pm.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no files found matching '*.rst'
warning: no files found matching '*.jpg' under directory 'pm'
warning: no files found matching '*.txt' under directory 'pm'
warning: no files found matching '*.mak' under directory 'pm'
warning: no files found matching '*.mako' under directory 'pm'
warning: no files found matching '*.js' under directory 'pm'
warning: no files found matching '*.html' under directory 'pm'
warning: no files found matching '*.xml' under directory 'pm'
writing manifest file 'pm.egg-info/SOURCES.txt'
running build_ext
Creating /home/chrism/projects/pyramid/env32/lib/python3.2/site-packages/pm.egg-link (link to .)
Adding pm 0.0 to easy-install.pth file
Installing initialize_pm_db script to /home/chrism/projects/pyramid/env32/bin

Installed /home/chrism/projects/pyramid/env32/pm
Processing dependencies for pm==0.0
Searching for waitress==0.8.1
Best match: waitress 0.8.1
Processing waitress-0.8.1-py3.2.egg
waitress 0.8.1 is already the active version in easy-install.pth

Using /home/chrism/projects/pyramid/env32/lib/python3.2/site-packages/waitress-0.8.1-py3.2.egg
Searching for zope.sqlalchemy==0.7.1
Best match: zope.sqlalchemy 0.7.1
Processing zope.sqlalchemy-0.7.1-py3.2.egg
zope.sqlalchemy 0.7.1 is already the active version in easy-install.pth

Using /home/chrism/projects/pyramid/env32/lib/python3.2/site-packages/zope.sqlalchemy-0.7.1-py3.2.egg
Searching for pyramid-debugtoolbar==1.0.2
Best match: pyramid-debugtoolbar 1.0.2
Processing pyramid_debugtoolbar-1.0.2-py3.2.egg
pyramid-debugtoolbar 1.0.2 is already the active version in easy-install.pth

Using /home/chrism/projects/pyramid/env32/lib/python3.2/site-packages/pyramid_debugtoolbar-1.0.2-py3.2.egg
Searching for pyramid-tm==0.5
Best match: pyramid-tm 0.5
Processing pyramid_tm-0.5-py3.2.egg
pyramid-tm 0.5 is already the active version in easy-install.pth

Using /home/chrism/projects/pyramid/env32/lib/python3.2/site-packages/pyramid_tm-0.5-py3.2.egg
Searching for transaction==1.3.0
Best match: transaction 1.3.0
Processing transaction-1.3.0-py3.2.egg
transaction 1.3.0 is already the active version in easy-install.pth

Using /home/chrism/projects/pyramid/env32/lib/python3.2/site-packages/transaction-1.3.0-py3.2.egg
Searching for SQLAlchemy==0.7.7
Best match: SQLAlchemy 0.7.7
Processing SQLAlchemy-0.7.7-py3.2.egg
SQLAlchemy 0.7.7 is already the active version in easy-install.pth

Using /home/chrism/projects/pyramid/env32/lib/python3.2/site-packages/SQLAlchemy-0.7.7-py3.2.egg
Searching for pyramid==1.4dev
Best match: pyramid 1.4dev
pyramid 1.4dev is already the active version in easy-install.pth
Installing ptweens script to /home/chrism/projects/pyramid/env32/bin
Installing proutes script to /home/chrism/projects/pyramid/env32/bin
Installing pshell script to /home/chrism/projects/pyramid/env32/bin
Installing prequest script to /home/chrism/projects/pyramid/env32/bin
Installing pviews script to /home/chrism/projects/pyramid/env32/bin
Installing bfg2pyramid script to /home/chrism/projects/pyramid/env32/bin
Installing pcreate script to /home/chrism/projects/pyramid/env32/bin
Installing pserve script to /home/chrism/projects/pyramid/env32/bin

Using /home/chrism/projects/pyramid
Searching for distribute==0.6.24
Best match: distribute 0.6.24
Processing distribute-0.6.24-py3.2.egg
distribute 0.6.24 is already the active version in easy-install.pth
Installing easy_install script to /home/chrism/projects/pyramid/env32/bin
Installing easy_install-3.2 script to /home/chrism/projects/pyramid/env32/bin

Using /home/chrism/projects/pyramid/env32/lib/python3.2/site-packages/distribute-0.6.24-py3.2.egg
Searching for zope.interface==4.0.0
Best match: zope.interface 4.0.0
Processing zope.interface-4.0.0-py3.2-linux-x86_64.egg
zope.interface 4.0.0 is already the active version in easy-install.pth

Using /home/chrism/projects/pyramid/env32/lib/python3.2/site-packages/zope.interface-4.0.0-py3.2-linux-x86_64.egg
Searching for Pygments==1.5
Best match: Pygments 1.5
Processing Pygments-1.5-py3.2.egg
Pygments 1.5 is already the active version in easy-install.pth
Installing pygmentize script to /home/chrism/projects/pyramid/env32/bin

Using /home/chrism/projects/pyramid/env32/lib/python3.2/site-packages/Pygments-1.5-py3.2.egg
Searching for PasteDeploy==1.5.0
Best match: PasteDeploy 1.5.0
Processing PasteDeploy-1.5.0-py3.2.egg
PasteDeploy 1.5.0 is already the active version in easy-install.pth

Using /home/chrism/projects/pyramid/env32/lib/python3.2/site-packages/PasteDeploy-1.5.0-py3.2.egg
Searching for translationstring==1.1
Best match: translationstring 1.1
Processing translationstring-1.1-py3.2.egg
translationstring 1.1 is already the active version in easy-install.pth

Using /home/chrism/projects/pyramid/env32/lib/python3.2/site-packages/translationstring-1.1-py3.2.egg
Searching for venusian==1.0a4
Best match: venusian 1.0a4
Processing venusian-1.0a4-py3.2.egg
venusian 1.0a4 is already the active version in easy-install.pth

Using /home/chrism/projects/pyramid/env32/lib/python3.2/site-packages/venusian-1.0a4-py3.2.egg
Searching for zope.deprecation==3.5.1
Best match: zope.deprecation 3.5.1
Processing zope.deprecation-3.5.1-py3.2.egg
zope.deprecation 3.5.1 is already the active version in easy-install.pth

Using /home/chrism/projects/pyramid/env32/lib/python3.2/site-packages/zope.deprecation-3.5.1-py3.2.egg
Searching for repoze.lru==0.5
Best match: repoze.lru 0.5
Processing repoze.lru-0.5-py3.2.egg
repoze.lru 0.5 is already the active version in easy-install.pth

Using /home/chrism/projects/pyramid/env32/lib/python3.2/site-packages/repoze.lru-0.5-py3.2.egg
Searching for WebOb==1.2b3
Best match: WebOb 1.2b3
Processing WebOb-1.2b3-py3.2.egg
WebOb 1.2b3 is already the active version in easy-install.pth

Using /home/chrism/projects/pyramid/env32/lib/python3.2/site-packages/WebOb-1.2b3-py3.2.egg
Searching for Mako==0.7.0
Best match: Mako 0.7.0
Processing Mako-0.7.0-py3.2.egg
Mako 0.7.0 is already the active version in easy-install.pth
Installing mako-render script to /home/chrism/projects/pyramid/env32/bin

Using /home/chrism/projects/pyramid/env32/lib/python3.2/site-packages/Mako-0.7.0-py3.2.egg
Searching for Chameleon==2.8.5
Best match: Chameleon 2.8.5
Processing Chameleon-2.8.5-py3.2.egg
Chameleon 2.8.5 is already the active version in easy-install.pth

Using /home/chrism/projects/pyramid/env32/lib/python3.2/site-packages/Chameleon-2.8.5-py3.2.egg
Searching for MarkupSafe==0.15
Best match: MarkupSafe 0.15
Processing MarkupSafe-0.15-py3.2-linux-x86_64.egg
MarkupSafe 0.15 is already the active version in easy-install.pth

Using /home/chrism/projects/pyramid/env32/lib/python3.2/site-packages/MarkupSafe-0.15-py3.2-linux-x86_64.egg
Finished processing dependencies for pm==0.0
[chrism@thinko pm]$ ../bin/python setup.py test
running test
running egg_info
writing requirements to pm.egg-info/requires.txt
writing pm.egg-info/PKG-INFO
writing top-level names to pm.egg-info/top_level.txt
writing dependency_links to pm.egg-info/dependency_links.txt
writing entry points to pm.egg-info/entry_points.txt
reading manifest file 'pm.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no files found matching '*.rst'
warning: no files found matching '*.jpg' under directory 'pm'
warning: no files found matching '*.txt' under directory 'pm'
warning: no files found matching '*.mak' under directory 'pm'
warning: no files found matching '*.mako' under directory 'pm'
warning: no files found matching '*.js' under directory 'pm'
warning: no files found matching '*.html' under directory 'pm'
warning: no files found matching '*.xml' under directory 'pm'
writing manifest file 'pm.egg-info/SOURCES.txt'
running build_ext
test_it (pm.tests.TestMyView) ... ok

----------------------------------------------------------------------
Ran 1 test in 0.017s

OK
Chris McDonough
Owner
mcdonc commented July 13, 2012

Forgot some output:

[chrism@thinko pm]$ ../bin/nosetests --cover-package=pm --cover-erase --with-coverage
.
Name         Stmts   Miss  Cover   Missing
------------------------------------------
pm              11      7    36%   9-15
pm.models       14      0   100%   
pm.scripts       0      0   100%   
pm.tests        24      0   100%   
pm.views        11      2    82%   15-16
------------------------------------------
TOTAL           60      9    85%   
----------------------------------------------------------------------
Ran 1 test in 0.680s

OK
Chris McDonough
Owner
mcdonc commented July 13, 2012

Same outcome on 1.3-branch.

Chris McDonough mcdonc referenced this issue from a commit July 13, 2012
Chris McDonough - On at least one 64-bit Ubuntu system under Python 3.2, using the
  ``view_config`` decorator caused a ``RuntimeError: dictionary changed size
  during iteration`` exception.  It no longer does.  See
  #635 for more information.

- Fixes issue #635.
e652518
Chris McDonough mcdonc closed this issue from a commit July 13, 2012
Chris McDonough - Backport bug fix from master: On at least one 64-bit Ubuntu system …
…under

  Python 3.2, using the ``view_config`` decorator caused a ``RuntimeError:
  dictionary changed size during iteration`` exception.  It no longer does.
  See #635 for more information.

- Closes #635.
3d7c54c
Chris McDonough mcdonc closed this in 3d7c54c July 13, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.