This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author jerry.seutter
Recipients jerry.seutter, r.david.murray, vstinner
Date 2010-03-03.01:07:38
SpamBayes Score 0.0
Marked as misclassified No
Message-id <1267578473.25.0.907692851685.issue7449@psf.upfronthosting.co.za>
In-reply-to
Content
In the test_xmlrpc.py case I changed the value from URL to 'http:' because the code that sets URL to a valid url relies on threading.  When threading is disabled, URL is set to None and the test will fail.  The two ServerProxy test cases that were modified in this way do not actually use the network at all.  They instead test that the close() method returns None and that the transport() method returns the transport passed in to the constructor.  I figured setting the url to 'http:' instead of an empty string was more readable.  The reader would know that the string was supposed to be a url and that it was utterly meaningless in this case.

In the test_macostools.py case, the os.unlink(TESTFN2) call is a copy and paste error from the previous test.  This test tried to remove an alias it never created, and it failed to check that the destination directory for the alias actually was a directory (it only checked that the path existed - in my case it was a file, not a directory).  I fixed the test to check that sys.prefix is a directory, and then clean up sys.prefix/TESTFN2.

The skip_if_no decorator is not absolutely necessary and could have been skipped.  I believe it adds to the readability of the code because with the decorator it becomes obvious that the test should skip in some cases.  Perhaps this is what import_module() is for - if so, should I document it?  I also believe the decorator helps prevent cases where a resource is allocated (like creating a directory), then the import_module() call fails and a test artifact is left laying around on disk.  Having said that, I do not know if this actually happens in any of the tests and so might be a moot point.  

In reference to disliking the naming of skip_if_no(), I do not like the naming either.  The decorator attempts to import the module, then raises SkipTest if there was an ImportError.  I think it is essential to have the words "import" and "skip" in the method name to help indicate what the decorator does.  These are names I could live with:

import_or_skip_test('threading')
import_module_or_skip_test('threading')
skip_test_unless_import('threading')

My preference is for the last one.  Let me know which one you like best and I'll change the name to that.
History
Date User Action Args
2010-03-03 01:07:54jerry.seuttersetrecipients: + jerry.seutter, vstinner, r.david.murray
2010-03-03 01:07:53jerry.seuttersetmessageid: <1267578473.25.0.907692851685.issue7449@psf.upfronthosting.co.za>
2010-03-03 01:07:51jerry.seutterlinkissue7449 messages
2010-03-03 01:07:49jerry.seuttercreate