示例#1
0
def tasks_db_session(tmpdir_factory, request):
    """Connect to db before tests, disconnect after."""

    temp_dir = tmpdir_factory.mktemp('temp')
    tasks.start_tasks_db(str(temp_dir), request.param)

    yield

    tasks.stop_tasks_db()
示例#2
0
def initialized_tasks_db(tmpdir):
    """Connect to db before testing, disconnect after"""
    # SETUP: start db
    tasks.start_tasks_db(str(tmpdir), 'tiny')

    yield # Where the test occurs

    # Teardown: stop db
    tasks.stop_tasks_db()
示例#3
0
def test_after_task_creation_db_count_changes():
    """ Check, that after task creation count chages """
    tasks.start_tasks_db(str("."), 'tiny')
    before_creation_count = tasks.count()
    task = Task('breathe', 'Brian', True)
    pytest.task_id = tasks.add(task)
    actual_count = tasks.count()
    assert before_creation_count + 1 == actual_count
    tasks.stop_tasks_db()
def initialized_tasks_db(tmpdir):
    """Connect to db before testing, disconnect after."""
    # Setup : start db
    tasks.start_tasks_db(str(tmpdir), 'tiny')

    yield  # здесь происходит тестирование

    # Teardown : stop db
    tasks.stop_tasks_db()
示例#5
0
def tasks_db(tmpdir):
    """Connect to db before tests, disconnect after."""
    # Setup: start db.
    tasks.start_tasks_db(str(tmpdir), 'tiny')

    yield  # This is where the testing happens.

    #Teardown: stop db.
    tasks.stop_tasks_db()
示例#6
0
def tasks_db(tmpdir):
    """Connect to db before tests, disconnect after."""

    # Setup: start db
    tasks.start_tasks_db(str(tmpdir), 'tiny')
    yield

    # Teardown: stop db
    tasks.stop_tasks_db()
示例#7
0
def tasks_db(tmpdir):       # tmpdir is a function scope: go to pag 59 to understand the scope meaning
    """Connect to db before tests, disconnect after."""
    # Setup : start db
    tasks.start_tasks_db(str(tmpdir), 'tiny')

    yield  # this is where the testing happens

    # Teardown : stop db
    tasks.stop_tasks_db()
示例#8
0
def tasks_db(tmpdir):
    """ connect db before tests, disconnect after"""
    tasks.start_tasks_db(str(tmpdir), "tiny")

    # テストの実行
    yield

    # DB接続の終了
    tasks.stop_tasks_db()
示例#9
0
def test_start_tasks_db_raises():
    """Make sure unsupported db raises an exception.
    The variable name you put after as (excinfo in this case)
    is filled with information about the exception, and is of type ExceptionInfo."""

    with pytest.raises(ValueError) as excinfo:
        tasks.start_tasks_db('some/great/path', 'mysql')
        exception_msg = excinfo.value.args[0]
        assert exception_msg == "db_type must be a 'tiny' or 'mongo'"
def initialized_tasks_db(tmpdir):
    """Connect to db before testing, disconnect after."""
    # Setup
    tasks.start_tasks_db(str(tmpdir), 'tiny')

    yield  # Excetute tests.

    # TearDown
    tasks.stop_tasks_db()
def initialized_task_db(tmpdir):
    # Task DBを初期化
    tasks.start_tasks_db(str(tmpdir), 'tiny')

    # ここでテストを実行
    yield

    # DB接続終了
    tasks.stop_tasks_db()
示例#12
0
def tasks_db(tmpdir):
    """Connect to db bfore tests, disconnect after"""
   # setup : start db
    tasks.start_tasks_db(str(tmpdir), 'tiny')
    
    yield # this is where the testing haens
    
    # teardown
    tasks.stop_tasks_db()
示例#13
0
def initilized_tasks_db(tmpdir):
    """connnect to db befre testing, disonnect after"""
    # setup :start db
    tasks.start_tasks_db(str(tmpdir), 'tiny')

    yield  # this is where the teting happens

    # teardown : stop db
    tasks.stop_tasks_db()
def initialized_tasks_db(tmpdir):
    """Connect to db before testing, disconnect after."""
    # Setup : start db
    tasks.start_tasks_db(str(tmpdir), 'tiny')

    yield  # this is where the testing happens

    # Teardown : stop db
    tasks.stop_tasks_db()
