Tarek Ziadé | a619180 | 2009-04-09 22:02:39 +0000 | [diff] [blame] | 1 | """Tests for distutils.command.bdist_wininst.""" |
| 2 | import unittest |
Éric Araujo | 70ec44a | 2010-11-06 02:44:43 +0000 | [diff] [blame] | 3 | from test.support import run_unittest |
Tarek Ziadé | a619180 | 2009-04-09 22:02:39 +0000 | [diff] [blame] | 4 | |
| 5 | from distutils.command.bdist_wininst import bdist_wininst |
| 6 | from distutils.tests import support |
| 7 | |
| 8 | class BuildWinInstTestCase(support.TempdirManager, |
Tarek Ziadé | fbd7757 | 2009-04-20 12:37:58 +0000 | [diff] [blame] | 9 | support.LoggingSilencer, |
Tarek Ziadé | a619180 | 2009-04-09 22:02:39 +0000 | [diff] [blame] | 10 | unittest.TestCase): |
| 11 | |
| 12 | def test_get_exe_bytes(self): |
| 13 | |
| 14 | # issue5731: command was broken on non-windows platforms |
| 15 | # this test makes sure it works now for every platform |
| 16 | # let's create a command |
| 17 | pkg_pth, dist = self.create_dist() |
| 18 | cmd = bdist_wininst(dist) |
| 19 | cmd.ensure_finalized() |
| 20 | |
| 21 | # let's run the code that finds the right wininst*.exe file |
| 22 | # and make sure it finds it and returns its content |
| 23 | # no matter what platform we have |
| 24 | exe_file = cmd.get_exe_bytes() |
Serhiy Storchaka | 3998915 | 2013-11-17 00:17:46 +0200 | [diff] [blame] | 25 | self.assertGreater(len(exe_file), 10) |
Tarek Ziadé | a619180 | 2009-04-09 22:02:39 +0000 | [diff] [blame] | 26 | |
| 27 | def test_suite(): |
| 28 | return unittest.makeSuite(BuildWinInstTestCase) |
| 29 | |
| 30 | if __name__ == '__main__': |
Éric Araujo | 70ec44a | 2010-11-06 02:44:43 +0000 | [diff] [blame] | 31 | run_unittest(test_suite()) |