예제 #1
0
파일: test_one.py 프로젝트: myunpe/pyapp
def initialized_tasks_db(tmpdir: str):
    """テスト前にDB接続"""
    tasks.start_tasks_db(str(tmpdir), 'tiny')

    yield

    tasks.stop_tasks_db()
def initialized_tasks_db(tmpdir):
    """Connect to db before testing, disconnect after."""
    tasks.start_tasks_db(str(tmpdir), 'tiny')
    yield
    # return -> sends specified value when called
    # whereas yield -> produce sequence of values
    tasks.stop_tasks_db()
예제 #3
0
def initialized_tasks_db(tmpdir):
    '''Connect to db before testing, disconnect after.'''
    # Setup: start db
    tasks.start_tasks_db(str(tmpdir), 'tiny')
    yield  # testing happens here
    # Teardown: stop db
    tasks.stop_tasks_db()
예제 #4
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()
예제 #5
0
def test_db_has_no_signs_by_default():
    """Check, that after initialization db has 0 signes"""
    tasks.start_tasks_db(str("."), 'tiny')
    tasks.delete_all()
    cur_count = tasks.count()
    assert cur_count == 0
    tasks.stop_tasks_db()
예제 #6
0
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()
예제 #7
0
def initialized_tasks_db(tmpdir):
    """Connect to the db before testing, disconnect after."""
    tasks.start_tasks_db(str(tmpdir), 'tiny')

    yield  # This is where the testing happens

    tasks.stop_tasks_db()
예제 #8
0
def tasks_db_session(tmpdir_factory):
    """Connect to db before tests, disconncet after."""

    temp_dir = tmpdir_factory.mktemp('temp')
    tasks.start_tasks_db(str(temp_dir), 'tiny')
    yield
    tasks.stop_tasks_db()
예제 #9
0
def tasks_db_session(tmpdir_factory):
    temp_dir = tmpdir_factory.mktemp('temp')
    tasks.start_tasks_db(str(temp_dir), 'tiny')
    
    yield 
    
    tasks.stop_tasks_db()
예제 #10
0
def task_db_session(tmpdir_factory):
    # フィクスチャのセッションスコープで
    # 一時ディレクトリとデータベース接続設定を実行
    temp_dir = tmpdir_factory.mktemp('temp')
    tasks.start_tasks_db(str(temp_dir), 'tiny')
    yield
    tasks.stop_tasks_db()
예제 #11
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()
예제 #12
0
def tasks_db(tmpdir):
    """Connect to db before tests, disconnect after."""
    tasks.start_tasks_db(str(tmpdir), 'tiny')

    yield  # this is where the testing happens

    # Teardown : stop db
    tasks.stop_tasks_db()
예제 #13
0
def test_after_deletion_db_count_changes():
    """ Check, that after deletion count changes """
    tasks.start_tasks_db(str("."), 'tiny')
    before_deletion_count = tasks.count()
    tasks.delete(pytest.task_id)
    after_deletion_count = tasks.count()
    assert before_deletion_count - 1 == after_deletion_count
    tasks.stop_tasks_db()
예제 #14
0
def test_after_update_db_count_not_change():
    """ Check, that after update count doesn't change """
    tasks.start_tasks_db(str("."), 'tiny')
    before_update_count = tasks.count()
    tasks.update(pytest.task_id, Task(done=True))
    after_update_count = tasks.count()
    assert before_update_count == after_update_count
    tasks.stop_tasks_db()
예제 #15
0
def tasks_db(tmpdir):
    """Connect to db before tests, disconnect after."""

    tasks.start_tasks_db(str(tmpdir), 'tiny')

    yield

    tasks.stop_tasks_db()
def tasks_db_session(tmpdir_factory, request):
    """Connect to db before testing, disconnect after."""
    # Setup: start db
    temp_dir = tmpdir_factory.mktemp('temp')
    tasks.start_tasks_db(str(temp_dir), request.param)
    yield  # this is where testing happens
    # Teardown: stop db
    tasks.stop_tasks_db()
def initialized_tasks_db(tmpdir):
    tasks.start_tasks_db(str(tmpdir), 'tiny')
    yield
    tasks.stop_tasks_db()

    
    
    
예제 #18
0
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()
예제 #19
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()
예제 #20
0
def tasks_db(tmpdir):
    """ connect db before tests, disconnect after"""
    tasks.start_tasks_db(str(tmpdir), "tiny")

    # テストの実行
    yield

    # DB接続の終了
    tasks.stop_tasks_db()
예제 #21
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()
예제 #22
0
파일: conftest.py 프로젝트: njsdias/Pytest
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()
예제 #23
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()
예제 #24
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()
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()
예제 #26
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_task_db(tmpdir):
    # Task DBを初期化
    tasks.start_tasks_db(str(tmpdir), 'tiny')

    # ここでテストを実行
    yield

    # DB接続終了
    tasks.stop_tasks_db()
예제 #28
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()
예제 #29
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()
예제 #30
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()