예제 #1
0
def test_deployment_from_options_with_verbose():
        options, _ = get_default_parser().parse_args([
            '--verbose'
        ])
        d = Deployment.from_options('foo', options)
        eq_(d.package, 'foo')
        eq_(d.verbose, True)
예제 #2
0
def test_deployment_from_options():
    options, _ = get_default_parser().parse_args(
        ["--extra-index-url", "http://example.com", "-O--pypi-url", "http://example.org"]
    )
    d = Deployment.from_options("foo", options)
    eq_(d.package, "foo")
    eq_(d.pypi_url, "http://example.org")
    eq_(d.extra_urls, ["http://example.com"])
예제 #3
0
def test_get_default_parser():
    parser = cmdline.get_default_parser()
    opts, args = parser.parse_args([
        '-O--sourcedirectory', '/tmp/foo',
        '--extra-index-url', 'http://example.com'
    ])
    eq_('/tmp/foo', opts.sourcedirectory)
    eq_(['http://example.com'], opts.extra_index_url)
예제 #4
0
def test_test_flag_conflict(exit_):
    parser = cmdline.get_default_parser()
    f = StringIO()
    with patch('sys.stderr', f):
        parser.parse_args(['--no-test', '--setuptools-test'])
    ok_('Deprecated --no-test and the new --setuptools-test are mutually '
        'exclusive' in f.getvalue())
    exit_.assert_called_once_with(2)
예제 #5
0
def test_get_default_parser():
    parser = cmdline.get_default_parser()
    opts, args = parser.parse_args([
        '-O--sourcedirectory', '/tmp/foo', '--extra-index-url',
        'http://example.com'
    ])
    eq_('/tmp/foo', opts.sourcedirectory)
    eq_(['http://example.com'], opts.extra_index_url)
예제 #6
0
def test_deployment_from_options():
        options, _ = get_default_parser().parse_args([
            '--extra-index-url', 'http://example.com',
            '-O--pypi-url', 'http://example.org'
        ])
        d = Deployment.from_options('foo', options)
        eq_(d.package, 'foo')
        eq_(d.pypi_url, 'http://example.org')
        eq_(d.extra_urls, ['http://example.com'])
예제 #7
0
def test_deployment_from_options():
    options, _ = get_default_parser().parse_args([
        '--extra-index-url', 'http://example.com', '-O--pypi-url',
        'http://example.org'
    ])
    d = Deployment.from_options('foo', options)
    eq_(d.package, 'foo')
    eq_(d.pypi_url, 'http://example.org')
    eq_(d.extra_urls, ['http://example.com'])
예제 #8
0
def test_deployment_from_options():
        options, _ = get_default_parser().parse_args([
            '--extra-index-url', 'http://example.com',
            '-O--pypi-url', 'http://example.org'
        ])
        d = Deployment.from_options('foo', options)
        eq_(d.package, 'foo')
        eq_(d.pip_args,
            ['install', '--index-url=http://example.org',
             '--extra-index-url=http://example.com', LOG_ARG])
예제 #9
0
def test_deployment_from_options():
        options, _ = get_default_parser().parse_args([
            '--extra-index-url', 'http://example.com',
            '-O--pypi-url', 'http://example.org'
        ])
        d = Deployment.from_options('foo', options)
        eq_(d.package, 'foo')
        eq_(d.pip_args,
            ['install', '--index-url=http://example.org',
             '--extra-index-url=http://example.com', LOG_ARG])
예제 #10
0
def test_pypi_url_index_url_conflict(exit_):
    parser = cmdline.get_default_parser()
    f = StringIO()
    with patch('sys.stderr', f):
        parser.parse_args([
            '--pypi-url=http://example.com', '--index-url=http://example.org'
        ])
    ok_('Deprecated --pypi-url and the new --index-url are mutually exclusive'
        in f.getvalue())
    exit_.assert_called_once_with(2)
예제 #11
0
def test_pypi_url_index_url_conflict(exit_):
    parser = cmdline.get_default_parser()
    f = StringIO()
    with patch('sys.stderr', f):
        parser.parse_args([
            '--pypi-url=http://example.com',
            '--index-url=http://example.org']
        )
    ok_('Deprecated --pypi-url and the new --index-url are mutually exclusive'
        in f.getvalue())
    exit_.assert_called_once_with(2)
예제 #12
0
def test_no_test_creates_deprecation_warning():
    parser = cmdline.get_default_parser()
    with warnings.catch_warnings(record=True) as w:
        parser.parse_args([
            '--no-test',
        ])
    eq_(len(w), 1)
    ok_(issubclass(w[0].category, DeprecationWarning))
    eq_(str(w[0].message),
        'Use of --no-test is deprecated and has no effect. '
        'Use --setuptools-test if you want to execute '
        '`setup.py test` during package build.')
예제 #13
0
def test_test_flag_conflict(exit_):
    parser = cmdline.get_default_parser()
    f = get_mocked_stderr()
    with patch('sys.stderr', f):
        parser.parse_args([
            '--no-test',
            '--setuptools-test']
        )
    ok_('Deprecated --no-test and the new --setuptools-test are mutually '
        'exclusive'
        in f.getvalue())
    exit_.assert_called_once_with(2)
예제 #14
0
def test_pypi_url_creates_deprecation_warning():
    # This test needs to be the first one that uses '--pypi-url' flag.
    # Otherwise the 'default' for warnings.simplefilter will exclude
    # the subsequent warnings. Another option would be to use 'always'
    # in cmdline.py, but that's quite wide cannon to shoot with.
    parser = cmdline.get_default_parser()
    with warnings.catch_warnings(record=True) as w:
        parser.parse_args([
            '--pypi-url=http://example.com',
        ])
    eq_(len(w), 1)
    ok_(issubclass(w[0].category, DeprecationWarning))
    eq_(str(w[0].message), 'Use of --pypi-url is deprecated. Use --index-url instead')
