Ticket #3111 enhancement closed fixed

Opened 5 years ago

Last modified 5 years ago

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:

Description

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/runner.py", line 546, in loadPackage
    module = modinfo.load()
  File "/Users/wonwinmcbrootles/playground/twisted/easy_install-1286-4/twisted/python/modules.py", line 380, in load
    return self.pathEntry.pythonPath.moduleLoader(self.name)
  File "/Users/wonwinmcbrootles/playground/twisted/easy_install-1286-4/twisted/python/modules.py", line 618, in moduleLoader
    return self._moduleLoader(modname)
  File "/Users/wonwinmcbrootles/playground/twisted/easy_install-1286-4/twisted/python/reflect.py", line 426, in namedAny
    topLevelPackage = _importAndCheckStack(trialname)
  File "/Users/wonwinmcbrootles/playground/twisted/easy_install-1286-4/twisted/conch/test/test_userauth.py", line 8, in <module>
    from twisted.conch.ssh import userauth
  File "/Users/wonwinmcbrootles/playground/twisted/easy_install-1286-4/twisted/conch/ssh/userauth.py", line 19, in <module>
    import keys, transport, service
  File "/Users/wonwinmcbrootles/playground/twisted/easy_install-1286-4/twisted/conch/ssh/keys.py", 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

1

Changed 5 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.

2

Changed 5 years ago by exarkun

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

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

3

Changed 5 years ago by exarkun

  • owner glyph deleted
  • keywords test, review added; test removed

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

4

5

Changed 5 years ago by therve

  • owner set to exarkun
  • keywords test added; test, review removed

Fine, +1.

6

Changed 5 years ago by exarkun

  • status changed from new to closed
  • resolution set to fixed

(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.

7

Changed 2 years ago by <automation>

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