~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/__init__.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2010-04-27 07:59:47 UTC
  • mfrom: (5186.1.1 integration)
  • Revision ID: pqm@pqm.ubuntu.com-20100427075947-zt0dt5fq780y65fr
(vila) Workaround ``Crypto.Random`` check leading to spurious test
        failures

Show diffs side-by-side

added added

removed removed

Lines of Context:
3201
3201
    return result
3202
3202
 
3203
3203
 
 
3204
def workaround_zealous_crypto_random():
 
3205
    """Crypto.Random want to help us being secure, but we don't care here.
 
3206
 
 
3207
    This workaround some test failure related to the sftp server. Once paramiko
 
3208
    stop using the controversial API in Crypto.Random, we may get rid of it.
 
3209
    """
 
3210
    try:
 
3211
        from Crypto.Random import atfork
 
3212
        atfork()
 
3213
    except ImportError:
 
3214
        pass
 
3215
 
 
3216
 
3204
3217
def fork_for_tests(suite):
3205
3218
    """Take suite and start up one runner per CPU by forking()
3206
3219
 
3230
3243
        c2pread, c2pwrite = os.pipe()
3231
3244
        pid = os.fork()
3232
3245
        if pid == 0:
 
3246
            workaround_zealous_crypto_random()
3233
3247
            try:
3234
3248
                os.close(c2pread)
3235
3249
                # Leave stderr and stdout open so we can see test noise