def _dataset_id_collision_test(self, primary, modifier=lambda uuid: uuid):
        dataset_id = unicode(uuid4())
        existing_dataset = Dataset(dataset_id=dataset_id)
        existing_manifestation = Manifestation(
            dataset=existing_dataset, primary=True)

        saving = self.persistence_service.save(Deployment(
            nodes={
                Node(
                    uuid=self.NODE_A_UUID,
                    manifestations={existing_manifestation.dataset_id:
                                    existing_manifestation}
                ),
                Node(uuid=self.NODE_B_UUID),
            }
        ))

        def saved(ignored):
            return self.assertResult(
                b"POST", b"/configuration/datasets",
                {u"primary": unicode(primary),
                 u"dataset_id": modifier(dataset_id)},
                CONFLICT,
                {u"description": u"The provided dataset_id is already in use."}
            )
        posting = saving.addCallback(saved)

        def failed(reason):
            deployment = self.persistence_service.get()
            (node_a, node_b) = deployment.nodes
            if node_a.uuid != self.NODE_A_UUID:
                # They came out of the set backwards.
                node_a, node_b = node_b, node_a
            self.assertItemsEqual(
                ({existing_manifestation.dataset_id: existing_manifestation},
                 {}),
                (node_a.manifestations, node_b.manifestations)
            )

        posting.addCallback(failed)
        return posting
Enter context manager and create a temporary directory
dataset/ETHPy150Open ClusterHQ/flocker/flocker/control/test/test_httpapi.py/CreateDatasetTestsMixin._dataset_id_collision_test--crossover with--dataset/ETHPy150Open zalando/turnstile/turnstile/models/staging.py/StagingArea.__enter__