-
-@pytest.fixture
-def sp_importer(temp_db_conn, def_config, temp_phplib_dir_with_migration):
- """
- Return an instance of SPImporter.
- """
- loader = SPWikiLoader(def_config, ['en'])
- return SPImporter(def_config, temp_phplib_dir_with_migration, temp_db_conn, loader)
-
-@pytest.fixture
-def temp_phplib_dir_with_migration():
- """
- Return temporary phpdir with migration subdirectory and
- PhraseSettingsToJson.php script inside.
- """
- migration_file = (TEST_BASE_DIR / '..' / 'lib-php' / 'migration'
- / 'PhraseSettingsToJson.php').resolve()
- with tempfile.TemporaryDirectory() as phpdir:
- (Path(phpdir) / 'migration').mkdir()
- migration_dest_path = (Path(phpdir) / 'migration' / 'PhraseSettingsToJson.php').resolve()
- copyfile(migration_file, migration_dest_path)
-
- yield Path(phpdir)
-
-@pytest.fixture
-def default_phrases(temp_db_cursor):
- temp_db_cursor.execute("""
- CREATE TABLE place_classtype_testclasstypetable_to_delete();
- CREATE TABLE place_classtype_testclasstypetable_to_keep();""")