Opened 14 years ago

Closed 14 years ago

#3111 enhancement closed fixed (fixed)

skip unit tests if they depend on absent 3rd-party library

Reported by: zooko Owned by:
Priority: normal Milestone:
Component: core Keywords: test
Cc: Branch: branches/without-openssl-3111
branch-diff, diff-cov, branch-cov, buildbot
Author: exarkun


If you run twisted unit tests without installing pyOpenSSL and pyCrypto, then you get errors like these:

[ERROR]: twisted.conch.test.test_userauth

Traceback (most recent call last):
  File "/Users/wonwinmcbrootles/playground/twisted/easy_install-1286-4/twisted/trial/", line 546, in loadPackage
    module = modinfo.load()
  File "/Users/wonwinmcbrootles/playground/twisted/easy_install-1286-4/twisted/python/", line 380, in load
    return self.pathEntry.pythonPath.moduleLoader(
  File "/Users/wonwinmcbrootles/playground/twisted/easy_install-1286-4/twisted/python/", line 618, in moduleLoader
    return self._moduleLoader(modname)
  File "/Users/wonwinmcbrootles/playground/twisted/easy_install-1286-4/twisted/python/", line 426, in namedAny
    topLevelPackage = _importAndCheckStack(trialname)
  File "/Users/wonwinmcbrootles/playground/twisted/easy_install-1286-4/twisted/conch/test/", line 8, in <module>
    from twisted.conch.ssh import userauth
  File "/Users/wonwinmcbrootles/playground/twisted/easy_install-1286-4/twisted/conch/ssh/", line 19, in <module>
    import keys, transport, service
  File "/Users/wonwinmcbrootles/playground/twisted/easy_install-1286-4/twisted/conch/ssh/", line 19, in <module>
    from Crypto.Cipher import DES3
exceptions.ImportError: No module named Crypto.Cipher

It would be nicer if you got SkipTests for those.

Change History (7)

comment:1 Changed 14 years ago by Jonathan Lange

bzrlib has a really nice way of doing this. They distinguish between "skipping due to OS missing features" and "skipping due to lack of dependencies". This makes it easier to see which ones you can fix.

comment:2 Changed 14 years ago by Jean-Paul Calderone

author: exarkun
Branch: branches/without-openssl-3111

(In [24702]) Branching to 'without-openssl-3111'

comment:3 Changed 14 years ago by Jean-Paul Calderone

Keywords: review added
Owner: Glyph deleted

Much better, but not completely fixed. There are two other tickets, #2153 and #3419, for the two remaining OpenSSL dependencies.

comment:5 Changed 14 years ago by therve

Keywords: review removed
Owner: set to Jean-Paul Calderone

Fine, +1.

comment:6 Changed 14 years ago by Jean-Paul Calderone

Resolution: fixed
Status: newclosed

(In [24770]) Merge without-openssl-3111

Author: exarkun Reviewer: therve Fixes: #3111

Adjust almost all of the unit tests so that if either PyCrypto or pyOpenSSL is unavailable, tests for functionality which relies on them are skipped. This removes a number of mostly uninformative failures from platforms such as PyPy (where these modules are never available atm) and cleans up the test results on CPython when one of these dependencies is missing.

comment:7 Changed 11 years ago by <automation>

Owner: Jean-Paul Calderone deleted
Note: See TracTickets for help on using tickets.