Paul Moore <p.f.mo...@gmail.com> added the comment:

That's where I decided it was too complex for now :-)

The whole test_crypt.py file is skipped if you can't import crypt, via the use 
of the test.support.import_module() function. To be able to write a test for a 
platform where the whole point is that you can't import crypt, you'd have to 
rewrite that. So you'd get something like

try:
    import crypt
except ImportError as e:
    if sys.platform == "win32":
        assert "not supported" in e.msg
    raise unittest.SkipTest("crypt is not present on this platform")

But you can't use "assert" like that in top-level code (or at least I don't 
think you can - I'm not that familiar with unittest, but I think assertions 
have to live in classes in unittest).

At this point I gave up. It starts to be quite a big rewrite for a relatively 
minor benefit.

The alternative would be, if there was a "Windows-specific tests" test module, 
we could have put a test for this situation in there. But I don't think there 
is such a module.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue25172>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to