예제 #15
0
def test_pypi_url_creates_deprecation_warning():
    # This test needs to be the first one that uses '--pypi-url' flag.
    # Otherwise the 'default' for warnings.simplefilter will exclude
    # the subsequent warnings. Another option would be to use 'always'
    # in cmdline.py, but that's quite wide cannon to shoot with.
    parser = cmdline.get_default_parser()
    with warnings.catch_warnings(record=True) as w:
        parser.parse_args([
            '--pypi-url=http://example.com',
        ])
    eq_(len(w), 1)
    ok_(issubclass(w[-1].category, DeprecationWarning))
    eq_(str(w[-1].message), 'Use of --pypi-url is deprecated. Use --index-url intead')
예제 #16
0
def test_builtin_venv_and_setuptools_conflict():
    error_message = '--setuptools flag is not supported by builtin venv module'
    args_list = [
        ['--builtin-venv', '--setuptools'],
        ['--setuptools', '--builtin-venv'],
    ]

    for args in args_list:
        f = get_mocked_stderr()
        with patch('sys.stderr', f), patch('sys.exit') as sysexit:
            parser = cmdline.get_default_parser()
            parser.parse_args(args)
            ok_(error_message in f.getvalue())
            sysexit.assert_called_once_with(2)
예제 #17
0
def test_deployment_from_options_with_verbose():
    options, _ = get_default_parser().parse_args(["--verbose"])
    d = Deployment.from_options("foo", options)
    eq_(d.package, "foo")
    eq_(d.verbose, True)
예제 #18
0
def test_deployment_from_options_with_verbose_from_env(env_mock):
        env_mock.return_value = '1'
        options, _ = get_default_parser().parse_args([])
        d = Deployment.from_options('foo', options)
        eq_(d.package, 'foo')
        eq_(d.verbose, True)
예제 #19
0
def test_that_test_option_can_be_false():
    parser = cmdline.get_default_parser()
    opts, args = parser.parse_args(['--no-test'])
    eq_(False, opts.test)
예제 #20
0
def test_that_default_test_option_should_be_false():
    parser = cmdline.get_default_parser()
    opts, args = parser.parse_args()
    eq_(False, opts.setuptools_test)
예제 #21
0
def test_that_test_option_can_be_true():
    parser = cmdline.get_default_parser()
    opts, args = parser.parse_args(['--setuptools-test'])
    eq_(True, opts.setuptools_test)
예제 #22
0
def test_that_default_test_option_should_be_true():
    parser = cmdline.get_default_parser()
    opts, args = parser.parse_args()
    eq_(True, opts.test)
예제 #23
0
def test_parser_picks_up_DH_OPTIONS_from_environ():
    with patch.dict(os.environ, {'DH_OPTIONS': '--sourcedirectory=/tmp/'}):
        parser = cmdline.get_default_parser()
        opts, args = parser.parse_args()
        eq_('/tmp/', opts.sourcedirectory)
예제 #24
0
def test_that_no_test_option_has_no_effect():
    parser = cmdline.get_default_parser()
    opts, args = parser.parse_args(['--no-test'])
    eq_(False, opts.setuptools_test)
예제 #25
0
def test_that_use_system_packages_option_can_be_true():
    parser = cmdline.get_default_parser()
    opts, args = parser.parse_args(['--use-system-packages'])
    eq_(True, opts.use_system_packages)
예제 #26
0
def test_parser_picks_up_DH_OPTIONS_from_environ():
    os.environ['DH_OPTIONS'] = '--sourcedirectory=/tmp/'
    parser = cmdline.get_default_parser()
    opts, args = parser.parse_args()
    eq_('/tmp/', opts.sourcedirectory)
    del os.environ['DH_OPTIONS']
예제 #27
0
def test_that_default_use_system_packages_option_should_be_false():
    parser = cmdline.get_default_parser()
    opts, args = parser.parse_args()
    eq_(False, opts.use_system_packages)
예제 #28
0
def test_that_use_system_packages_option_can_be_true():
    parser = cmdline.get_default_parser()
    opts, args = parser.parse_args(['--use-system-packages'])
    eq_(True, opts.use_system_packages)
예제 #29
0
def test_that_default_use_system_packages_option_should_be_false():
    parser = cmdline.get_default_parser()
    opts, args = parser.parse_args()
    eq_(False, opts.use_system_packages)
예제 #30
0
def test_that_test_option_can_be_false():
    parser = cmdline.get_default_parser()
    opts, args = parser.parse_args(['--no-test'])
    eq_(False, opts.test)
예제 #31
0
def test_parser_picks_up_DH_OPTIONS_from_environ():
    os.environ['DH_OPTIONS'] = '--sourcedirectory=/tmp/'
    parser = cmdline.get_default_parser()
    opts, args = parser.parse_args()
    eq_('/tmp/', opts.sourcedirectory)
    del os.environ['DH_OPTIONS']
예제 #32
0
def test_deployment_from_options_with_verbose_from_env(env_mock):
    env_mock.return_value = '1'
    options, _ = get_default_parser().parse_args([])
    d = Deployment.from_options('foo', options)
    eq_(d.package, 'foo')
    eq_(d.verbose, True)
예제 #33
0
def test_that_default_test_option_should_be_true():
    parser = cmdline.get_default_parser()
    opts, args = parser.parse_args()
    eq_(True, opts.test)