# Path: loom/test/util.py
# def assert_found(*filenames):
#     for name in filenames:
#         assert_true(os.path.exists(name), 'missing file: {}'.format(name))
# 
# Path: loom/test/util.py
# CLEANUP_ON_ERROR = int(os.environ.get('CLEANUP_ON_ERROR', 1))
# 
# Path: loom/test/util.py
# def for_each_dataset(fun):
#     @functools.wraps(fun)
#     def test_one(dataset):
#         paths = loom.store.get_paths(dataset, sample_count=2)
#         for key, path in loom.store.iter_paths(dataset, paths):
#             if not os.path.exists(path):
#                 raise ValueError(
#                     'missing {} at {},\n  first `python -m loom.datasets test`'
#                     .format(key, path))
#         kwargs = {'name': dataset}
#         kwargs.update(paths['query'])
#         kwargs.update(paths['consensus'])
#         kwargs.update(paths['samples'][0])
#         kwargs.update(paths['ingest'])
#         kwargs.update(paths)
#         fun(**kwargs)
# 
#     @functools.wraps(fun)
#     def test_all():
#         for dataset in loom.datasets.TEST_CONFIGS:
#             yield test_one, dataset
# 
#     return test_all


import os
import loom.config
import loom.runner
from nose.tools import assert_equal
from nose.tools import assert_true
from loom.test.util import assert_found
from loom.test.util import CLEANUP_ON_ERROR
from loom.test.util import for_each_dataset
from distributions.fileutil import tempdir
from distributions.io.stream import open_compressed
from distributions.io.stream import protobuf_stream_load
from loom.schema_pb2 import CrossCat
from loom.schema_pb2 import ProductModel
                'empty_group_count': 1,
                'row_queue_capacity': 0,
            },
            'kind': {
                'iterations': 1,
                'empty_kind_count': 1,
                'row_queue_capacity': 8,
                'score_parallel': True,
            },
        },
    },
]


def get_group_counts(groups_out):
    group_counts = []
    for f in os.listdir(groups_out):
        group_count = 0
        groups = os.path.join(groups_out, f)
        for string in protobuf_stream_load(groups):
            group = ProductModel.Group()
            group.ParseFromString(string)
            group_count += 1
        group_counts.append(group_count)
    assert group_counts, 'no groups found'
    return group_counts


@for_each_dataset
def test_tare(rows, schema_row, **unused):

# Path: loom/test/util.py
# def assert_found(*filenames):
#     for name in filenames:
#         assert_true(os.path.exists(name), 'missing file: {}'.format(name))
# 
# Path: loom/test/util.py
# CLEANUP_ON_ERROR = int(os.environ.get('CLEANUP_ON_ERROR', 1))
# 
# Path: loom/test/util.py
# def for_each_dataset(fun):
#     @functools.wraps(fun)
#     def test_one(dataset):
#         paths = loom.store.get_paths(dataset, sample_count=2)
#         for key, path in loom.store.iter_paths(dataset, paths):
#             if not os.path.exists(path):
#                 raise ValueError(
#                     'missing {} at {},\n  first `python -m loom.datasets test`'
#                     .format(key, path))
#         kwargs = {'name': dataset}
#         kwargs.update(paths['query'])
#         kwargs.update(paths['consensus'])
#         kwargs.update(paths['samples'][0])
#         kwargs.update(paths['ingest'])
#         kwargs.update(paths)
#         fun(**kwargs)
# 
#     @functools.wraps(fun)
#     def test_all():
#         for dataset in loom.datasets.TEST_CONFIGS:
#             yield test_one, dataset
# 
#     return test_all


# Path: loom/test/test_runner.py
import os
import loom.config
import loom.runner
from nose.tools import assert_equal
from nose.tools import assert_true
from loom.test.util import assert_found
from loom.test.util import CLEANUP_ON_ERROR
from loom.test.util import for_each_dataset
from distributions.fileutil import tempdir
from distributions.io.stream import open_compressed
from distributions.io.stream import protobuf_stream_load
from loom.schema_pb2 import CrossCat
from loom.schema_pb2 import ProductModel

                'empty_group_count': 1,
                'row_queue_capacity': 0,
            },
            'kind': {
                'iterations': 1,
                'empty_kind_count': 1,
                'row_queue_capacity': 8,
                'score_parallel': True,
            },
        },
    },
]


def get_group_counts(groups_out):
    group_counts = []
    for f in os.listdir(groups_out):
        group_count = 0
        groups = os.path.join(groups_out, f)
        for string in protobuf_stream_load(groups):
            group = ProductModel.Group()
            group.ParseFromString(string)
            group_count += 1
        group_counts.append(group_count)
    assert group_counts, 'no groups found'
    return group_counts


@for_each_dataset
def test_tare(rows, schema_row, **unused):

    with tempdir(cleanup_on_error=CLEANUP_ON_ERROR):