[Patches] [ python-Patches-1703379 ] Refactor test_frozen.py to use unittest.

SourceForge.net noreply at sourceforge.net
Tue Apr 24 05:37:26 CEST 2007


Patches item #1703379, was opened at 2007-04-18 20:49
Message generated for change (Comment added) made by nnorwitz
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1703379&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Tests
Group: Python 2.6
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Jerry Seutter (jseutter)
Assigned to: Neal Norwitz (nnorwitz)
Summary: Refactor test_frozen.py to use unittest.

Initial Comment:
This patch refactors test_frozen.py to use unittest.  When this patch is applied, Lib/test/output/test_frozen can be removed.

I am not sure if the last test case is named appropriately.  I named it testImportNonexistentFunction because I believe the code is trying to import a function __phello__.foo, which does not exist.  I may be mistaken.

----------------------------------------------------------------------

>Comment By: Neal Norwitz (nnorwitz)
Date: 2007-04-23 20:37

Message:
Logged In: YES 
user_id=33168
Originator: NO

Thanks for updating the patch, I'll try to take a look at it soon (within
a week or so).  If anyone else wants to take a look at this, feel free.

> Why doesn't regrtest give an error if it doesn't run tests?

regrtest can't know the difference between an old style test which
executes on import and a new style test which has a test_main.  This is why
I want to get rid of all the old style tests (the ones that execute by
side-effect of import).  Then we can have regrtest complain if there is no
test_main method just as you suggest.

----------------------------------------------------------------------

Comment By: Jerry Seutter (jseutter)
Date: 2007-04-23 17:39

Message:
Logged In: YES 
user_id=1727609
Originator: YES

Thanks for the input, guys.  See version 2 of the patch which should
resolve these issues.

Question:  Why doesn't regrtest give an error if it doesn't run tests?
File Added: refactor_test_frozen.py.patch

----------------------------------------------------------------------

Comment By: Ronald Oussoren (ronaldoussoren)
Date: 2007-04-18 23:18

Message:
Logged In: YES 
user_id=580910
Originator: NO

As Neal wrote sys.platform == 'mac' is of OS9, which isn't supported
anymore by Python (or Apple for that matter).  The special-case for
platform == 'mac' should be removed altoghether and not replaced by a check
for OSX because OSX is basically just another unix platform and should
therefore support freezing.

----------------------------------------------------------------------

Comment By: Neal Norwitz (nnorwitz)
Date: 2007-04-18 23:08

Message:
Logged In: YES 
user_id=33168
Originator: NO

Thanks for the patch!

It looks pretty good, but there is one problem I see.  There should be a
test_main() function for this to work from regrtest.  For example, take a
look in Lib/test/test_bool.py.  Also, I don't think you need to seek(0)
before getting the value from sys.stdout (ie, cStringIO instance).

I don't think you need to support sys.platform == 'mac'.  That was for Mac
OS 9 which is no longer supported (see PEP 11).  Mac OS 10 has sys.platform
== 'darwin'.  If you're interested, it would be good to produce a patch to
remove all (10+) occurrences of comparing sys.platform with mac.

I'm assigning this to Ronald just so he can verify the Mac OS 9 issue. 
Ronald, please comment and then unassign or assign to me.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1703379&group_id=5470


More information about the Patches mailing list