django-override-storage:测试工具以管理文件存储的副作用

时间:2024-05-20 20:05:32
【文件属性】:
文件名称:django-override-storage:测试工具以管理文件存储的副作用
文件大小:17KB
文件格式:ZIP
更新时间:2024-05-20 20:05:32
Python Django覆盖存储 停止使用测试文件填充磁盘,或使用文件系统模拟填充代码! 该项目提供的工具可帮助您减少测试期间使用FileField的副作用。 安装 pip install django-override-storage 简单用法 调用不带任何参数的override_storage()将修补所有FileField字段,以将文件的内容存储在内存中的高速缓存中,并在离开其上下文时将这些字段返回到其先前的存储。 在每次测试结束时或在退出上下文管理器时(取决于调用方式),都将删除存储缓存。 可以与django.test.utils.override_settings类似地使用:作为类装饰器,方法装饰器或上下文管理器。 from django . core . files . base import ContentFile from django . test import TestCas
【文件预览】:
django-override-storage-master
----setup.py(4KB)
----.gitignore(92B)
----requirements.txt(33B)
----MANIFEST.in(35B)
----override_storage()
--------__init__.py(220B)
--------__version__.py(63B)
--------storage.py(5KB)
--------utils.py(12KB)
--------runner.py(543B)
----LICENSE(1KB)
----.github()
--------workflows()
----README.rst(5KB)
----tests()
--------__init__.py(0B)
--------context.py(146B)
--------models.py(770B)
--------test.py(14KB)
--------test_settings.py(376B)
----runtests.py(390B)
----HISTORY.txt(307B)
----tox.ini(333B)

网友评论