<commit_before>import os
from unittest import mock
from tornado.testing import AsyncHTTPTestCase

from remoteappmanager.application import Application
from tests import utils
from tests.temp_mixin import TempMixin


class TestHomeHandler(TempMixin, AsyncHTTPTestCase):
    def setUp(self):
        self._old_proxy_api_token = os.environ.get("PROXY_API_TOKEN", None)
        os.environ["PROXY_API_TOKEN"] = "<PASSWORD>"

        super().setUp()

    def tearDown(self):
        if self._old_proxy_api_token is not None:
            os.environ["PROXY_API_TOKEN"] = self._old_proxy_api_token
        else:<commit_msg>Debugging strange tornado behavior observed on travis<commit_after>import os
from unittest import mock

import tornado.netutil
from tornado.testing import AsyncHTTPTestCase

from remoteappmanager.application import Application
from tests import utils
from tests.temp_mixin import TempMixin
import socket


class TestHomeHandler(TempMixin, AsyncHTTPTestCase):
    def setUp(self):
        self._old_proxy_api_token = os.environ.get("PROXY_API_TOKEN", None)
        os.environ["PROXY_API_TOKEN"] = "<PASSWORD>"
        print "XXXXXXXXXXXXXXXX"
        print(tornado.netutil.bind_sockets(
            None, 'localhost', family=socket.AF_INET, reuse_port=False))

        super().setUp()

    def tearDown(self):
        if self._old_proxy_api_token is not None:
            os.environ["PROXY_API_TOKEN"] = self._old_proxy_api_token
        else:
{'fraction_non_alphanumeric': 0.08035714285714286, 'fraction_numerical': 0.0, 'mean_word_length': 3.9726962457337884, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 1, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4920922', 'n_tokens_mistral': 433, 'n_tokens_neox': 441, 'n_words': 102}