Exemplo n.º 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
Exemplo n.º 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
Exemplo n.º 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)
Exemplo n.º 4
0
def teardown_function(fn):
    Settings.load_profile('default')
Exemplo n.º 5
0
def setup_function(fn):
    Settings.load_profile('nonstrict')
Exemplo n.º 6
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()
Exemplo n.º 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' % (
Exemplo n.º 8
0
def teardown_function(fn):
    Settings.load_profile('default')
    warnings.simplefilter('once', HypothesisDeprecationWarning)
Exemplo n.º 9
0
def setup_function(fn):
    Settings.load_profile('nonstrict')
    warnings.simplefilter('always', HypothesisDeprecationWarning)
Exemplo n.º 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()
Exemplo n.º 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'))
Exemplo n.º 12
0
def teardown_function(fn):
    Settings.load_profile('default')
Exemplo n.º 13
0
def setup_function(fn):
    Settings.load_profile('nonstrict')