Skip to content

Commit

Permalink
Merge pull request #81 from Tencent/bugfix/create-project-code-style
Browse files Browse the repository at this point in the history
adjust code style of created project
  • Loading branch information
drunkdream authored Sep 7, 2020
2 parents dafa1b2 + 22ce67c commit ed3c5b9
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions testbase/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
from %(ProjectName)slib.testcase import %(ProjectNameCapUp)sTestCase
class HelloTest(%(ProjectNameCapUp)sTestCase):
'''示例测试用例
'''
Expand All @@ -73,7 +74,6 @@ def run_test(self):
if __name__ == '__main__':
HelloTest().debug_run()
"""

TESTLIB_CONTENT = """# -*- coding: utf-8 -*-
Expand All @@ -83,6 +83,7 @@ def run_test(self):
from testbase import testcase
class %(ProjectNameCapUp)sTestCase(testcase.TestCase):
'''%(ProjectName)s测试用例基类
'''
Expand All @@ -98,14 +99,14 @@ class %(ProjectNameCapUp)sTestCase(testcase.TestCase):
import sys
import os
proj_root = os.path.dirname(os.path.abspath(__file__))
if proj_root not in sys.path:
sys.path.insert(0, proj_root)
exlib_dir = os.path.join(proj_root, 'exlib')
if os.path.isdir(exlib_dir):
for filename in os.listdir(exlib_dir):
PROJ_ROOT = os.path.dirname(os.path.abspath(__file__))
if PROJ_ROOT not in sys.path:
sys.path.insert(0, PROJ_ROOT)
EXLIB_DIR = os.path.join(PROJ_ROOT, 'exlib')
if os.path.isdir(EXLIB_DIR):
for filename in os.listdir(EXLIB_DIR):
if filename.endswith('.egg'):
lib_path = os.path.join(exlib_dir, filename)
lib_path = os.path.join(EXLIB_DIR, filename)
if os.path.isfile(lib_path) and lib_path not in sys.path:
sys.path.insert(0, lib_path)
Expand Down

0 comments on commit ed3c5b9

Please sign in to comment.