[MERGE] test framework distinguishes skips

Aaron Bentley aaron.bentley at utoronto.ca
Fri Jul 7 17:18:45 BST 2006


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

John Arbash Meinel wrote:
> Aaron Bentley wrote:
>>That's double work.  I've already added subclasses for the particular
>>Skip rationales.
> 
> 
> Well, you could have the decorator raise the right exception based on
> what its parameters where. So:

Maybe in the future, we'll decide that makes sense, but right now, I'm
pushing to distinguish the cases more finely, and this feels like a step
backward.

>>>>However, for a while, I think SFTP didn't have bogus_url support, and it
>>>>really should (as well for ftp, etc).
>>>>So those should be TestSkipped() indicating that we should fix them.
>>>>While LocalTransport should be a TestNotPossible().

>>Feel free to specialize it further once we get it in.

> The problem is that our current framework makes it difficult to do this.
> I suppose LocalTransport.get_bogus_url() could raise TestNotPossible(),
> and then other ones could raise TestSkipped('implement me')

You could add a 'fixme' decorator, so it would be

@fixme(NotImplementedError, 'S?FTPTransport.*get_bogus_url')
@may_fail_with(NotImplementedError, 'LocalTransport.*get_bogus_url')
def my_test_Case():

> But this is the difficulty with just using a catch-all decorator. You
> really want the tests themselves to raise the most specific exception
> they can. Since they are the only ones that know what is going on inside.

It's nice when you get a specific error class, but you can also get
specific by expecting a particular substring match, as shown above.

Aaron
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFEroll0F+nu1YWqI0RAunbAJ9mVJXV/sP79kuJMjhShUEOhiL10ACeJcq9
KNwSwNanhZl57KVeQPDaJL4=
=2IVG
-----END PGP SIGNATURE-----




More information about the bazaar mailing list