Exemplo n.º 1
0
def register_egg(egg_file, repo):
    get_log().info("Registering {} to {}".format(egg_file, repo))
    dist = _get_dist(egg_file)
    register_cmd = register.register(dist)
    register_cmd.repository = repo
    register_cmd._set_config()
    register_cmd.send_metadata()
Exemplo n.º 2
0
    def test_register_exception(self):
        """Ensure that the register command has been properly removed."""
        dist = Distribution()
        dist.dist_files = [(mock.Mock(), mock.Mock(), mock.Mock())]

        cmd = register(dist)

        with pytest.raises(RemovedCommandError):
            cmd.run()
Exemplo n.º 3
0
    def test_warns_deprecation(self):
        dist = Distribution()

        cmd = register(dist)
        cmd.run_command = mock.Mock()
        cmd.send_metadata = mock.Mock()
        cmd.announce = mock.Mock()

        cmd.run()

        cmd.announce.assert_called_once_with(
            "WARNING: Registering is deprecated, use twine to upload instead "
            "(https://pypi.org/p/twine/)", log.WARN)
Exemplo n.º 4
0
    def test_warns_deprecation(self):
        dist = Distribution()

        cmd = register(dist)
        cmd.run_command = mock.Mock()
        cmd.send_metadata = mock.Mock()
        cmd.announce = mock.Mock()

        cmd.run()

        cmd.announce.assert_called_with(
            "WARNING: Registering is deprecated, use twine to upload instead "
            "(https://pypi.org/p/twine/)",
            log.WARN
        )
Exemplo n.º 5
0
def register_package (metadata, headers=dict(), ) :
    _dist = Distribution(dict(script_name="/tmp/", verbose=-1, ))

    for k, v in metadata.items() :
        setattr(_dist.metadata, k, v, )

    if "-q" not in sys.argv :
        sys.argv.append("-q")

    register.DEFAULT_REPOSITORY = URL_GPPI_PYPI
    _cmd = register(_dist)
    _cmd.announce = lambda a, b=None: sys.stdout.write(a + "\n")

    _cmd.post_to_server = FakeServer(headers, )
    _cmd.run()
Exemplo n.º 6
0
    def test_warns_deprecation_when_raising(self):
        dist = Distribution()

        cmd = register(dist)
        cmd.run_command = mock.Mock()
        cmd.send_metadata = mock.Mock()
        cmd.send_metadata.side_effect = Exception
        cmd.announce = mock.Mock()

        with pytest.raises(Exception):
            cmd.run()

        cmd.announce.assert_called_once_with(
            "WARNING: Registering is deprecated, use twine to upload instead "
            "(https://pypi.org/p/twine/)", log.WARN)
Exemplo n.º 7
0
    def test_warns_deprecation_when_raising(self):
        dist = Distribution()

        cmd = register(dist)
        cmd.run_command = mock.Mock()
        cmd.send_metadata = mock.Mock()
        cmd.send_metadata.side_effect = Exception
        cmd.announce = mock.Mock()

        with pytest.raises(Exception):
            cmd.run()

        cmd.announce.assert_called_with(
            "WARNING: Registering is deprecated, use twine to upload instead "
            "(https://pypi.org/p/twine/)",
            log.WARN
        )