def test_index(capsys, tmpdir): temp_dir = tmpdir.mkdir('tmp') temp_out = temp_dir.join(OUTPUT).strpath classify_text_tutorial.index(os.path.join(RESOURCES, 'texts'), temp_out) out, err = capsys.readouterr() assert OUTPUT in out assert len(temp_dir.listdir()) == 1
def index_file(tmpdir_factory): temp_file = tmpdir_factory.mktemp('tmp').join(OUTPUT) temp_out = temp_file.strpath classify_text_tutorial.index(os.path.join(RESOURCES, 'texts'), temp_out) return temp_file