def testCustomizeOverrides_002(self):
     """
     Test platform=standard, existing override for cdrecord.
     """
     config = Config()
     options = OptionsConfig()
     options.overrides = [
         CommandOverride("cdrecord", "/blech"),
     ]
     if PLATFORM == "standard":
         config.options = options
         customizeOverrides(config)
         self.assertEqual([CommandOverride("cdrecord", "/blech")], options.overrides)
     config.options = options
     customizeOverrides(config, platform="standard")
     self.assertEqual([CommandOverride("cdrecord", "/blech")], options.overrides)
 def testCustomizeOverrides_008(self):
     """
     Test platform=debian, existing override for cdrecord and mkisofs.
     """
     config = Config()
     options = OptionsConfig()
     options.overrides = [
         CommandOverride("cdrecord", "/blech"),
         CommandOverride("mkisofs", "/blech2"),
     ]
     if PLATFORM == "debian":
         config.options = options
         customizeOverrides(config)
         self.assertEqual([CommandOverride("cdrecord", "/blech"), CommandOverride("mkisofs", "/blech2")], options.overrides)
     config.options = options
     customizeOverrides(config, platform="debian")
     self.assertEqual([CommandOverride("cdrecord", "/blech"), CommandOverride("mkisofs", "/blech2")], options.overrides)
 def testCustomizeOverrides_001(self):
     """
     Test platform=standard, no existing overrides.
     """
     config = Config()
     options = OptionsConfig()
     if PLATFORM == "standard":
         config.options = options
         customizeOverrides(config)
         self.assertEqual(None, options.overrides)
     config.options = options
     customizeOverrides(config, platform="standard")
     self.assertEqual(None, options.overrides)
 def testCustomizeOverrides_005(self):
     """
     Test platform=debian, no existing overrides.
     """
     config = Config()
     options = OptionsConfig()
     if PLATFORM == "debian":
         config.options = options
         customizeOverrides(config)
         self.assertEqual(
             [CommandOverride("cdrecord", "/usr/bin/wodim"), CommandOverride("mkisofs", "/usr/bin/genisoimage")],
             options.overrides,
         )
     config.options = options
     customizeOverrides(config, platform="debian")
     self.assertEqual(
         [CommandOverride("cdrecord", "/usr/bin/wodim"), CommandOverride("mkisofs", "/usr/bin/genisoimage")], options.overrides
     )
Exemple #5
0
def setupOverrides():
    """
    Set up any platform-specific overrides that might be required.

    When packages are built, this is done manually (hardcoded) in customize.py
    and the overrides are set up in cli.cli().  This way, no runtime checks need
    to be done.  This is safe, because the package maintainer knows exactly
    which platform (Debian or not) the package is being built for.

    Unit tests are different, because they might be run anywhere.  So, we
    attempt to make a guess about plaform using platformDebian(), and use that
    to set up the custom overrides so that platform-specific unit tests continue
    to work.
    """
    config = Config()
    config.options = OptionsConfig()
    if platformDebian():
        customizeOverrides(config, platform="debian")
    else:
        customizeOverrides(config, platform="standard")
    setupPathResolver(config)