def test_define_setting_then_loading_profile(): x = Settings() Settings.define_setting( u'fun_times', default=3, description=u'Something something spoon', options=(1, 2, 3, 4), ) Settings.register_profile('hi', Settings(fun_times=2)) assert x.fun_times == 3 assert Settings.get_profile('hi').fun_times == 2
def test_load_non_existent_profile(): with pytest.raises(hypothesis.errors.InvalidArgument): Settings.get_profile('nonsense')
import os import pytest import hypothesis from hypothesis.errors import InvalidArgument from hypothesis.database import ExampleDatabase from hypothesis.settings import Settings, Verbosity def test_has_docstrings(): assert Settings.verbosity.__doc__ original_default = Settings.get_profile('default').max_examples def setup_function(fn): Settings.load_profile('default') Settings.register_profile('test_settings', Settings()) Settings.load_profile('test_settings') def test_cannot_set_non_settings(): s = Settings() with pytest.raises(AttributeError): s.databas_file = u'some_file' def test_settings_uses_defaults():