def launch_runner(project_path=None, command_to_run=None, run_once=False, directory=None, php_version=HYPERNODE_VAGRANT_DEFAULT_PHP_VERSION, ssh_user=HYPERNODE_VAGRANT_DEFAULT_USER): """ Run the hook inside an ephemeral hypernode-vagrant context :param str project_path: The project path to upload to the vagrant before running the specified command in that directory in the vagrant :param str command_to_run: The shell command to run in the uploaded project_path :param bool run_once: Run once and clean up, default blocks in the context and waits for signals. :param str directory: The hypernode-vagrant checkout to use. By default a temporary directory with a fresh checkout is created :param str php_version: The PHP version to use :param str ssh_user: The SSH user to use to run the hook as :return None: """ with hypernode_vagrant(directory=directory, php_version=php_version) as info: runner = run_project_command_in_vagrant if \ run_once or not command_to_run else loop_run_project_command_in_vagrant runner(project_path, command_to_run, vagrant_info=info, ssh_user=ssh_user)
def test_hypernode_vagrant_creates_hypernode_vagrant_with_xdebug_enabled_if_specified(self): with hypernode_vagrant(xdebug_enabled=True): self.create_hypernode_vagrant.assert_called_once_with( directory=None, php_version=HYPERNODE_VAGRANT_DEFAULT_PHP_VERSION, xdebug_enabled=True )
def launch_runner(project_path=None, command_to_run=None, run_once=False, directory=None, php_version=HYPERNODE_VAGRANT_DEFAULT_PHP_VERSION, ssh_user=HYPERNODE_VAGRANT_DEFAULT_USER, xdebug_enabled=False, skip_try_sudo=False, xenial=False, no_provision=False): """ Run the hook inside an ephemeral hypernode-vagrant context :param str project_path: The project path to upload to the vagrant before running the specified command in that directory in the vagrant :param str command_to_run: The shell command to run in the uploaded project_path :param bool run_once: Run once and clean up, default blocks in the context and waits for signals. :param str directory: The hypernode-vagrant checkout to use. By default a temporary directory with a fresh checkout is created :param str php_version: The PHP version to use :param str ssh_user: The SSH user to use to run the hook as :param bool xdebug_enabled: Install xdebug in the vagrant :param bool skip_try_sudo: Skip try to sudo beforehand to fail early :param bool xenial: Start a Xenial image :param bool no_provision: Pass --no-provision to vagrant up :return None: """ with hypernode_vagrant( directory=directory, php_version=php_version, xdebug_enabled=xdebug_enabled, skip_try_sudo=skip_try_sudo, xenial=xenial, no_provision=no_provision ) as info: runner = run_project_command_in_vagrant if \ run_once or not command_to_run else loop_run_project_command_in_vagrant runner( project_path, command_to_run, vagrant_info=info, ssh_user=ssh_user )
def test_hypernode_vagrant_creates_hypernode_vagrant_of_specified_php_version(self): with hypernode_vagrant(php_version='7.0'): self.create_hypernode_vagrant.assert_called_once_with( directory=None, php_version='7.0', xdebug_enabled=False )
def test_hypernode_vagrant_creates_hypernode_vagrant_before_context(self): with hypernode_vagrant(): self.create_hypernode_vagrant.assert_called_once_with( directory=None, php_version=HYPERNODE_VAGRANT_DEFAULT_PHP_VERSION, xdebug_enabled=False )
def test_hypernode_vagrant_creates_hypernode_vagrant_using_specified_checkout( self): with hypernode_vagrant( directory='/your/already/checked/out/hypernode-vagrant'): self.create_hypernode_vagrant.assert_called_once_with( directory='/your/already/checked/out/hypernode-vagrant', php_version=HYPERNODE_VAGRANT_DEFAULT_PHP_VERSION)
def test_hypernode_vagrant_creates_hypernode_vagrant_before_context(self): with hypernode_vagrant(): self.create_hypernode_vagrant.assert_called_once_with( directory=None, php_version=HYPERNODE_VAGRANT_DEFAULT_PHP_VERSION, xdebug_enabled=False, skip_try_sudo=False, xenial=False, no_provision=False)
def test_hypernode_vagrant_creates_hypernode_vagrant_using_specified_checkout(self): with hypernode_vagrant( directory='/your/already/checked/out/hypernode-vagrant' ): self.create_hypernode_vagrant.assert_called_once_with( directory='/your/already/checked/out/hypernode-vagrant', php_version=HYPERNODE_VAGRANT_DEFAULT_PHP_VERSION, xdebug_enabled=False )
def test_hypernode_vagrant_skips_provisioning_if_specified(self): with hypernode_vagrant(no_provision=True): self.create_hypernode_vagrant.assert_called_once_with( directory=None, php_version=HYPERNODE_VAGRANT_DEFAULT_PHP_VERSION, xdebug_enabled=False, skip_try_sudo=False, xenial=False, no_provision=True)
def test_hypernode_vagrant_skips_provisioning_if_specified(self): with hypernode_vagrant(no_provision=True): self.create_hypernode_vagrant.assert_called_once_with( directory=None, php_version=HYPERNODE_VAGRANT_DEFAULT_PHP_VERSION, xdebug_enabled=False, skip_try_sudo=False, xenial=False, no_provision=True )
def test_hypernode_vagrant_creates_hypernode_vagrant_of_specified_php_version( self): with hypernode_vagrant(php_version='7.0'): self.create_hypernode_vagrant.assert_called_once_with( directory=None, php_version='7.0', xdebug_enabled=False, skip_try_sudo=False, xenial=False, no_provision=False)
def test_hypernode_vagrant_creates_hypernode_vagrant_using_specified_checkout( self): with hypernode_vagrant( directory='/your/already/checked/out/hypernode-vagrant'): self.create_hypernode_vagrant.assert_called_once_with( directory='/your/already/checked/out/hypernode-vagrant', php_version=HYPERNODE_VAGRANT_DEFAULT_PHP_VERSION, xdebug_enabled=False, skip_try_sudo=False, xenial=False, no_provision=False)
def launch_runner(project_path=None, command_to_run=None, run_once=False, directory=None, php_version=HYPERNODE_VAGRANT_DEFAULT_PHP_VERSION, ssh_user=HYPERNODE_VAGRANT_DEFAULT_USER, xdebug_enabled=False, skip_try_sudo=False, xenial=False, no_provision=False): """ Run the hook inside an ephemeral hypernode-vagrant context :param str project_path: The project path to upload to the vagrant before running the specified command in that directory in the vagrant :param str command_to_run: The shell command to run in the uploaded project_path :param bool run_once: Run once and clean up, default blocks in the context and waits for signals. :param str directory: The hypernode-vagrant checkout to use. By default a temporary directory with a fresh checkout is created :param str php_version: The PHP version to use :param str ssh_user: The SSH user to use to run the hook as :param bool xdebug_enabled: Install xdebug in the vagrant :param bool skip_try_sudo: Skip try to sudo beforehand to fail early :param bool xenial: Start a Xenial image :param bool no_provision: Pass --no-provision to vagrant up :return None: """ with hypernode_vagrant(directory=directory, php_version=php_version, xdebug_enabled=xdebug_enabled, skip_try_sudo=skip_try_sudo, xenial=xenial, no_provision=no_provision) as info: runner = run_project_command_in_vagrant if \ run_once or not command_to_run else loop_run_project_command_in_vagrant runner(project_path, command_to_run, vagrant_info=info, ssh_user=ssh_user)
def test_hypernode_vagrant_gets_networking_information_from_created_vagrant(self): with hypernode_vagrant(): self.get_networking_information_from_vagrant.assert_called_once_with( self.create_hypernode_vagrant.return_value )
def test_hypernode_vagrant_does_not_remove_hypernode_vagrant_if_pre_existing_directory_used(self): with hypernode_vagrant(directory='/tmp/some/directory'): pass self.assertFalse(self.remove_hypernode_vagrant.called)
def test_hypernode_vagrant_yields_vagrant_networking_information(self): with hypernode_vagrant() as information: self.assertEqual( information, self.get_networking_information_from_vagrant.return_value )
def test_hypernode_vagrant_gets_networking_information_from_created_vagrant( self): with hypernode_vagrant(): self.get_networking_information_from_vagrant.assert_called_once_with( self.create_hypernode_vagrant.return_value)
def test_hypernode_vagrant_yields_vagrant_networking_information(self): with hypernode_vagrant() as information: self.assertEqual( information, self.get_networking_information_from_vagrant.return_value)
def test_hypernode_vagrant_does_not_remove_hypernode_vagrant_if_pre_existing_directory_used( self): with hypernode_vagrant(directory='/tmp/some/directory'): pass self.assertFalse(self.remove_hypernode_vagrant.called)
def test_hypernode_vagrant_removes_hypernode_vagrant_after_context(self): with hypernode_vagrant(): self.assertFalse(self.remove_hypernode_vagrant.called) self.remove_hypernode_vagrant.assert_called_once_with( self.create_hypernode_vagrant.return_value)
def test_hypernode_vagrant_creates_hypernode_vagrant_of_specified_php_version( self): with hypernode_vagrant(php_version='7.0'): self.create_hypernode_vagrant.assert_called_once_with( directory=None, php_version='7.0')
def test_hypernode_vagrant_destroys_hypernode_vagrant_after_context(self): with hypernode_vagrant(): self.assertFalse(self.destroy_hypernode_vagrant.called) self.destroy_hypernode_vagrant.assert_called_once_with( self.create_hypernode_vagrant.return_value )
def test_hypernode_vagrant_creates_hypernode_vagrant_before_context(self): with hypernode_vagrant(): self.create_hypernode_vagrant.assert_called_once_with( directory=None, php_version=HYPERNODE_VAGRANT_DEFAULT_PHP_VERSION)