Browse Source

Use absolute path for importing modules

pull/12/merge
Sheng 7 years ago
parent
commit
ffb776ca6c
  1. 4
      tests/__init__.py
  2. 2
      tests/sshserver.py
  3. 6
      tests/test_app.py
  4. 2
      tests/test_handler.py
  5. 6
      tests/test_policy.py
  6. 6
      tests/test_settings.py
  7. 2
      webssh/handler.py
  8. 4
      webssh/main.py
  9. 4
      webssh/settings.py

4
tests/__init__.py

@ -1,4 +0,0 @@
import sys
sys.path.insert(0, 'webssh')

2
tests/sshserver.py

@ -29,7 +29,7 @@ from paramiko.py3compat import u, decodebytes
# setup logging # setup logging
paramiko.util.log_to_file('sshserver.log') paramiko.util.log_to_file('tests/sshserver.log')
host_key = paramiko.RSAKey(filename='tests/test_rsa.key') host_key = paramiko.RSAKey(filename='tests/test_rsa.key')
# host_key = paramiko.DSSKey(filename='test_dss.key') # host_key = paramiko.DSSKey(filename='test_dss.key')

6
tests/test_app.py

@ -1,5 +1,5 @@
import json import json
import handler import webssh.handler as handler
import random import random
import threading import threading
import tornado.websocket import tornado.websocket
@ -7,8 +7,8 @@ import tornado.gen
from tornado.testing import AsyncHTTPTestCase from tornado.testing import AsyncHTTPTestCase
from tornado.options import options from tornado.options import options
from main import make_app, make_handlers from webssh.main import make_app, make_handlers
from settings import get_app_settings from webssh.settings import get_app_settings
from tests.sshserver import run_ssh_server from tests.sshserver import run_ssh_server

2
tests/test_handler.py

@ -3,7 +3,7 @@ import os.path
import paramiko import paramiko
from tornado.httputil import HTTPServerRequest from tornado.httputil import HTTPServerRequest
from handler import MixinHandler, IndexHandler from webssh.handler import MixinHandler, IndexHandler
class TestMixinHandler(unittest.TestCase): class TestMixinHandler(unittest.TestCase):

6
tests/test_policy.py

@ -4,8 +4,10 @@ import paramiko
from shutil import copyfile from shutil import copyfile
from paramiko.client import RejectPolicy, WarningPolicy from paramiko.client import RejectPolicy, WarningPolicy
from policy import (AutoAddPolicy, get_policy_dictionary, load_host_keys, from webssh.policy import (
get_policy_class, check_policy_setting) AutoAddPolicy, get_policy_dictionary, load_host_keys,
get_policy_class, check_policy_setting
)
class TestPolicy(unittest.TestCase): class TestPolicy(unittest.TestCase):

6
tests/test_settings.py

@ -3,8 +3,10 @@ import unittest
import paramiko import paramiko
import tornado.options as options import tornado.options as options
from settings import get_host_keys_settings, get_policy_setting, base_dir from webssh.settings import (
from policy import load_host_keys get_host_keys_settings, get_policy_setting, base_dir
)
from webssh.policy import load_host_keys
class TestSettings(unittest.TestCase): class TestSettings(unittest.TestCase):

2
webssh/handler.py

@ -8,7 +8,7 @@ import paramiko
import tornado.web import tornado.web
from tornado.ioloop import IOLoop from tornado.ioloop import IOLoop
from worker import Worker, recycle_worker, workers from webssh.worker import Worker, recycle_worker, workers
try: try:
from concurrent.futures import Future from concurrent.futures import Future

4
webssh/main.py

@ -3,8 +3,8 @@ import tornado.web
import tornado.ioloop import tornado.ioloop
from tornado.options import parse_command_line, options from tornado.options import parse_command_line, options
from handler import IndexHandler, WsockHandler from webssh.handler import IndexHandler, WsockHandler
from settings import (get_app_settings, get_host_keys_settings, from webssh.settings import (get_app_settings, get_host_keys_settings,
get_policy_setting) get_policy_setting)

4
webssh/settings.py

@ -3,7 +3,9 @@ import os.path
import uuid import uuid
from tornado.options import define from tornado.options import define
from policy import load_host_keys, get_policy_class, check_policy_setting from webssh.policy import (
load_host_keys, get_policy_class, check_policy_setting
)
define('address', default='127.0.0.1', help='listen address') define('address', default='127.0.0.1', help='listen address')

Loading…
Cancel
Save