fix: 添加超时报错,修复一个错误的测试
Some checks failed
Python application test / build (pull_request) Failing after 26s

This commit is contained in:
2024-04-29 18:37:04 +08:00
parent 1f9ccc53c1
commit 7523e0c06a
2 changed files with 28 additions and 0 deletions

View File

@@ -1,6 +1,8 @@
import unittest
import warnings
from pydantic import NoneStr
from detection.backdoor_detection import find_dangerous_functions
from detection.GPTdetection import detectGPT
import os
@@ -84,6 +86,8 @@ class TestBackdoorDetection(unittest.TestCase):
self.assertEqual(len(results["low"]), 0)
def test_gpt_env_no_set(self):
if os.getenv("OPENAI_API_KEY") is not None:
self.skipTest("OPENAI_API_KEY is setted")
content = "print('test test')"
with self.assertRaises(ValueError):
detectGPT(content)