# Path: django_performance_testing/serializer.py
# DEFAULT_DJPT_DATAFILE_PATH = 'djpt.results_collected'
# def get_datafile_path():
#     def __init__(self, fpath):
#     def read_all(self):
#     def __init__(self, fpath):
#     def start(self):
#     def end(self):
#     def handle_results_collected(self, sender, results, context, **kwargs):
#     def handle_result(self, sender, results, context):
# class Reader:
# class Writer:
# 
# Path: django_performance_testing/signals.py



import pytest
from django_performance_testing import serializer
from django_performance_testing.signals import results_collected, results_read
from testapp.test_helpers import FakeSender, WithId
        for collector_cls in plugin_cls_fixture.params:
            for i, sample in enumerate(collector_cls.get_sample_results()):
                sample_results.append((collector_cls, sample))
                ids.append('-sample{}-'.format(i))
        metafunc.parametrize(
            argnames='collector_cls_with_sample_result',
            argvalues=sample_results,
            ids=ids
        )


@pytest.fixture
def sample_result(collector_cls, collector_cls_with_sample_result):
    if collector_cls != collector_cls_with_sample_result[0]:
        pytest.skip('this sample result is not for this plugin')
    result = collector_cls_with_sample_result[-1]
    return result


def test_datafile_path_depends_on_setting(settings):
    assert not hasattr(settings, 'DJPT_DATAFILE_PATH'), 'test assumption'
    assert serializer.get_datafile_path() == 'djpt.results_collected'
    settings.DJPT_DATAFILE_PATH = 'foo.log'
    assert serializer.get_datafile_path() == 'foo.log'
    settings.DJPT_DATAFILE_PATH = 'bar'
    assert serializer.get_datafile_path() == 'bar'


def test_writer_writes_collected_results_fired_between_statt_stop(tmpfilepath):
    writer = serializer.Writer(tmpfilepath)

# Path: django_performance_testing/serializer.py
# DEFAULT_DJPT_DATAFILE_PATH = 'djpt.results_collected'
# def get_datafile_path():
#     def __init__(self, fpath):
#     def read_all(self):
#     def __init__(self, fpath):
#     def start(self):
#     def end(self):
#     def handle_results_collected(self, sender, results, context, **kwargs):
#     def handle_result(self, sender, results, context):
# class Reader:
# class Writer:
# 
# Path: django_performance_testing/signals.py



# Path: tests/testapp/tests/test_serialization.py
import pytest
from django_performance_testing import serializer
from django_performance_testing.signals import results_collected, results_read
from testapp.test_helpers import FakeSender, WithId

        for collector_cls in plugin_cls_fixture.params:
            for i, sample in enumerate(collector_cls.get_sample_results()):
                sample_results.append((collector_cls, sample))
                ids.append('-sample{}-'.format(i))
        metafunc.parametrize(
            argnames='collector_cls_with_sample_result',
            argvalues=sample_results,
            ids=ids
        )


@pytest.fixture
def sample_result(collector_cls, collector_cls_with_sample_result):
    if collector_cls != collector_cls_with_sample_result[0]:
        pytest.skip('this sample result is not for this plugin')
    result = collector_cls_with_sample_result[-1]
    return result


def test_datafile_path_depends_on_setting(settings):
    assert not hasattr(settings, 'DJPT_DATAFILE_PATH'), 'test assumption'
    assert serializer.get_datafile_path() == 'djpt.results_collected'
    settings.DJPT_DATAFILE_PATH = 'foo.log'
    assert serializer.get_datafile_path() == 'foo.log'
    settings.DJPT_DATAFILE_PATH = 'bar'
    assert serializer.get_datafile_path() == 'bar'


def test_writer_writes_collected_results_fired_between_statt_stop(tmpfilepath):
    writer = serializer.Writer(tmpfilepath)

    results_collected.send(