def sandbox(tempdir_factory): ret = Sandbox(tempdir_factory.get()) with ret.db() as db: create_schema(db) populate_metric_ids(db, tuple(), False) yield ret
def sandbox(tmpdir_factory): ret = Sandbox(tmpdir_factory.get()) with ret.db() as db: create_schema(db) populate_metric_ids(db, tuple(), False) yield ret
def sandbox(tmpdir): ret = Sandbox(tmpdir.strpath) with ret.db() as db: create_schema(db) populate_metric_ids(db, tuple(), False) return ret
def test_populate_metric_ids(tmpdir): db_path = os.path.join(tmpdir.strpath, 'db.db') with sqlite3.connect(db_path) as db: create_schema(db) populate_metric_ids(db, tuple(), False) results = db.execute('SELECT * FROM metric_names').fetchall() # Smoke test assertion assert (len(results) == len( get_metric_ids(get_metric_parsers_from_args(tuple(), False))))
def test_create_schema(tmpdir): db_path = os.path.join(tmpdir.strpath, 'db.db') with sqlite3.connect(db_path) as db: create_schema(db) results = db.execute( "SELECT name FROM sqlite_master WHERE type = 'table'").fetchall() table_names = [table_name for table_name, in results] assert 'metric_names' in table_names assert 'metric_data' in table_names
def test_populate_metric_ids(tmpdir): db_path = os.path.join(tmpdir.strpath, 'db.db') with sqlite3.connect(db_path) as db: create_schema(db) populate_metric_ids(db, tuple(), False) results = db.execute('SELECT * FROM metric_names').fetchall() # Smoke test assertion assert ( len(results) == len(get_metric_ids(get_metric_parsers_from_args(tuple(), False))) )
def test_create_schema(tmpdir): db_path = os.path.join(tmpdir.strpath, 'db.db') with sqlite3.connect(db_path) as db: create_schema(db) results = db.execute( "SELECT name FROM sqlite_master WHERE type = 'table'" ).fetchall() table_names = [table_name for table_name, in results] assert 'metric_names' in table_names assert 'metric_data' in table_names