Задать вопрос

Тел: +7 965 3737 888

483

Просмотров

0

Ответов

change settings locally in an individual test

<p>So you need to change some settings when running an individual test in a test case. You could just wrap the test between old_value = settings.MY_SETTING and settings.MY_SETTING = old_value. This snippet provides a helper which makes this a bit more convenient, since settings are restored to their old values automatically.
</p>
<p>Example usage:
</p>
class MyTestCase(TestCase):

    def test_something(self):
        with patch_settings(MY_SETTING='my value',
                            OTHER_SETTING='other value'):
            do_my_test()

Вопрос полезен? Да0/Нет0
file_4394.py(584.0б)
None