コード例 #1
0
def test_picks_up_changes_to_defaults_when_switching_profiles():
    original_default = Settings.default.max_examples
    Settings.load_profile('nonstrict')
    Settings.register_profile('test_settings', Settings())
    Settings.load_profile('test_settings')

    Settings.register_profile('other_test_settings', Settings())
    Settings.default.max_examples = 18
    assert Settings.default.max_examples == 18
    Settings.load_profile('other_test_settings')
    assert Settings.default.max_examples == original_default
    Settings.load_profile('test_settings')
    assert Settings.default.max_examples == 18
コード例 #2
0
def test_picks_up_changes_to_defaults_when_switching_profiles():
    original_default = Settings.default.max_examples
    Settings.load_profile('nonstrict')
    Settings.register_profile('test_settings', Settings())
    Settings.load_profile('test_settings')

    Settings.register_profile('other_test_settings', Settings())
    Settings.default.max_examples = 18
    assert Settings.default.max_examples == 18
    Settings.load_profile('other_test_settings')
    assert Settings.default.max_examples == original_default
    Settings.load_profile('test_settings')
    assert Settings.default.max_examples == 18
コード例 #3
0
class IgnoreImplicitWait:
    def __init__(self, driver, default_wait):
        self._driver = driver
        self._default_wait = default_wait

        self._driver.implicitly_wait(0)

    def __enter__(self):
        return self

    def __exit__(self, exc_type, exc_val, exc_tb):
        self._driver.implicitly_wait(self._default_wait)


Settings.register_profile('selenium', Settings(max_examples=1, timeout=0))
Settings.load_profile('selenium')


class SeleniumTestCase(StaticLiveServerTestCase):
    selenium_implicit_wait = 30
    _driver = None

    def __init__(self, *args, **kwargs):
        self.browser_tag = _browser_tag
        super().__init__(*args, **kwargs)

    @property
    def driver(self):
        if not SeleniumTestCase._driver:
            if _use_remote_driver:
                sauce_url = 'http://%s:%[email protected]:80/wd/hub' % (_sauce_username, _sauce_access_key)
コード例 #4
0
def teardown_function(fn):
    Settings.load_profile('default')
コード例 #5
0
def setup_function(fn):
    Settings.load_profile('nonstrict')
コード例 #6
0
ファイル: conftest.py プロジェクト: jwg4/hypothesis
from __future__ import division, print_function, absolute_import

import gc
import os
import warnings
from tempfile import mkdtemp

import pytest

from hypothesis import Settings
from hypothesis.settings import set_hypothesis_home_dir

warnings.filterwarnings(u'error', category=UnicodeWarning)

set_hypothesis_home_dir(mkdtemp())

Settings.default.timeout = -1
Settings.default.strict = True

Settings.register_profile(
    'speedy', Settings(
        timeout=1, max_examples=5,
    ))
Settings.load_profile(os.getenv('HYPOTHESIS_PROFILE', 'default'))


@pytest.fixture(scope=u'function', autouse=True)
def some_fixture():
    gc.collect()
コード例 #7
0
class IgnoreImplicitWait:
    def __init__(self, driver, default_wait):
        self._driver = driver
        self._default_wait = default_wait

        self._driver.implicitly_wait(0)

    def __enter__(self):
        return self

    def __exit__(self, exc_type, exc_val, exc_tb):
        self._driver.implicitly_wait(self._default_wait)


Settings.register_profile('selenium', Settings(max_examples=1, timeout=0))
Settings.load_profile('selenium')


class SeleniumTestCase(StaticLiveServerTestCase):
    selenium_implicit_wait = 30
    _driver = None

    def __init__(self, *args, **kwargs):
        self.browser_tag = _browser_tag
        super().__init__(*args, **kwargs)

    @property
    def driver(self):
        if not SeleniumTestCase._driver:
            if _use_remote_driver:
                sauce_url = 'http://%s:%[email protected]:80/wd/hub' % (
コード例 #8
0
ファイル: test_bad_repr.py プロジェクト: tokenrove/hypothesis
def teardown_function(fn):
    Settings.load_profile('default')
    warnings.simplefilter('once', HypothesisDeprecationWarning)
コード例 #9
0
ファイル: test_bad_repr.py プロジェクト: tokenrove/hypothesis
def setup_function(fn):
    Settings.load_profile('nonstrict')
    warnings.simplefilter('always', HypothesisDeprecationWarning)
コード例 #10
0
from __future__ import division, print_function, absolute_import

import gc
import os
import warnings
from tempfile import mkdtemp

import pytest

from hypothesis import Settings
from hypothesis.settings import set_hypothesis_home_dir

warnings.filterwarnings(u'error', category=UnicodeWarning)

set_hypothesis_home_dir(mkdtemp())

Settings.default.timeout = -1
Settings.default.strict = True

Settings.register_profile('speedy', Settings(
    timeout=1,
    max_examples=5,
))
Settings.load_profile(os.getenv('HYPOTHESIS_PROFILE', 'default'))


@pytest.fixture(scope=u'function', autouse=True)
def some_fixture():
    gc.collect()
コード例 #11
0
import os

from hypothesis import Settings, Verbosity


Settings.register_profile("dev", Settings(max_examples=10))
Settings.register_profile(
    "debug",
    Settings(max_examples=10, verbosity=Verbosity.verbose),
)
Settings.load_profile(os.getenv(u'HYPOTHESIS_PROFILE', 'dev'))
コード例 #12
0
def teardown_function(fn):
    Settings.load_profile('default')
コード例 #13
0
def setup_function(fn):
    Settings.load_profile('nonstrict')