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