def test_with_dataset_repeat(synthetic_dataset, reader_factory):
    """``tf.data.Dataset``'s ``repeat`` is not recommended to used on ``make_petastorm_dataset`` due to high costs of
    ``Reader initialization``. A user should use ``Reader`` built-in epochs support, or use
    ``tf.data.Dataset``'s ``cache``. Check that we trigger a warning to alert of misuse."""
    with reader_factory(synthetic_dataset.url) as reader:
        dataset = make_petastorm_dataset(reader)

        dataset = dataset.repeat(2)

        iterator = dataset.make_one_shot_iterator()

        # Read a bunch of entries from the dataset and compare the data to reference
        with tf.Session() as sess:
            iterator = iterator.get_next()

            for _, _ in enumerate(synthetic_dataset.data):
                sess.run(iterator)

            match_str = 'Running multiple iterations over make_petastorm_dataset is not recommend for performance issue'
            with pytest.warns(UserWarning, match=match_str):
                sess.run(iterator)
``tf.data.Dataset``'s ``repeat`` is not recommended to used on ``make_petastorm_dataset`` due to high costs of
    ``Reader initialization``. A user should use ``Reader`` built-in epochs support, or use
    ``tf.data.Dataset``'s ``cache``. Check that we trigger a warning to alert of misuse.
petastorm/tests/test_tf_dataset.py