def use_command(testcase, fullname): """Register command at *fullname* for the duration of a test.""" set_command(fullname) # XXX maybe set_command should return the class object name = resolve_name(fullname).get_command_name() # XXX maybe we need a public API to remove commands testcase.addCleanup(_COMMANDS.__delitem__, name)
def test_builds_before_running_tests(self): self.addCleanup(set_command, 'distutils2.command.build.build') set_command('distutils2.tests.test_command_test.MockBuildCmd') dist = Distribution() dist.get_command_obj('build')._record = record = [] cmd = test(dist) cmd.runner = self.prepare_named_function(lambda: None) cmd.ensure_finalized() cmd.run() self.assertEqual(['build has run'], record)
def _load_commands(self, commands): commands = split_multiline(commands) if isinstance(commands, str): commands = [commands] for command in commands: set_command(command.strip())
def _load_commands(self, commands): commands = split_multiline(commands) if isinstance(commands, basestring): commands = [commands] for command in commands: set_command(command.strip())