Example #1
0
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)
Example #2
0
    def test_builds_before_running_tests(self):
        self.addCleanup(set_command, 'packaging.command.build.build')
        set_command('packaging.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)
Example #3
0
 def _load_commands(self, commands):
     commands = split_multiline(commands)
     if isinstance(commands, str):
         commands = [commands]
     for command in commands:
         set_command(command.strip())