@contextmanager
    def temporary_migration_module(self, app_label='migrations', module=None):
        temp_dir = tempfile.mkdtemp()
        try:
            target_dir = tempfile.mkdtemp(dir=temp_dir)
            with open(os.path.join(target_dir, '__init__.py'), 'w'):
                pass
            target_migrations_dir = os.path.join(target_dir, 'migrations')

            if module is None:
                module = apps.get_app_config(app_label).name + '.migrations'

            try:
                source_migrations_dir = module_dir(import_module(module))
            except (ImportError, ValueError):
                pass
            else:
                shutil.copytree(source_migrations_dir, target_migrations_dir)

            with extend_sys_path(temp_dir):
                new_module = os.path.basename(target_dir) + '.migrations'
                with self.settings(MIGRATION_MODULES={app_label: new_module}):
                    yield target_migrations_dir

        finally:
            shutil.rmtree(temp_dir)
Merges all connected lines from a source
dataset/ETHPy150Open django/django/tests/migrations/test_base.py/MigrationTestBase.temporary_migration_module--crossover with--dataset/ETHPy150Open Toblerity/Shapely/shapely/ops.py/CollectionOperator.linemerge