# -*- mode: python -*- # Copyright (C) 2005, 2006 Mekensleep # # Mekensleep # 24 rue vieille du temple # 75004 Paris # licensing@mekensleep.com # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. # # Authors: # Loic Dachary # import sys, os, shutil, stat sys.path.insert(0, "@top_srcdir@") os.environ['PYTHONPATH'] = os.environ.get('PYTHONPATH', '') + '@top_srcdir@' import unittest from pokerengine.pokerengineconfig import Config from pokerengine.version import version class TestUpgrades(unittest.TestCase): def test1(self): verbose = os.environ.get('VERBOSE_T', '1') shutil.rmtree("conftest", ignore_errors = True) os.mkdir("conftest") os.system("../pokerconfigupgrade --verbose=" + verbose + " --upgrades=@top_srcdir@/upgrades --reference=@srcdir@/conf conftest") os.chmod("conftest", 0755) os.system("../pokerconfigupgrade --verbose=" + verbose + " --upgrades=@top_srcdir@/upgrades conftest") config = Config(['conftest']) for file in os.listdir("conftest"): if ".xml" in file: config.load(file) self.assertEqual(config.headerGet("/child::*/@poker_engine_version"), version) shutil.rmtree("conftest") def run(): suite = unittest.TestSuite() suite.addTest(unittest.makeSuite(TestUpgrades)) verbosity = int(os.environ.get('VERBOSE_T', 2)) return unittest.TextTestRunner(verbosity=verbosity).run(suite) if __name__ == '__main__': if run().wasSuccessful(): sys.exit(0) else: sys.exit(1)