Python nose.with_setup() Examples

The following are 1 code examples of nose.with_setup(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module nose , or try the search function .
Example #1
Source File: test_tabletasks.py    From bigmetadata with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def test_csv_2_temp_table_task():
    '''
    CSV to temp table task should run and generate no entry in OBSTable, but
    a physical table in the right schema.
    '''
    task = TestCSV2TempTableTask()
    before_table_count = current_session().execute(
        'SELECT COUNT(*) FROM observatory.obs_table').fetchone()[0]
    runtask(task)
    table = task.output()
    assert_equal(current_session().execute(
        'SELECT COUNT(*) FROM {}'.format(
            table.table)).fetchone()[0], 10)
    after_table_count = current_session().execute(
        'SELECT COUNT(*) FROM observatory.obs_table').fetchone()[0]
    assert_equal(before_table_count, after_table_count)


# This test is disabled because RepoFileUnzipTask extends RepoFileUncompressTask,
# which uses `yield` inside `run` for a dynamic dependency. Dynamic
# dependencies are not supported by our task runner.
# @with_setup(setup, teardown)
# def test_download_unzip_task():
#     '''
#     Download unzip task should download remote assets and unzip them locally.
#     '''
#     task = TestRepoFileUnzipTask()
#     if task.output().exists():
#         shell('rm -r {}'.format(task.output().path))
#     assert_false(task.output().exists())
#     runtask(task)
#     assert_true(task.output().exists())