-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Michael Bayer ha scritto:
> [...]
>> Is is possible to modify the SQLAlchemy nose plugin in order to be more
>> cooperative?
>> As an example by adding an option that will change the wantClass method from
>>
>>  if not issubclass(cls, testing.TestBase):
>>      return False
>>  else:
>>      if (hasattr(cls, '__whitelist__') and testing.db.name in
>> cls.__whitelist__):
>>          return True
>>      else:
>>          return not self.__should_skip_for(cls)
>>
>> to something like (not tested):
>>
>>  if self.sa_only and not issubclass(cls, testing.TestBase):
>>      return False
>>
>>  if issubclass(cls, testing.TestBase):
>>      if (hasattr(cls, '__whitelist__') and testing.db.name in
>> cls.__whitelist__):
>>          return True
>>      else:
>>          return not self.__should_skip_for(cls)
>>
>>  # use nose default
> 

A precisation.

The reason I used the sa_only flag is because I assumed there was a
reason why test cases not derived from testing.TestBase must be ignored.

If possible, the wantMethod should be something like:

  if not issubclass(cls, testing.TestBase):
      # Skip
      return None
  else:
      if (hasattr(cls, '__whitelist__') and testing.db.name in
cls.__whitelist__):
          return True
      else:
          return not self.__should_skip_for(cls)


Another problem I found when using SQLAlchemy nose plugin is that
warnings are configured to raise exceptions, and this is a problem for me.


By the way: what is the reason why testing.Test does not derive from
unittest.TestCase?

I would like to use __unsupported_on__, but with current implementation
it is a pain (and there is also the problem with how nose plugins work,
since SQLAlchemy wantClass method will be ignored in case another plugin
with an higher score is available).



Thanks  Manlio
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkv2n4AACgkQscQJ24LbaURU4gCfeVQRuEOTHpQb9hzCoA0aEfB/
6RsAoJn9L51KObvWva7WOQIY21dpYDCf
=ZI6r
-----END PGP SIGNATURE-----

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalch...@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.

Reply via email to