一个用于nose的简单指定初始化脚本的插件
项目描述
nose插件,默认启用,在nose收集或运行任何测试之前执行用户定义的初始化函数。用户在环境变量中指定包含初始化函数的python模块,main。
使用两个环境变量之一来指定模块
NOSE_INIT_MODULE=app.tests.nose_init
NOSE_INIT_PATH=/path/to/my/app/tests/nose_init.py
然后,像往常一样运行您的nose测试。
示例初始化模块
假设我们已将初始化模块命名为nose_init.py,并将其保存到/path/to/my/app/tests/nose_init.py。该文件必须包含一个main函数。例如
"""
Initialization script which is imported when ``nosetests`` is run.
The main function will be executed before any other application code
is imported.
"""
def main():
"""nose_easy_init will call this before each ``nosetests`` run."""
setup_my_test_environment()
setup_my_test_database()
etc()
然后,在运行nosetests之前,设置两个环境变量之一以指定模块
NOSE_INIT_MODULE=app.tests.nose_init
NOSE_INIT_PATH=/path/to/my/app/tests/nose_init.py
注意,如果两个环境变量都已定义,则文件系统路径NOSE_INIT_PATH将优先于NOSE_INIT_MODULE。
项目详情
关闭
nose-easy-init-1.0.2.tar.gz的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | fbc8496b21e12f086a55c527c3c1db443dbf55fb257214e8a33affad7dea7f83 |
|
MD5 | a5bd8c2e980b807187d2c7cfd61d6973 |
|
BLAKE2b-256 | 0347334097e15695aa1f2dda8847b39c08037b675163d464f2ee6c7f652367f3 |