def test_gen_dir_rst(fakesphinxapp): """Test gen_dir_rst.""" gallery_conf = build_test_configuration() print(os.listdir(gallery_conf['examples_dir'])) args = (gallery_conf['src_dir'], gallery_conf['gallery_dir'], gallery_conf, []) out = generate_dir_rst(*args) assert out[0] == "" fname_readme = os.path.join(gallery_conf['src_dir'], 'README.txt') with open(fname_readme, 'wb') as fid: fid.write(u"Testing\n=======\n\nÓscar here.".encode('utf-8')) out = generate_dir_rst(*args) assert u"Óscar here" in out[0]
def test_gen_dir_rst(gallery_conf, fakesphinxapp, ext): """Test gen_dir_rst.""" print(os.listdir(gallery_conf['examples_dir'])) fname_readme = os.path.join(gallery_conf['src_dir'], 'README.txt') with open(fname_readme, 'wb') as fid: fid.write(u"Testing\n=======\n\nÓscar here.".encode('utf-8')) fname_out = os.path.splitext(fname_readme)[0] + ext if fname_readme != fname_out: shutil.move(fname_readme, fname_out) args = (gallery_conf['src_dir'], gallery_conf['gallery_dir'], gallery_conf, []) if ext == '.bad': # not found with correct ext with pytest.raises(FileNotFoundError, match='does not have a README'): generate_dir_rst(*args) else: out = generate_dir_rst(*args) assert u"Óscar here" in out[0]
def test_gen_dir_rst(gallery_conf, fakesphinxapp): """Test gen_dir_rst.""" print(os.listdir(gallery_conf['examples_dir'])) fname_readme = os.path.join(gallery_conf['src_dir'], 'README.txt') with open(fname_readme, 'wb') as fid: fid.write(u"Testing\n=======\n\nÓscar here.".encode('utf-8')) args = (gallery_conf['src_dir'], gallery_conf['gallery_dir'], gallery_conf, []) out = generate_dir_rst(*args) assert u"Óscar here" in out[0]