Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/python-3.x/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 3.x 需要通过mock在本地测试Python Google Cloud函数_Python 3.x_Unit Testing_Mocking_Google Cloud Functions_Google Cloud Storage - Fatal编程技术网

Python 3.x 需要通过mock在本地测试Python Google Cloud函数

Python 3.x 需要通过mock在本地测试Python Google Cloud函数,python-3.x,unit-testing,mocking,google-cloud-functions,google-cloud-storage,Python 3.x,Unit Testing,Mocking,Google Cloud Functions,Google Cloud Storage,我不熟悉Python3中的云函数和模拟测试 我已经编写了一个基本的python google cloud函数,用于将数字字符串存储到google cloud Bucket中 from google.cloud import storage import uuid import os file_name = uuid.uuid4().hex file_content = os.urandom(32) cloudStorage = storage.Client() my_folder_name

我不熟悉Python3中的云函数和模拟测试

我已经编写了一个基本的python google cloud函数,用于将数字字符串存储到google cloud Bucket中

from google.cloud import storage
import uuid
import os 

file_name = uuid.uuid4().hex
file_content = os.urandom(32)

cloudStorage = storage.Client()
my_folder_name = 'random' + '/' + file_name
            
bucket = cloudStorage.bucket('TestBucket')
folder = bucket.blob(my_folder_name)
folder.upload_from_string( file_content , content_type="text/plain") 
是否欣赏编写单元测试脚本并通过mock在本地机器上执行的任何想法或方法