test loading all languages; config for pytest

This commit is contained in:
Sumpfork 2018-01-11 15:48:39 -08:00
parent 099b30290a
commit 5411da1ca7
2 changed files with 16 additions and 16 deletions

View File

@ -42,19 +42,17 @@ class TestCardDB(unittest.TestCase):
self.assertIn(c.cardset_tag, valid_cardsets) self.assertIn(c.cardset_tag, valid_cardsets)
def test_languages(self): def test_languages(self):
# for now, just test that they load languages = main.get_languages('card_db')
options = main.parse_opts(['--language', 'it']) for lang in languages:
options.data_path = '.' print('checking ' + lang)
cards = main.read_card_data(options) # for now, just test that they load
self.assertTrue(cards, 'Italians cards did not read properly') options = main.parse_opts(['--language', lang])
cards = main.add_card_text(options, cards, 'en_us') options.data_path = '.'
cards = main.add_card_text(options, cards, 'it') cards = main.read_card_data(options)
self.assertIn("Maledizione", [card.name for card in cards]) self.assertTrue(cards, '"{}" cards did not read properly'.format(lang))
cards = main.add_card_text(options, cards, 'en_us')
options = main.parse_opts(['--language', 'de']) cards = main.add_card_text(options, cards, lang)
options.data_path = '.' if lang == 'it':
cards = main.read_card_data(options) self.assertIn("Maledizione", [card.name for card in cards])
self.assertTrue(cards, 'German cards did not read properly') elif lang == 'de':
cards = main.add_card_text(options, cards, 'en_us') self.assertIn("Fluch", [card.name for card in cards])
cards = main.add_card_text(options, cards, 'de')
self.assertIn("Fluch", [card.name for card in cards])

View File

@ -1,2 +1,4 @@
[metadata] [metadata]
description-file = README.md description-file = README.md
[tool:pytest]
python_files=*tests.py