fix: 添加超时报错,修复一个错误的测试
Some checks failed
Python application test / build (pull_request) Failing after 26s
Some checks failed
Python application test / build (pull_request) Failing after 26s
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user