我在使用 python-behave 时遇到了问题。
我在每个场景之前创建一个沙盒数据库,并在场景之后销毁它。
但是每个场景的内存使用量增加约 20MB,所有测试用例(LoL)的总使用量约为 3.xGB。
我的问题是为什么当我调用 context.runner.teardown_databases() 时没有释放内存?
from django.test.runner import DiscoverRunner
def before_scenario(context, scenario):
context.runner = DiscoverRunner()
context.runner.setup_test_environment()
context.old_db_config = context.runner.setup_databases()
def after_scenario(context, scenario):
context.runner.teardown_databases(context.old_db_config)
context.runner.teardown_test_environment()
Feature:
Scenario:
Given I have a debit card
When I withdraw 200
Then I should get $200 in cash
@given('I have a debit card')
def step1(context):
pass
@given('I withdraw 200')
def step2(context):
pass
@given('I should get $200 in cash')
def step3(context):
pass
蟒蛇行为:版本 1.2.5
django:版本 1.8.0
蟒蛇:2.7版
任何建议表示赞赏。