Projet

Général

Profil

0001-tests-fix-test_store_async-8847.patch

Benjamin Dauvergne, 03 novembre 2015 00:22

Télécharger (1,05 ko)

Voir les différences:

Subject: [PATCH] tests: fix test_store_async (#8847)

Test can fail if atomic_write() is slow, but behaviour is correct. Foobar.keys() will always return
a non True value as the file first created by get_new_id(create=True) and not by atomic_write().
 tests/test_storage.py | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
tests/test_storage.py
332 332
    test.unique_value = 'unique-value'
333 333
    test.store(async=True)
334 334
    t0 = time.time()
335
    while not Foobar.keys():
335
    while True:
336 336
        time.sleep(0.1)
337
        try:
338
            test = Foobar.get(1)
339
            break
340
        except KeyError:
341
            pass
337 342
        if time.time()-t0 > 2:
338 343
            raise Exception('timeout')
339 344
    test = Foobar.get(1)
340
-