test_bdist_wininst.py 1.1 KB

123456789101112131415161718192021222324252627282930313233
  1. """Tests for distutils.command.bdist_wininst."""
  2. import unittest
  3. from test.support import run_unittest
  4. from distutils.command.bdist_wininst import bdist_wininst
  5. from distutils.tests import support
  6. @unittest.skipIf(getattr(bdist_wininst, '_unsupported', False),
  7. 'bdist_wininst is not supported in this install')
  8. class BuildWinInstTestCase(support.TempdirManager,
  9. support.LoggingSilencer,
  10. unittest.TestCase):
  11. def test_get_exe_bytes(self):
  12. # issue5731: command was broken on non-windows platforms
  13. # this test makes sure it works now for every platform
  14. # let's create a command
  15. pkg_pth, dist = self.create_dist()
  16. cmd = bdist_wininst(dist)
  17. cmd.ensure_finalized()
  18. # let's run the code that finds the right wininst*.exe file
  19. # and make sure it finds it and returns its content
  20. # no matter what platform we have
  21. exe_file = cmd.get_exe_bytes()
  22. self.assertGreater(len(exe_file), 10)
  23. def test_suite():
  24. return unittest.makeSuite(BuildWinInstTestCase)
  25. if __name__ == '__main__':
  26. run_unittest(test_suite())