On 14/04/2010 05:49, Chris Jerdonek wrote:
Hi folks,

I have a patch to the unittest module for review here:

http://bugs.python.org/issue7559#msg102801

(There have already been a couple rounds of discussion on how to best
fix this.)

This is my first patch, so any feedback is appreciated.

I'm still not convinced that this isn't a backwards incompatible change - up until now, however horrible it may be, TestLoader.loadTestsFromName only raised an AttributeError when it failed to load a test. Changing it to allow it propagate ImportError means that code catching errors by handling AttributeError will be potentially broken by the fix. I'm certainly happy to discuss this here though.

An alternative fix would be for a new API and deprecation of loadTestFromName. A new API could return a placeholder test that raises the original error when run - that way individual errors don't break the test collection phase but are still reported. This *could* be added to loadTestsFromName with an optional argument.

By the way, in general please don't assign unittest bugs *away* from me on the tracker. I'm maintaining unittest and have been watching this issue. I haven't given it much attention recently because of getting the new features ready for the 2.7b1 release. I will certainly want to look through the patch before it is committed, if the consensus here is that changing this API to raise an ImportError is not a backwards incompatible change.

All the best,

Michael Foord

Thanks,
--Chris
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/fuzzyman%40voidspace.org.uk


--
http://www.ironpythoninaction.com/

_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to