# Path: nosedjango/plugins/base_plugin.py
# class Plugin(NosePlugin):
#     django_plugin = True
#     _unique_token = None
# 
#     def get_unique_token(self):
#         """
#         Get a unique token for usage in differentiating test runs that need to
#         run in parallel.
#         """
#         if self._unique_token is None:
#             self._unique_token = self._random_token()
# 
#         return self._unique_token
# 
#     def _random_token(self, bits=128):
#         """
#         Generates a random token, using the url-safe base64 alphabet.
#         The "bits" argument specifies the bits of randomness to use.
#         """
#         alphabet = string.ascii_letters + string.digits + '-_'
#         # alphabet length is 64, so each letter provides lg(64) = 6 bits
#         num_letters = int(math.ceil(bits / 6.0))
#         return ''.join(random.choice(alphabet) for i in range(num_letters))


import os
import time
from django.core.handlers.wsgi import WSGIHandler
from nosedjango.plugins.base_plugin import Plugin
        from django.conf import settings
        from django.contrib.staticfiles.handlers import StaticFilesHandler
        from cherrypy.wsgiserver import CherryPyWSGIServer
        from threading import Thread


# Next 3 plugins taken from django-sane-testing:
# http://github.com/Almad/django-sane-testing
# By: Lukas "Almad" Linhart http://almad.net/
#####
# It was a nice try with Django server being threaded.
# It still sucks for some cases (did I mentioned urllib2?),
# so provide cherrypy as working alternative.
# Do imports in method to avoid CP as dependency
# Code originally written by Mikeal Rogers under Apache License.
#####

DEFAULT_LIVE_SERVER_ADDRESS = '0.0.0.0'
DEFAULT_LIVE_SERVER_PORT = '8000'


class CherryPyLiveServerPlugin(Plugin):
    name = 'cherrypyliveserver'
    activation_parameter = '--with-cherrypyliveserver'
    nosedjango = True

    def __init__(self):

# Path: nosedjango/plugins/base_plugin.py
# class Plugin(NosePlugin):
#     django_plugin = True
#     _unique_token = None
# 
#     def get_unique_token(self):
#         """
#         Get a unique token for usage in differentiating test runs that need to
#         run in parallel.
#         """
#         if self._unique_token is None:
#             self._unique_token = self._random_token()
# 
#         return self._unique_token
# 
#     def _random_token(self, bits=128):
#         """
#         Generates a random token, using the url-safe base64 alphabet.
#         The "bits" argument specifies the bits of randomness to use.
#         """
#         alphabet = string.ascii_letters + string.digits + '-_'
#         # alphabet length is 64, so each letter provides lg(64) = 6 bits
#         num_letters = int(math.ceil(bits / 6.0))
#         return ''.join(random.choice(alphabet) for i in range(num_letters))


# Path: nosedjango/plugins/cherrypy_plugin.py
import os
import time
from django.core.handlers.wsgi import WSGIHandler
from nosedjango.plugins.base_plugin import Plugin
        from django.conf import settings
        from django.contrib.staticfiles.handlers import StaticFilesHandler
        from cherrypy.wsgiserver import CherryPyWSGIServer
        from threading import Thread



# Next 3 plugins taken from django-sane-testing:
# http://github.com/Almad/django-sane-testing
# By: Lukas "Almad" Linhart http://almad.net/
#####
# It was a nice try with Django server being threaded.
# It still sucks for some cases (did I mentioned urllib2?),
# so provide cherrypy as working alternative.
# Do imports in method to avoid CP as dependency
# Code originally written by Mikeal Rogers under Apache License.
#####

DEFAULT_LIVE_SERVER_ADDRESS = '0.0.0.0'
DEFAULT_LIVE_SERVER_PORT = '8000'


class CherryPyLiveServerPlugin(Plugin):
    name = 'cherrypyliveserver'
    activation_parameter = '--with-cherrypyliveserver'
    nosedjango = True

    def __init__(self):

        Plugin.__init__(self)