# Path: stackimpact/runtime.py
# def min_version(major, minor=0):
#     return (sys.version_info.major == major and sys.version_info.minor >= minor)
# 
# class runtime_info(object):
#     OS_LINUX = (sys.platform.startswith('linux'))
#     OS_DARWIN = (sys.platform == 'darwin')
#     OS_WIN = (sys.platform == 'win32')
#     PYTHON_2 = (sys.version_info.major == 2)
#     PYTHON_3 = (sys.version_info.major == 3)
#     GEVENT = False


import time
import unittest
import random
import threading
import stackimpact
from stackimpact.runtime import min_version, runtime_info




class AllocationProfilerTestCase(unittest.TestCase):

    def test_record_allocation_profile(self):
        if runtime_info.OS_WIN or not min_version(3, 4):
            return

        stackimpact._agent = None
        agent = stackimpact.start(
            dashboard_address = 'http://localhost:5001',
            agent_key = 'key1',
            app_name = 'TestPythonApp',
            auto_profiling = False,
            debug = True
        )

        agent.allocation_reporter.profiler.reset()

        mem1 = []
        def mem_leak(n = 100000):
            mem2 = []
            for i in range(0, n):
                mem1.append(random.randint(0, 1000))
                mem2.append(random.randint(0, 1000))

        def mem_leak2():

# Path: stackimpact/runtime.py
# def min_version(major, minor=0):
#     return (sys.version_info.major == major and sys.version_info.minor >= minor)
# 
# class runtime_info(object):
#     OS_LINUX = (sys.platform.startswith('linux'))
#     OS_DARWIN = (sys.platform == 'darwin')
#     OS_WIN = (sys.platform == 'win32')
#     PYTHON_2 = (sys.version_info.major == 2)
#     PYTHON_3 = (sys.version_info.major == 3)
#     GEVENT = False


# Path: tests/profilers/allocation_profiler_test.py
import time
import unittest
import random
import threading
import stackimpact
from stackimpact.runtime import min_version, runtime_info





class AllocationProfilerTestCase(unittest.TestCase):

    def test_record_allocation_profile(self):
        if runtime_info.OS_WIN or not min_version(3, 4):
            return

        stackimpact._agent = None
        agent = stackimpact.start(
            dashboard_address = 'http://localhost:5001',
            agent_key = 'key1',
            app_name = 'TestPythonApp',
            auto_profiling = False,
            debug = True
        )

        agent.allocation_reporter.profiler.reset()

        mem1 = []
        def mem_leak(n = 100000):
            mem2 = []
            for i in range(0, n):
                mem1.append(random.randint(0, 1000))
                mem2.append(random.randint(0, 1000))

        def mem_leak2():

            mem_leak()