Awesome debugging on your part. I think we are almost certain at this
point that this is an issue with SQLAlchemy's metaclass used to build
the properties (or coverage not understanding them), I'll suggest you
cc the sa mailing list so Michael Bayer will take a look at it.

On Tue, Sep 16, 2008 at 11:12 AM, Doug Latornell <[EMAIL PROTECTED]> wrote:
>
> http://paste.turbogears.org/paste/7051 isolates the problem to an
> interaction between sqlalchemy and coverage - takes nose out of the
> picture.
>
> http://paste.turbogears.org/paste/7052 shows that the problem isn't
> there for a plain Python property (in contrast to a sqlalchemy
> synonym).
>
> Doug
>
> On Sep 15, 9:42 pm, Doug Latornell <[EMAIL PROTECTED]> wrote:
>> I've reproduced this problem outside of 
>> TG2:http://paste.turbogears.org/paste/6992
>>
>> Looks to me like it's an issue in coverage, nose, or sqlalchemy,
>> especially since it only appears when --with-coverage is used.
>>
>> Doug
>>
>> On Sep 15, 6:17 pm, Doug Latornell <[EMAIL PROTECTED]> wrote:
>>
>> > I'm stumped.
>>
>> > There's something weird happening to attribute calls in
>> > identity.py:User._set_password() when nosetests --with-coverage is
>> > used.  But the weirdness goes away if you don't ask for coverage.
>> > Attribute calls are being transferred on to property from the synonym
>> > call.  There's nothing special about __encrypt_password(); you can get
>> > the same weirdness by changing:
>> >   self._password = self.__encrypt_password(algorithm, password)
>> > to
>> >   self._password = password.upper()
>>
>> > Doug
>>
>> > On Sep 15, 10:03 am, Doug Latornell <[EMAIL PROTECTED]> wrote:
>>
>> > > I can reproduce what you are seeing Stef.  I've got a clean 1.9.7a4
>> > > virtualenv with coverage, WebTest, and BeautifulSoup added manually
>> > > via easy_install.
>>
>> > > It's interesting that the problem only arises when nose is run with
>> > > the coverage plug-in.
>>
>> > > I'll try to get some time later today to dig into this and reply here
>> > > with what (if anything) I find.
>>
>> > > Doug
>>
>> > > On Sep 13, 9:30 am, Stef <[EMAIL PROTECTED]> wrote:
>>
>> > > > Hello
>>
>> > > > First of all, I want to say a big thank to all of you for developing 
>> > > > this
>> > > > amazing framework.
>>
>> > > > I've decided to take a look at TG2 to see all the new features since 
>> > > > TG1.
>> > > > I've just made a fresh install  and create a project named 'tgtest' 
>> > > > from
>> > > > paster quickstart and answered 'yes' to identity question.
>>
>> > > > As I want to use unit testing I've tried nosetests. If I'm simply 
>> > > > running
>> > > > "nosetests" all tests pass, but if i'm trying the command "nosetests
>> > > > --with-coverage --cover-package=tgtest" it fails with one error and 
>> > > > give me
>> > > > this traceback :
>>
>> > > > > nosetests --with-coverage --cover-package=tgtest
>>
>> > > > E
>> > > > ======================================================================
>> > > > ERROR: Failure: AttributeError ('property' object has no attribute
>> > > > '_User__encrypt_password')
>> > > > ----------------------------------------------------------------------
>> > > > Traceback (most recent call last):
>> > > >   File
>> > > > "/opt/local/lib/python2.5/site-packages/nose-0.10.3-py2.5.egg/nose/loader.py",
>> > > > line 364, in loadTestsFromName
>> > > >     addr.filename, addr.module)
>> > > >   File
>> > > > "/opt/local/lib/python2.5/site-packages/nose-0.10.3-py2.5.egg/nose/importer.py",
>> > > > line 39, in importFromPath
>> > > >     return self.importFromDir(dir_path, fqname)
>> > > >   File
>> > > > "/opt/local/lib/python2.5/site-packages/nose-0.10.3-py2.5.egg/nose/importer.py",
>> > > > line 84, in importFromDir
>> > > >     mod = load_module(part_fqname, fh, filename, desc)
>> > > >   File "/Developer/stef/work/perso/tgtest/tgtest/tests/__init__.py", 
>> > > > line
>> > > > 33, in <module>
>> > > >     cmd.run([test_file])
>> > > >   File
>> > > > "/opt/local/lib/python2.5/site-packages/PasteScript-1.6.3-py2.5.egg/paste/script/appinstall.py",
>> > > > line 68, in run
>> > > >     return super(AbstractInstallCommand, self).run(new_args)
>> > > >   File
>> > > > "/opt/local/lib/python2.5/site-packages/PasteScript-1.6.3-py2.5.egg/paste/script/command.py",
>> > > > line 213, in run
>> > > >     result = self.command()
>> > > >   File
>> > > > "/opt/local/lib/python2.5/site-packages/PasteScript-1.6.3-py2.5.egg/paste/script/appinstall.py",
>> > > > line 456, in command
>> > > >     self, config_file, section, self.sysconfig_install_vars(installer))
>> > > >   File
>> > > > "/opt/local/lib/python2.5/site-packages/PasteScript-1.6.3-py2.5.egg/paste/script/appinstall.py",
>> > > > line 600, in setup_config
>> > > >     mod.setup_config(command, filename, section, vars)
>> > > >   File "/Developer/stef/work/perso/tgtest/tgtest/websetup.py", line 
>> > > > 21, in
>> > > > setup_config
>> > > >     u = model.User()
>> > > >   File "<string>", line 4, in __init__
>> > > >   File
>> > > > "/opt/local/lib/python2.5/site-packages/SQLAlchemy-0.5.0rc1-py2.5.egg/sqlalchemy/orm/attributes.py",
>> > > > line 815, in initialize_instance
>> > > >     fn(self, instance, args, kwargs)
>> > > >   File
>> > > > "/opt/local/lib/python2.5/site-packages/SQLAlchemy-0.5.0rc1-py2.5.egg/sqlalchemy/orm/mapper.py",
>> > > > line 1678, in _event_on_init
>> > > >     instrumenting_mapper.compile()
>> > > >   File
>> > > > "/opt/local/lib/python2.5/site-packages/SQLAlchemy-0.5.0rc1-py2.5.egg/sqlalchemy/orm/mapper.py",
>> > > > line 369, in compile
>> > > >     mapper.__initialize_properties()
>> > > >   File
>> > > > "/opt/local/lib/python2.5/site-packages/SQLAlchemy-0.5.0rc1-py2.5.egg/sqlalchemy/orm/mapper.py",
>> > > > line 390, in __initialize_properties
>> > > >     prop.init(key, self)
>> > > >   File
>> > > > "/opt/local/lib/python2.5/site-packages/SQLAlchemy-0.5.0rc1-py2.5.egg/sqlalchemy/orm/interfaces.py",
>> > > > line 384, in init
>> > > >     self.do_init()
>> > > >   File
>> > > > "/opt/local/lib/python2.5/site-packages/SQLAlchemy-0.5.0rc1-py2.5.egg/sqlalchemy/orm/properties.py",
>> > > > line 207, in do_init
>> > > >     None, None, False, comparator_callable, 
>> > > > proxy_property=self.descriptor)
>> > > >   File
>> > > > "/opt/local/lib/python2.5/site-packages/SQLAlchemy-0.5.0rc1-py2.5.egg/sqlalchemy/orm/strategies.py",
>> > > > line 45, in _register_attribute
>> > > >     active_history=active_history
>> > > >   File
>> > > > "/opt/local/lib/python2.5/site-packages/SQLAlchemy-0.5.0rc1-py2.5.egg/sqlalchemy/orm/unitofwork.py",
>> > > > line 87, in register_attribute
>> > > >     return attributes.register_attribute(class_, key, *args, **kwargs)
>> > > >   File
>> > > > "/opt/local/lib/python2.5/site-packages/SQLAlchemy-0.5.0rc1-py2.5.egg/sqlalchemy/orm/attributes.py",
>> > > > line 1460, in register_attribute
>> > > >     descriptor = proxy_type(key, proxy_property, comparator, 
>> > > > parententity)
>> > > >   File
>> > > > "/opt/local/lib/python2.5/site-packages/SQLAlchemy-0.5.0rc1-py2.5.egg/sqlalchemy/orm/attributes.py",
>> > > > line 156, in __init__
>> > > >     self.descriptor = self.user_prop = descriptor
>> > > >   File "/Developer/stef/work/perso/tgtest/tgtest/model/identity.py", 
>> > > > line
>> > > > 102, in _set_password
>> > > >     self._password = self.__encrypt_password(algorithm, password)
>> > > >   File
>> > > > "/opt/local/lib/python2.5/site-packages/SQLAlchemy-0.5.0rc1-py2.5.egg/sqlalchemy/orm/attributes.py",
>> > > > line 184, in __getattr__
>> > > >     return getattr(descriptor, attribute)
>> > > > AttributeError: 'property' object has no attribute 
>> > > > '_User__encrypt_password'
>>
>> > > > Name                        Stmts   Exec  Cover   Missing
>> > > > ---------------------------------------------------------
>> > > > tgtest                          0      0   100%
>> > > > tgtest.config                   0      0   100%
>> > > > tgtest.config.app_cfg          21     21   100%
>> > > > tgtest.config.environment       2      2   100%
>> > > > tgtest.config.middleware        6      6   100%
>> > > > tgtest.controllers              0      0   100%
>> > > > tgtest.lib                      0      0   100%
>> > > > tgtest.lib.app_globals          3      3   100%
>> > > > tgtest.lib.helpers              1      1   100%
>> > > > tgtest.model                   10     10   100%
>> > > > tgtest.model.identity          68     43    63%   50, 72, 77-80, 87, 
>> > > > 94,
>> > > > 107, 116-149, 154-158
>> > > > tgtest.templates                0      0   100%
>> > > > tgtest.websetup                38     13    34%   22-55
>> > > > ---------------------------------------------------------
>> > > > TOTAL                         149     99    66%
>> > > > ----------------------------------------------------------------------
>> > > > Ran 1 test in 0.876s
>>
>> > > > FAILED (errors=1)
>>
>> > > > Am I doing something wrong?
>> > > > It is a fresh install of python-2.5 with no previous turbogears
>> > > > installation.
>> > > > I've upgraded SQLAlchemy from 0.5.0-beta3 to 0.5.0rc1 and tg.devtools 
>> > > > from
>> > > > 1.9.7a4 to 1.9.7a4dev-r5288 to see if the problem could be resolved by
>> > > > simply upgrading.
>>
>> > > > Stef.
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to