summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlly Cope <olly@ollycope.com>2017-09-14 08:26:30 +0000
committerOlly Cope <olly@ollycope.com>2017-09-14 08:26:30 +0000
commit7cd7efb123ced24ab1226f9ed4bf3207618bf7e6 (patch)
treed82b90b475ba23848a96e8ec01cd41de55aa8a81
parent15dbad32f5bf09763118af15abdeb898cece3dd8 (diff)
downloadyoyo-7cd7efb123ced24ab1226f9ed4bf3207618bf7e6.tar.gz
Improve thread logic in lock_migration_table tests
-rw-r--r--yoyo/tests/test_backends.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/yoyo/tests/test_backends.py b/yoyo/tests/test_backends.py
index df204ff..b5fceba 100644
--- a/yoyo/tests/test_backends.py
+++ b/yoyo/tests/test_backends.py
@@ -122,7 +122,9 @@ class TestTransactionHandling(object):
def test_lock_migration_table(self, tmpdir):
backend = get_test_backends(only={'postgresql'})[0]
migrations = read_migrations(tmpdir)
- Thread(target=backend.apply_migrations, args=(migrations,)).start()
+ t = Thread(target=backend.apply_migrations, args=(migrations,))
+ t.start()
# give a chance to start, but wake up in the middle of applying
- time.sleep(0.1)
+ time.sleep(1)
assert backend.get_applied_migration_ids() == ['a']
+ t.join()