def test_write_compressed_one_suffix_gz():
    """backends.abstract.write_compressed: gz Does not duplicate compression suffixes
    """
    with utils.tempdir() as d:
        with abstract.write_compressed(os.path.join(d, 'results.txt.gz')) as f:
            f.write('foo')

        nt.eq_(os.listdir(d)[0], 'results.txt.gz')
def test_write_compressed_one_suffix_mixed():
    """backends.abstract.write_compressed: does not generate two different compression suffixes
    """
    with utils.tempdir() as d:
        with abstract.write_compressed(os.path.join(d, 'results.txt.bz2')) as f:
            f.write('foo')

        nt.eq_(os.listdir(d)[0], 'results.txt.gz')
def test_write_compressed_one_suffix_gz():
    """backends.abstract.write_compressed: gz Does not duplicate compression suffixes
    """
    with utils.tempdir() as d:
        with abstract.write_compressed(os.path.join(d, 'results.txt.gz')) as f:
            f.write('foo')

        nt.eq_(os.listdir(d)[0], 'results.txt.gz')
def test_write_compressed_one_suffix_mixed():
    """backends.abstract.write_compressed: does not generate two different compression suffixes
    """
    with utils.tempdir() as d:
        with abstract.write_compressed(os.path.join(d,
                                                    'results.txt.bz2')) as f:
            f.write('foo')

        nt.eq_(os.listdir(d)[0], 'results.txt.gz')
Example #5
0
def test_duplicate_extensions(extension, tmpdir, config):
    """Tests that exersizes a bug that caused the compressed extension to be
    duplicated in some cases.
    """
    tmpdir.chdir()
    config.set('core', 'compression', extension)
    expected = 'results.txt.' + extension

    with abstract.write_compressed(expected) as f:
        f.write('foo')

    assert expected in os.listdir('.')
Example #6
0
def test_duplicate_extensions(extension, tmpdir, config):
    """Tests that exersizes a bug that caused the compressed extension to be
    duplicated in some cases.
    """
    tmpdir.chdir()
    config.set('core', 'compression', extension)
    expected = 'results.txt.' + extension

    with abstract.write_compressed(expected) as f:
        f.write('foo')

    assert expected in os.listdir('.')
Example #7
0
def test_changed_extension(orig, new, tmpdir, config):
    """Tests that exersizes a bug that caused two extensions to be present if
    the compression method changed.
    """
    tmpdir.chdir()
    config.set('core', 'compression', str(new))

    with abstract.write_compressed('results.txt.' + orig) as f:
        f.write('foo')

    assert 'results.txt.' + new in os.listdir('.')
    assert 'results.txt.' + orig not in os.listdir('.')
    assert 'results.txt.{}.{}'.format(orig, new) not in os.listdir('.')
Example #8
0
def test_changed_extension(orig, new, tmpdir, config):
    """Tests that exersizes a bug that caused two extensions to be present if
    the compression method changed.
    """
    if 'xz' in [new, orig] and six.PY2 and not (_has_lzma() or _has_xz_bin()):
        pytest.skip("There is no xz compressor available.")

    tmpdir.chdir()
    config.set('core', 'compression', six.text_type(new))

    with abstract.write_compressed('results.txt.' + orig) as f:
        f.write('foo')

    assert 'results.txt.' + new in os.listdir('.')
    assert 'results.txt.' + orig not in os.listdir('.')
    assert 'results.txt.{}.{}'.format(orig, new) not in os.listdir('.')
Example #9
0
def test_changed_extension(orig, new, tmpdir, config):
    """Tests that exersizes a bug that caused two extensions to be present if
    the compression method changed.
    """
    if 'xz' in [new, orig] and six.PY2 and not (_has_lzma() or _has_xz_bin()):
        pytest.skip("There is no xz compressor available.")

    tmpdir.chdir()
    config.set('core', 'compression', six.text_type(new))

    with abstract.write_compressed('results.txt.' + orig) as f:
        f.write('foo')

    assert 'results.txt.' + new in os.listdir('.')
    assert 'results.txt.' + orig not in os.listdir('.')
    assert 'results.txt.{}.{}'.format(orig, new) not in os.listdir('.')