# 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 subprocess
import sys
import signal
from nosedjango.plugins.base_plugin import Plugin
from __future__ import print_function




class SshTunnelPlugin(Plugin):
    name = 'sshtunnel'

    def options(self, parser, env=None):
        if env is None:
            env = os.environ
        parser.add_option(
            '--remote-server',
            help='Use a remote server to run the tests, must pass in the server address',  # noqa
        )
        parser.add_option(
            '--to-from-ports',
            help=(
                'Should be of the form x:y where x is the port that needs to '
                'be forwarded to the server and y is the port that the server '
                'needs forwarded back to the localhost'
            ),
            default='4444:8001',
        )
        parser.add_option(
            '--username',
            help='The username with which to create the ssh tunnel to the remote server',  # noqa
            default=None,
        )

# 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/ssh_tunnel_plugin.py
import os
import subprocess
import sys
import signal
from nosedjango.plugins.base_plugin import Plugin

from __future__ import print_function




class SshTunnelPlugin(Plugin):
    name = 'sshtunnel'

    def options(self, parser, env=None):
        if env is None:
            env = os.environ
        parser.add_option(
            '--remote-server',
            help='Use a remote server to run the tests, must pass in the server address',  # noqa
        )
        parser.add_option(
            '--to-from-ports',
            help=(
                'Should be of the form x:y where x is the port that needs to '
                'be forwarded to the server and y is the port that the server '
                'needs forwarded back to the localhost'
            ),
            default='4444:8001',
        )
        parser.add_option(
            '--username',
            help='The username with which to create the ssh tunnel to the remote server',  # noqa
            default=None,
        )

        Plugin.options(self, parser, env)