Jerry Seutter <[email protected]> added the comment:
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.
----------
Added file: http://bugs.python.org/file16418/nothreads_2.patch
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue7449>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com