# Path: spyder_terminal/server/common.py
# def create_app(shell, close_future=None):
#     """Create and return a tornado Web Application instance."""
#     settings = {"static_path": os.path.join(
#         os.path.dirname(__file__), "static")}
#     application = tornado.web.Application(routes.gen_routes(close_future),
#                                           debug=True,
#                                           serve_traceback=True,
#                                           autoreload=True, **settings)
#     application.term_manager = TermManager([shell])
#     return application


import os
import sys
import os.path as osp
import pytest
from urllib.parse import urlencode
from flaky import flaky
from tornado import testing, websocket, gen
from tornado.concurrent import Future
from spyder.utils.programs import find_program
from spyder_terminal.server.common import create_app
Tornado server-side tests.

Note: This uses tornado.testing unittest style tests
"""




sys.path.append(osp.realpath(osp.dirname(__file__) + "/.."))


LOCATION = os.path.realpath(os.path.join(os.getcwd(),
                                         os.path.dirname(__file__)))
LOCATION_SLASH = LOCATION.replace('\\', '/')

LINE_END = '\n'
SHELL = 'bash'
WINDOWS = os.name == 'nt'

if WINDOWS:
    LINE_END = '\r\n'
    SHELL = 'cmd'


class TerminalServerTests(testing.AsyncHTTPTestCase):
    """Main server tests."""

    def get_app(self):
        """Return HTTP/WS server."""
        self.close_future = Future()

# Path: spyder_terminal/server/common.py
# def create_app(shell, close_future=None):
#     """Create and return a tornado Web Application instance."""
#     settings = {"static_path": os.path.join(
#         os.path.dirname(__file__), "static")}
#     application = tornado.web.Application(routes.gen_routes(close_future),
#                                           debug=True,
#                                           serve_traceback=True,
#                                           autoreload=True, **settings)
#     application.term_manager = TermManager([shell])
#     return application


# Path: spyder_terminal/server/tests/test_server.py
import os
import sys
import os.path as osp
import pytest
from urllib.parse import urlencode
from flaky import flaky
from tornado import testing, websocket, gen
from tornado.concurrent import Future
from spyder.utils.programs import find_program
from spyder_terminal.server.common import create_app

Tornado server-side tests.

Note: This uses tornado.testing unittest style tests
"""




sys.path.append(osp.realpath(osp.dirname(__file__) + "/.."))


LOCATION = os.path.realpath(os.path.join(os.getcwd(),
                                         os.path.dirname(__file__)))
LOCATION_SLASH = LOCATION.replace('\\', '/')

LINE_END = '\n'
SHELL = 'bash'
WINDOWS = os.name == 'nt'

if WINDOWS:
    LINE_END = '\r\n'
    SHELL = 'cmd'


class TerminalServerTests(testing.AsyncHTTPTestCase):
    """Main server tests."""

    def get_app(self):
        """Return HTTP/WS server."""
        self.close_future = Future()

        return create_app(SHELL, self.close_future)