Beispiel #1
0
def test_gen_dir(tmpdir):
    with open(example_filename('test_settings.dat'), encoding='utf-8') as f:
        settings = Settings.load_from(f)

    with io.StringIO() as f:
        generate_csv(f, [basedir], settings=settings, outdir=str(tmpdir))
        got = f.getvalue()
    assert_dirs_same(str(tmpdir), os.path.join(basedir, 'expected_dir'))
Beispiel #2
0
def test_gen_csv_cs(lang):
    with open(example_filename('test_settings.dat')) as f:
        settings = Settings.load_from(f)
    settings.lang = lang

    with io.StringIO() as f:
        generate_csv(f, [basedir], settings=settings)
        got = f.getvalue()
    with open(os.path.join(basedir, 'expected_{}.csv'.format(lang))) as f:
        expected = f.read()
    assert got == expected
Beispiel #3
0
def test_gen_csv_cs(lang):
    with open(example_filename('test_settings.dat'), encoding='utf-8') as f:
        settings = Settings.load_from(f)
    settings.lang = lang

    with io.StringIO() as f:
        generate_csv(f, [basedir], settings=settings)
        got = f.getvalue()

    with open(os.path.join(basedir, 'expected_{}.csv'.format(lang)),
            encoding='utf-8') as expected_f:

        with io.StringIO(got) as got_f:
            assert_csv_same(got_f, expected_f)