commit ffb776ca6cf0cefefed16fb36a4e161f46a724d7
parent f78588bcc1ca2951fa5b7cf6d3f401f67b2b89e4
Author: Sheng <webmaster0115@gmail.com>
Date: Thu, 26 Apr 2018 22:38:03 +0800
Use absolute path for importing modules
Diffstat:
9 files changed, 20 insertions(+), 18 deletions(-)
diff --git a/tests/__init__.py b/tests/__init__.py
@@ -1,4 +0,0 @@
-import sys
-
-
-sys.path.insert(0, 'webssh')
diff --git a/tests/sshserver.py b/tests/sshserver.py
@@ -29,7 +29,7 @@ from paramiko.py3compat import u, decodebytes
# 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.DSSKey(filename='test_dss.key')
diff --git a/tests/test_app.py b/tests/test_app.py
@@ -1,5 +1,5 @@
import json
-import handler
+import webssh.handler as handler
import random
import threading
import tornado.websocket
@@ -7,8 +7,8 @@ import tornado.gen
from tornado.testing import AsyncHTTPTestCase
from tornado.options import options
-from main import make_app, make_handlers
-from settings import get_app_settings
+from webssh.main import make_app, make_handlers
+from webssh.settings import get_app_settings
from tests.sshserver import run_ssh_server
diff --git a/tests/test_handler.py b/tests/test_handler.py
@@ -3,7 +3,7 @@ import os.path
import paramiko
from tornado.httputil import HTTPServerRequest
-from handler import MixinHandler, IndexHandler
+from webssh.handler import MixinHandler, IndexHandler
class TestMixinHandler(unittest.TestCase):
diff --git a/tests/test_policy.py b/tests/test_policy.py
@@ -4,8 +4,10 @@ import paramiko
from shutil import copyfile
from paramiko.client import RejectPolicy, WarningPolicy
-from policy import (AutoAddPolicy, get_policy_dictionary, load_host_keys,
- get_policy_class, check_policy_setting)
+from webssh.policy import (
+ AutoAddPolicy, get_policy_dictionary, load_host_keys,
+ get_policy_class, check_policy_setting
+)
class TestPolicy(unittest.TestCase):
diff --git a/tests/test_settings.py b/tests/test_settings.py
@@ -3,8 +3,10 @@ import unittest
import paramiko
import tornado.options as options
-from settings import get_host_keys_settings, get_policy_setting, base_dir
-from policy import load_host_keys
+from webssh.settings import (
+ get_host_keys_settings, get_policy_setting, base_dir
+)
+from webssh.policy import load_host_keys
class TestSettings(unittest.TestCase):
diff --git a/webssh/handler.py b/webssh/handler.py
@@ -8,7 +8,7 @@ import paramiko
import tornado.web
from tornado.ioloop import IOLoop
-from worker import Worker, recycle_worker, workers
+from webssh.worker import Worker, recycle_worker, workers
try:
from concurrent.futures import Future
diff --git a/webssh/main.py b/webssh/main.py
@@ -3,9 +3,9 @@ import tornado.web
import tornado.ioloop
from tornado.options import parse_command_line, options
-from handler import IndexHandler, WsockHandler
-from settings import (get_app_settings, get_host_keys_settings,
- get_policy_setting)
+from webssh.handler import IndexHandler, WsockHandler
+from webssh.settings import (get_app_settings, get_host_keys_settings,
+ get_policy_setting)
def make_handlers(loop, options):
diff --git a/webssh/settings.py b/webssh/settings.py
@@ -3,7 +3,9 @@ import os.path
import uuid
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')