From 5411da1ca796531b6e0f43c0f896e05fc1e341fa Mon Sep 17 00:00:00 2001 From: Sumpfork Date: Thu, 11 Jan 2018 15:48:39 -0800 Subject: [PATCH] test loading all languages; config for pytest --- domdiv/tests/carddb_tests.py | 30 ++++++++++++++---------------- setup.cfg | 2 ++ 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/domdiv/tests/carddb_tests.py b/domdiv/tests/carddb_tests.py index 78dce5a..36934b7 100644 --- a/domdiv/tests/carddb_tests.py +++ b/domdiv/tests/carddb_tests.py @@ -42,19 +42,17 @@ class TestCardDB(unittest.TestCase): self.assertIn(c.cardset_tag, valid_cardsets) def test_languages(self): - # for now, just test that they load - options = main.parse_opts(['--language', 'it']) - options.data_path = '.' - cards = main.read_card_data(options) - self.assertTrue(cards, 'Italians cards did not read properly') - cards = main.add_card_text(options, cards, 'en_us') - cards = main.add_card_text(options, cards, 'it') - self.assertIn("Maledizione", [card.name for card in cards]) - - options = main.parse_opts(['--language', 'de']) - options.data_path = '.' - cards = main.read_card_data(options) - self.assertTrue(cards, 'German cards did not read properly') - cards = main.add_card_text(options, cards, 'en_us') - cards = main.add_card_text(options, cards, 'de') - self.assertIn("Fluch", [card.name for card in cards]) + languages = main.get_languages('card_db') + for lang in languages: + print('checking ' + lang) + # for now, just test that they load + options = main.parse_opts(['--language', lang]) + options.data_path = '.' + cards = main.read_card_data(options) + self.assertTrue(cards, '"{}" cards did not read properly'.format(lang)) + cards = main.add_card_text(options, cards, 'en_us') + cards = main.add_card_text(options, cards, lang) + if lang == 'it': + self.assertIn("Maledizione", [card.name for card in cards]) + elif lang == 'de': + self.assertIn("Fluch", [card.name for card in cards]) diff --git a/setup.cfg b/setup.cfg index b88034e..e9e9e06 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,2 +1,4 @@ [metadata] description-file = README.md +[tool:pytest] +python_files=*tests.py