def test_copy(self) -> None:
        """Test copying of databases via [copy_database][trulens.core.database.utils.copy_database]."""

        db_types = ["sqlite_file"]  # , "postgres", "mysql", "sqlite_memory"
        # sqlite_memory might have problems with multithreading of tests

        for source_db_type in db_types:
            with self.subTest(msg=f"source prefix for {source_db_type}"):
                with clean_db(
                    source_db_type, table_prefix="test_prior_"
                ) as db_prior:
                    _populate_data(db_prior)

                    for target_db_type in db_types:
                        with self.subTest(
                            msg=f"target prefix for {target_db_type}"
                        ):
                            with clean_db(
                                target_db_type, table_prefix="test_post_"
                            ) as db_post:
                                # This makes the database tables:
                                db_post.migrate_database()

                                # assert database is empty before copying
                                with db_post.session.begin() as session:
                                    for orm_class in [
                                        db_post.orm.AppDefinition,
                                        db_post.orm.FeedbackDefinition,
                                        db_post.orm.Record,
                                        db_post.orm.FeedbackResult,
                                    ]:
                                        self.assertEqual(
                                            session.query(orm_class).all(),
                                            [],
                                            f"Expected no {orm_class}.",
                                        )

                                db_utils.copy_database(
                                    src_url=db_prior.engine.url,
                                    tgt_url=db_post.engine.url,
                                    src_prefix="test_prior_",
                                    tgt_prefix="test_post_",
                                )

                                # assert database contains exactly one of each row
                                with db_post.session.begin() as session:
                                    for orm_class in [
                                        db_post.orm.AppDefinition,
                                        db_post.orm.FeedbackDefinition,
                                        db_post.orm.Record,
                                        db_post.orm.FeedbackResult,
                                    ]:
                                        self.assertEqual(
                                            len(session.query(orm_class).all()),
                                            1,
                                            f"Expected exactly one {orm_class}.",
                                        )
Test copying of databases via [copy_database][trulens.core.database.utils.copy_database].
tests/integration/test_database.py