# Path: webpack/compiler.py
# def webpack(config_file, context=None, settings=None, manifest=manifest_reader, compiler=build_server):
#     use_manifest = conf.settings.USE_MANIFEST
# 
#     # Allow the USE_MANIFEST setting to be overridden when populating the manifest
#     if settings:
#         use_manifest = settings.get('USE_MANIFEST', use_manifest)
# 
#     if use_manifest:
#         return manifest.read(config_file, context)
# 
#     return compiler.build(
#         config_file=config_file,
#         extra_context=context,
#         setting_overrides=settings,
#     )
# 
# Path: webpack/exceptions.py
# class ConfigFileNotFound(Exception):
#     pass
# 
# Path: tests/settings.py
# class ConfigFiles(object):
#     BASIC_CONFIG = os.path.join('basic', 'webpack.config.js')
#     LIBRARY_CONFIG = os.path.join('library', 'webpack.config.js')
#     MULTIPLE_BUNDLES_CONFIG = os.path.join('multiple_bundles', 'webpack.config.js')
#     MULTIPLE_ENTRY_CONFIG = os.path.join('multiple_entry', 'webpack.config.js')
#     CACHED_CONFIG = os.path.join('cached', 'webpack.config.js')
# 
# Path: tests/utils.py
# def clean_output_root():
#     # Clean out any files generated from previous test runs
#     if os.path.exists(settings.OUTPUT_ROOT):
#         shutil.rmtree(settings.OUTPUT_ROOT)


import unittest
from optional_django.env import DJANGO_CONFIGURED
from optional_django import staticfiles
from webpack.compiler import webpack
from webpack.exceptions import ConfigFileNotFound
from .settings import ConfigFiles
from .utils import clean_output_root
    from django.template import Template, Context


def render_template_tag(path):
    template = Template("""
        {% load webpack %}
        {% webpack path as bundle %}
        {{ bundle.render_js|safe }}
    """)
    return template.render(Context({
        'path': path,
    }))


class TestDjangoIntegration(unittest.TestCase):
    # Prevent nose from running these tests
    __test__ = DJANGO_CONFIGURED

    @classmethod
    def setUpClass(cls):
        clean_output_root()

    @classmethod
    def tearDownClass(cls):

# Path: webpack/compiler.py
# def webpack(config_file, context=None, settings=None, manifest=manifest_reader, compiler=build_server):
#     use_manifest = conf.settings.USE_MANIFEST
# 
#     # Allow the USE_MANIFEST setting to be overridden when populating the manifest
#     if settings:
#         use_manifest = settings.get('USE_MANIFEST', use_manifest)
# 
#     if use_manifest:
#         return manifest.read(config_file, context)
# 
#     return compiler.build(
#         config_file=config_file,
#         extra_context=context,
#         setting_overrides=settings,
#     )
# 
# Path: webpack/exceptions.py
# class ConfigFileNotFound(Exception):
#     pass
# 
# Path: tests/settings.py
# class ConfigFiles(object):
#     BASIC_CONFIG = os.path.join('basic', 'webpack.config.js')
#     LIBRARY_CONFIG = os.path.join('library', 'webpack.config.js')
#     MULTIPLE_BUNDLES_CONFIG = os.path.join('multiple_bundles', 'webpack.config.js')
#     MULTIPLE_ENTRY_CONFIG = os.path.join('multiple_entry', 'webpack.config.js')
#     CACHED_CONFIG = os.path.join('cached', 'webpack.config.js')
# 
# Path: tests/utils.py
# def clean_output_root():
#     # Clean out any files generated from previous test runs
#     if os.path.exists(settings.OUTPUT_ROOT):
#         shutil.rmtree(settings.OUTPUT_ROOT)


# Path: tests/test_django_integration.py
import unittest
from optional_django.env import DJANGO_CONFIGURED
from optional_django import staticfiles
from webpack.compiler import webpack
from webpack.exceptions import ConfigFileNotFound
from .settings import ConfigFiles
from .utils import clean_output_root
    from django.template import Template, Context



def render_template_tag(path):
    template = Template("""
        {% load webpack %}
        {% webpack path as bundle %}
        {{ bundle.render_js|safe }}
    """)
    return template.render(Context({
        'path': path,
    }))


class TestDjangoIntegration(unittest.TestCase):
    # Prevent nose from running these tests
    __test__ = DJANGO_CONFIGURED

    @classmethod
    def setUpClass(cls):
        clean_output_root()

    @classmethod
    def tearDownClass(cls):

        clean_output_root()