mirror of
https://github.com/inventree/InvenTree.git
synced 2025-04-28 11:36:44 +00:00
CI: Allow exchange rate test a few goes
This commit is contained in:
parent
af88f6ec97
commit
adaec90909
@ -1,5 +1,6 @@
|
|||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
|
import time
|
||||||
|
|
||||||
from unittest import mock
|
from unittest import mock
|
||||||
|
|
||||||
@ -406,11 +407,23 @@ class CurrencyTests(TestCase):
|
|||||||
with self.assertRaises(MissingRate):
|
with self.assertRaises(MissingRate):
|
||||||
convert_money(Money(100, 'AUD'), 'USD')
|
convert_money(Money(100, 'AUD'), 'USD')
|
||||||
|
|
||||||
|
update_successful = False
|
||||||
|
|
||||||
|
# Note: the update sometimes fails in CI, let's give it a few chances
|
||||||
|
for idx in range(10):
|
||||||
InvenTree.tasks.update_exchange_rates()
|
InvenTree.tasks.update_exchange_rates()
|
||||||
|
|
||||||
rates = Rate.objects.all()
|
rates = Rate.objects.all()
|
||||||
|
|
||||||
self.assertEqual(rates.count(), len(currency_codes()))
|
if rates.count() == len(currency_codes()):
|
||||||
|
update_successful = True
|
||||||
|
break
|
||||||
|
|
||||||
|
else:
|
||||||
|
print("Exchange rate update failed - retrying")
|
||||||
|
time.sleep(1)
|
||||||
|
|
||||||
|
self.assertTrue(update_successful)
|
||||||
|
|
||||||
# Now that we have some exchange rate information, we can perform conversions
|
# Now that we have some exchange rate information, we can perform conversions
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user