Пример #1
0
def test_generate_config2(tmp_path):
    """Test that generate_config works with the default filename."""

    with set_temp_config(tmp_path):
        from astropy.config.configuration import generate_config
        generate_config('astropy')

    assert os.path.exists(tmp_path / 'astropy' / 'astropy.cfg')

    with open(tmp_path / 'astropy' / 'astropy.cfg') as fp:
        conf = fp.read()

    check_config(conf)
Пример #2
0
def test_generate_config(tmp_path):
    from astropy.config.configuration import generate_config
    out = io.StringIO()
    generate_config('astropy', out)
    conf = out.getvalue()

    outfile = tmp_path / 'astropy.cfg'
    generate_config('astropy', outfile)
    with open(outfile) as fp:
        conf2 = fp.read()

    for c in (conf, conf2):
        check_config(c)
Пример #3
0
def test_generate_config(tmp_path):
    from astropy.config.configuration import generate_config
    out = io.StringIO()
    generate_config('astropy', out)
    conf = out.getvalue()

    outfile = tmp_path / 'astropy.cfg'
    generate_config('astropy', outfile)
    with open(outfile) as fp:
        conf2 = fp.read()

    for c in (conf, conf2):
        # test that the output contains some lines that we expect
        assert '# unicode_output = False' in c
        assert '[io.fits]' in c
        assert '[visualization.wcsaxes]' in c
        assert '## Whether to log exceptions before raising them.' in c
        assert '# log_exceptions = False' in c
Пример #4
0
def test_generate_config2(tmp_path):
    """Test that generate_config works with the default filename."""

    with set_temp_config(tmp_path):
        from astropy.config.configuration import generate_config
        generate_config('astropy')

    assert os.path.exists(tmp_path / 'astropy' / 'astropy.cfg')

    with open(tmp_path / 'astropy' / 'astropy.cfg') as fp:
        conf = fp.read()

    # test that the output contains some lines that we expect
    assert '# unicode_output = False' in conf
    assert '[io.fits]' in conf
    assert '[visualization.wcsaxes]' in conf
    assert '## Whether to log exceptions before raising them.' in conf
    assert '# log_exceptions = False' in conf