Title: Refactor to use unittest.
Type: Stage:
Components: Tests Versions: Python 2.6
Status: closed Resolution: out of date
Dependencies: Superseder:
Assigned To: nnorwitz Nosy List: georg.brandl, jerry.seutter, nnorwitz, ronaldoussoren
Priority: normal Keywords: patch

Created on 2007-04-19 03:49 by jerry.seutter, last changed 2007-08-24 19:07 by georg.brandl. This issue is now closed.

File name Uploaded Description Edit jerry.seutter, 2007-04-19 03:49 patch v1 jerry.seutter, 2007-04-24 00:39 patch v2
Messages (7)
msg52462 - (view) Author: Jerry Seutter (jerry.seutter) * (Python committer) Date: 2007-04-19 03:49
This patch refactors 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, which does not exist.  I may be mistaken.
msg52463 - (view) Author: Neal Norwitz (nnorwitz) * (Python committer) Date: 2007-04-19 06:08
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/  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.
msg52464 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2007-04-19 06:18
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.
msg52465 - (view) Author: Jerry Seutter (jerry.seutter) * (Python committer) Date: 2007-04-24 00:39
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:
msg52466 - (view) Author: Neal Norwitz (nnorwitz) * (Python committer) Date: 2007-04-24 03:37
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.
msg52467 - (view) Author: Jerry Seutter (jerry.seutter) * (Python committer) Date: 2007-04-25 06:15
Ahh, that makes sense.  Thanks Neal!
msg55269 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2007-08-24 19:07
I've already ported this test a little differently before seeing this patch.
Date User Action Args
2007-08-24 19:07:11georg.brandlsetstatus: open -> closed
nosy: + georg.brandl
resolution: out of date
messages: + msg55269
2007-04-19 03:49:50jerry.seuttercreate