def METHOD_NAME(self, mock_lxml):
    mock_lxml.side_effect = ImportError()
    with self.assertRaises(ParserError) as cm:
        DtdParser.parse(b"", "/file/path/def.dtd")
    self.assertEqual("DtdParser requires lxml to run.", str(cm.exception))