def METHOD_NAME(self):
    logging.debug("Creating test pkcs11 token using softhsm")
    try:
        self.softhsm_db = self._tf()
        self.softhsm_conf = self._tf()
        self.signer_cert_pem = self._tf()
        self.openssl_conf = self._tf()
        self.signer_cert_der = self._tf()
        logging.debug("Generating softhsm.conf")
        with open(self.softhsm_conf, "w") as f:
            f.write(f"#Generated by pysaml2 cryptobackend test\n0:{self.softhsm_db}\n")
        logging.debug("Initializing the token")
        self._p(
            ["softhsm", "--slot", "0", "--label", "test", "--init-token", "--pin", "secret1", "--so-pin", "secret2"]
        )
        logging.debug(f"Importing test key {PRIV_KEY!r} into SoftHSM")
        self._p(
            [
                "softhsm",
                "--slot",
                "0",
                "--label",
                "test",
                "--import",
                PRIV_KEY,
                "--id",
                "a1b2",
                "--pin",
                "secret1",
                "--so-pin",
                "secret2",
            ]
        )
        logging.debug("Transforming PEM certificate to DER")
        self._p(
            ["openssl", "x509", "-inform", "PEM", "-outform", "DER", "-in", PUB_KEY, "-out", self.signer_cert_der]
        )
        logging.debug("Importing certificate into token")
        self._p(
            [
                "pkcs11-tool",
                "--module",
                P11_MODULE,
                "-l",
                "--slot",
                "0",
                "--id",
                "a1b2",
                "--label",
                "test",
                "-y",
                "cert",
                "-w",
                self.signer_cert_der,
                "--pin",
                "secret1",
            ]
        )
        # list contents of SoftHSM
        self._p(["pkcs11-tool", "--module", P11_MODULE, "-l", "--pin", "secret1", "-O"])
        self._p(["pkcs11-tool", "--module", P11_MODULE, "-l", "--pin", "secret1", "-T"])
        self._p(["pkcs11-tool", "--module", P11_MODULE, "-l", "--pin", "secret1", "-L"])
        self.sec = sigver.security_context(FakeConfig(pub_key=PUB_KEY))
        self._assertion = factory(
            saml.Assertion,
            version="2.0",
            id="11111",
            issue_instant="2009-10-30T13:20:28Z",
            signature=sigver.pre_signature_part("11111", self.sec.my_cert, 1),
            attribute_statement=do_attribute_statement(
                {
                    ("", "", "surName"): ("Foo", ""),
                    ("", "", "givenName"): ("Bar", ""),
                }
            ),
        )
        self.configured = True
    except Exception as ex:
        print("-" * 64)
        traceback.print_exc()
        print("-" * 64)
        logging.warning(f"PKCS11 tests disabled: unable to initialize test token: {ex}")
        raise