# Path: django_performance_testing/test_runner.py
# class DjptDjangoTestRunnerMixin(object):
# class DjptTestRunnerMixin(object):
#     class DjptTestRunner(DjptTestRunnerMixin, test_runner_cls.test_runner):
#     class DjptDjangoTestRunner(DjptDjangoTestRunnerMixin, test_runner_cls):
#     def run(self, *a, **kw):
# def wrap_cls_method(cls, method_name, collector_id, ctx_key, is_cls_method):
# def get_runner_with_djpt_mixin(*a, **kw):
#     def addTest(suite_self, test):
#     def fn_to_id(fn):
# def integrate_into_django_test_runner():
# 
# Path: django_performance_testing/serializer.py
# class Reader:
#     def __init__(self, fpath):
#         self.fpath = fpath
# 
#     def read_all(self):
#         with open(self.fpath, 'rb') as f:
#             data = f.read()
#         if not data:
#             return []
#         deserialized = pickle.loads(data)
#         for (sender, results, context) in deserialized:
#             results_read.send(sender=sender, results=results, context=context)
#         return deserialized


from datetime import timedelta
from django.contrib.auth.models import Group
from django.test.utils import get_runner
from django.utils import six
from django_performance_testing import test_runner as djpt_test_runner_module
from django_performance_testing.serializer import Reader
from freezegun import freeze_time
from testapp.test_helpers import (override_current_context,
                                  run_testcases_with_django_runner)
import pytest
import unittest
import re
        mixin_base_name='DjptTestRunner')
    assert django_runner_cls.test_suite == test_suite_cls


def test_runner_sets_executing_test_method_as_context():

    class SomeTestCase(unittest.TestCase):
        def test_foo(self):
            assert 'test name' in ctx.data, ctx.data.keys()
            tests = ctx.data['test name']
            assert len(tests) == 1
            assert [str(self)] == tests

    with override_current_context() as ctx:
        run_testcases_with_django_runner(SomeTestCase, nr_of_tests=1)


def test_collected_results_serialized_to_settings_based_filename(
        settings, tmpfilepath):

    class SomeTestCase(unittest.TestCase):
        def test_foo(self):
            assert 'test name' in ctx.data, ctx.data.keys()
            tests = ctx.data['test name']
            assert len(tests) == 1
            assert [str(self)] == tests

    settings.DJPT_DATAFILE_PATH = tmpfilepath
    with override_current_context() as ctx:
        run_testcases_with_django_runner(SomeTestCase, nr_of_tests=1)

# Path: django_performance_testing/test_runner.py
# class DjptDjangoTestRunnerMixin(object):
# class DjptTestRunnerMixin(object):
#     class DjptTestRunner(DjptTestRunnerMixin, test_runner_cls.test_runner):
#     class DjptDjangoTestRunner(DjptDjangoTestRunnerMixin, test_runner_cls):
#     def run(self, *a, **kw):
# def wrap_cls_method(cls, method_name, collector_id, ctx_key, is_cls_method):
# def get_runner_with_djpt_mixin(*a, **kw):
#     def addTest(suite_self, test):
#     def fn_to_id(fn):
# def integrate_into_django_test_runner():
# 
# Path: django_performance_testing/serializer.py
# class Reader:
#     def __init__(self, fpath):
#         self.fpath = fpath
# 
#     def read_all(self):
#         with open(self.fpath, 'rb') as f:
#             data = f.read()
#         if not data:
#             return []
#         deserialized = pickle.loads(data)
#         for (sender, results, context) in deserialized:
#             results_read.send(sender=sender, results=results, context=context)
#         return deserialized


# Path: tests/testapp/tests/test_integrates_with_django_testrunner.py
from datetime import timedelta
from django.contrib.auth.models import Group
from django.test.utils import get_runner
from django.utils import six
from django_performance_testing import test_runner as djpt_test_runner_module
from django_performance_testing.serializer import Reader
from freezegun import freeze_time
from testapp.test_helpers import (override_current_context,
                                  run_testcases_with_django_runner)
import pytest
import unittest
import re

        mixin_base_name='DjptTestRunner')
    assert django_runner_cls.test_suite == test_suite_cls


def test_runner_sets_executing_test_method_as_context():

    class SomeTestCase(unittest.TestCase):
        def test_foo(self):
            assert 'test name' in ctx.data, ctx.data.keys()
            tests = ctx.data['test name']
            assert len(tests) == 1
            assert [str(self)] == tests

    with override_current_context() as ctx:
        run_testcases_with_django_runner(SomeTestCase, nr_of_tests=1)


def test_collected_results_serialized_to_settings_based_filename(
        settings, tmpfilepath):

    class SomeTestCase(unittest.TestCase):
        def test_foo(self):
            assert 'test name' in ctx.data, ctx.data.keys()
            tests = ctx.data['test name']
            assert len(tests) == 1
            assert [str(self)] == tests

    settings.DJPT_DATAFILE_PATH = tmpfilepath
    with override_current_context() as ctx:
        run_testcases_with_django_runner(SomeTestCase, nr_of_tests=1)

    reader = Reader(settings.DJPT_DATAFILE_PATH)