示例#15
0
def initialized_tasks_db(tmpdir):
    """Connect to db before testing, disconnect after."""
    # setup: start db connection
    tasks.start_tasks_db(str(tmpdir), 'tiny')

    yield  # execute test

    # teardown: terminate db connection
    tasks.stop_tasks_db()
示例#16
0
def tasks_db_session(tmpdir_factory, request):
    # Setup : start db
    tmp_dir = tmpdir_factory.mktemp('temp')

    tasks.start_tasks_db(str(tmp_dir), request.param)

    yield  # this is where the testing happens

    # Teardown : stop db
    tasks.stop_tasks_db()
示例#17
0
def initialized_tasks_db(tmpdir):
    """connect db"""
    # SETUP
    tasks.start_tasks_db(str(tmpdir), 'tiny')

    # this is where testing happen
    yield

    # TEARDOWN
    tasks.stop_tasks_db()
示例#18
0
def tasks_db_session(tmpdir_factory):
    """
    Connect to db before tests, disconnect after.
    """
    # セットアップ:DBへ接続
    temp_dir = tmpdir_factory.mktemp("temp")
    tasks.start_tasks_db(str(temp_dir), "tiny")

    # ここでテストを実行
    yield

    # ティアダウン:DBの接続を終了
    tasks.stop_tasks_db()
def initialized_tasks_db(tmpdir):
   
    tasks.start_tasks_db(str(tmpdir), 'tiny')

    yield
    tasks.stop_tasks_db()

    
    
    
    
    
    
示例#20
0
def tasks_db(tmpdir):
    '''prepare for the test. before the test, build the db envirment'''
    tasks.start_tasks_db(str(tmpdir),'tiny')
    yield
    tasks.stop_tasks_db()
示例#21
0
def tasks_db_session(tmpdir_factory, request):
    temp_dir = tmpdir_factory.mktemp('temp')
    tasks.start_tasks_db(str(temp_dir), request.param)
    yield
    tasks.stop_tasks_db()
示例#22
0
def test_start_tasks_db_raises():
    with pytest.raises(ValueError) as excinfo:
        tasks.start_tasks_db('some/great/path', 'mysql')
    exception_msg = excinfo.value.args[0]
    assert exception_msg == "db_type must be a 'tiny' or 'mongo'"
示例#23
0
def tasks_db(tmpdir):
    tasks.start_tasks_db(str(tmpdir), 'tiny')
    yield
    tasks.stop_tasks_db()
示例#24
0
def tasks_db_session(tmpdir_factory, request):
    """Connect to db before tests, disconnect after."""
    temp_dir = tmpdir_factory.mktemp('temp')
    tasks.start_tasks_db(str(temp_dir), 'tiny')
    yield  # this is where the testing happens
    tasks.stop_tasks_db()
def test_start_tasks_db_raises():
    """Make sure unsupported db raises an exception"""
    with pytest.raises(ValueError) as excinfo:
        tasks.start_tasks_db("some/great/path", "mysql")
        exception_msg = excinfo.value.args[0]
        assert exception_msg == "db_type must be 'tiny' or 'mongo'"
def setUpModule():
    """Make temp dir, initialize DB."""
    global temp_dir
    temp_dir = tempfile.mkdtemp()
    tasks.start_tasks_db(str(temp_dir), 'tiny')
示例#27
0
def initialized_tasks_db(tmpdir):
    """Connect to db before testing. Disconnect after"""
    tasks.start_tasks_db(str(tmpdir), 'tiny')
    yield
    tasks.stop_tasks_db()
示例#28
0
def test_start_tasks_db_raises():
    """Make sure nsupported DB raises exception"""
    with pytest.raises(ValueError) as excinfo:
        tasks.start_tasks_db('some/great/path', 'mysql')
    exception_msg = excinfo.value.args[0]
    assert exception_msg == "db type must be 'tiny' or 'mongo'"
def initialized_tasks_db(tmpdir):
    """Connect to db before testing, disconnect after."""
    tasks.start_tasks_db(str(tmpdir), "tiny")
    yield
    tasks.stop_tasks_db()
def test_start_tasks_db_raises():
    """Убедитесь, что неподдерживаемая БД вызывает исключение."""
    with pytest.raises(ValueError) as excinfo:
        tasks.start_tasks_db('some/great/path', 'mysql')
    exception_msg = excinfo.value.args[0]
    assert exception_msg == "db_type must be a 'tiny' or 'mongo'"