<s> from __future__ import absolute_import <EOL> from __future__ import unicode_literals <EOL> import os . path <EOL> import sqlite3 <EOL> from git_code_debt . create_tables import create_schema <EOL> from git_code_debt . create_tables import get_metric_ids <EOL> from git_code_debt . create_tables import main <EOL> from git_code_debt . create_tables import populate_metric_ids <EOL> from git_code_debt . discovery import get_metric_parsers_from_args <EOL> def test_create_schema ( tmpdir ) : <EOL> db_path = os . path . join ( tmpdir . strpath , '<STR_LIT>' ) <EOL> with sqlite3 . connect ( db_path ) as db : <EOL> create_schema ( db ) <EOL> results = db . execute ( <EOL> "<STR_LIT>" <EOL> ) . fetchall ( ) <EOL> table_names = [ table_name for table_name , in results ] <EOL> assert '<STR_LIT>' in table_names <EOL> assert '<STR_LIT>' in table_names <EOL> def test_populate_metric_ids ( tmpdir ) : <EOL> db_path = os . path . join ( tmpdir . strpath , '<STR_LIT>' ) <EOL> with sqlite3 . connect ( db_path ) as db : <EOL> create_schema ( db ) <EOL> populate_metric_ids ( db , tuple ( ) , False ) <EOL> results = db . execute ( '<STR_LIT>' ) . fetchall ( ) <EOL> assert ( <EOL> len ( results ) == <EOL> len ( get_metric_ids ( get_metric_parsers_from_args ( tuple ( ) , False ) ) ) <EOL> ) <EOL> def test_create_tables_smoke ( tmpdir ) : <EOL> db_path = os . path . join ( tmpdir . strpath , '<STR_LIT>' ) <EOL> main ( [ db_path ] ) </s>
