Opened 6 years ago

Closed 6 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
(diff, github, buildbot, log)
Author: exarkun Launchpad Bug:


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 6 years ago by jml

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 6 years ago by exarkun

  • author set to exarkun
  • Branch set to branches/without-openssl-3111

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

comment:3 Changed 6 years ago by exarkun

  • 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 6 years ago by therve

  • Keywords review removed
  • Owner set to exarkun

Fine, +1.

comment:6 Changed 6 years ago by exarkun

  • Resolution set to fixed
  • Status changed from new to closed

(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

comment:7 Changed 3 years ago by <automation>

  • Owner exarkun deleted
Note: See TracTickets for help on using tickets.