test_bdist_wininst.py 1.4 KB

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