Add test_main() functions to various tests where it was simple to do. Done so
that regrtest can execute the test_main() directly instead of relying on import
side-effects.
diff --git a/Lib/test/test_imgfile.py b/Lib/test/test_imgfile.py
index 11311c4..ecc02ea 100755
--- a/Lib/test/test_imgfile.py
+++ b/Lib/test/test_imgfile.py
@@ -9,20 +9,6 @@
import imgfile, uu
-def main():
-
- uu.decode(findfile('testrgb.uue'), 'test.rgb')
- uu.decode(findfile('greyrgb.uue'), 'greytest.rgb')
-
- # Test a 3 byte color image
- testimage('test.rgb')
-
- # Test a 1 byte greyscale image
- testimage('greytest.rgb')
-
- unlink('test.rgb')
- unlink('greytest.rgb')
-
def testimage(name):
"""Run through the imgfile's battery of possible methods
on the image passed in name.
@@ -113,4 +99,20 @@
os.unlink(outputfile)
-main()
+
+def test_main():
+
+ uu.decode(findfile('testrgb.uue'), 'test.rgb')
+ uu.decode(findfile('greyrgb.uue'), 'greytest.rgb')
+
+ # Test a 3 byte color image
+ testimage('test.rgb')
+
+ # Test a 1 byte greyscale image
+ testimage('greytest.rgb')
+
+ unlink('test.rgb')
+ unlink('greytest.rgb')
+
+if __name__ == '__main__':
+ test_main()