jit-utils-backend 0.0.1__tar.gz → 0.0.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {jit-utils-backend-0.0.1 → jit_utils_backend-0.0.3}/MANIFEST.in +3 -1
- {jit-utils-backend-0.0.1/jit_utils_backend.egg-info → jit_utils_backend-0.0.3}/PKG-INFO +19 -18
- {jit-utils-backend-0.0.1 → jit_utils_backend-0.0.3}/README.md +15 -11
- jit_utils_backend-0.0.3/jit_utils/__init__.py +24 -0
- {jit-utils-backend-0.0.1 → jit_utils_backend-0.0.3/jit_utils_backend.egg-info}/PKG-INFO +18 -17
- {jit-utils-backend-0.0.1 → jit_utils_backend-0.0.3}/jit_utils_backend.egg-info/SOURCES.txt +1 -7
- {jit-utils-backend-0.0.1 → jit_utils_backend-0.0.3}/jit_utils_backend.egg-info/top_level.txt +0 -1
- {jit-utils-backend-0.0.1 → jit_utils_backend-0.0.3}/setup.py +6 -11
- jit-utils-backend-0.0.1/jit_utils/__init__.py +0 -152
- jit-utils-backend-0.0.1/tests/__init__.py +0 -4
- jit-utils-backend-0.0.1/tests/run_tests.py +0 -102
- jit-utils-backend-0.0.1/tests/test_package_imports.py +0 -199
- jit-utils-backend-0.0.1/tests/test_qrcode_barcode.py +0 -182
- jit-utils-backend-0.0.1/tests/test_string_utils.py +0 -174
- jit-utils-backend-0.0.1/tests/test_time_utils.py +0 -185
- {jit-utils-backend-0.0.1 → jit_utils_backend-0.0.3}/jit_utils/apiAuthSign.py +0 -0
- {jit-utils-backend-0.0.1 → jit_utils_backend-0.0.3}/jit_utils/barcode.py +0 -0
- {jit-utils-backend-0.0.1 → jit_utils_backend-0.0.3}/jit_utils/clsTool.py +0 -0
- {jit-utils-backend-0.0.1 → jit_utils_backend-0.0.3}/jit_utils/config/__init__.py +0 -0
- {jit-utils-backend-0.0.1 → jit_utils_backend-0.0.3}/jit_utils/config/case.py +0 -0
- {jit-utils-backend-0.0.1 → jit_utils_backend-0.0.3}/jit_utils/config/config.py +0 -0
- {jit-utils-backend-0.0.1 → jit_utils_backend-0.0.3}/jit_utils/config/exception.py +0 -0
- {jit-utils-backend-0.0.1 → jit_utils_backend-0.0.3}/jit_utils/config/field.py +0 -0
- {jit-utils-backend-0.0.1 → jit_utils_backend-0.0.3}/jit_utils/convert.py +0 -0
- {jit-utils-backend-0.0.1 → jit_utils_backend-0.0.3}/jit_utils/decorator.py +0 -0
- {jit-utils-backend-0.0.1 → jit_utils_backend-0.0.3}/jit_utils/exceptions.py +0 -0
- {jit-utils-backend-0.0.1 → jit_utils_backend-0.0.3}/jit_utils/forwarder.py +0 -0
- {jit-utils-backend-0.0.1 → jit_utils_backend-0.0.3}/jit_utils/matchTool.py +0 -0
- {jit-utils-backend-0.0.1 → jit_utils_backend-0.0.3}/jit_utils/network.py +0 -0
- {jit-utils-backend-0.0.1 → jit_utils_backend-0.0.3}/jit_utils/qrcode.py +0 -0
- {jit-utils-backend-0.0.1 → jit_utils_backend-0.0.3}/jit_utils/signature.py +0 -0
- {jit-utils-backend-0.0.1 → jit_utils_backend-0.0.3}/jit_utils/spaceSender.py +0 -0
- {jit-utils-backend-0.0.1 → jit_utils_backend-0.0.3}/jit_utils/string.py +0 -0
- {jit-utils-backend-0.0.1 → jit_utils_backend-0.0.3}/jit_utils/time.py +0 -0
- {jit-utils-backend-0.0.1 → jit_utils_backend-0.0.3}/jit_utils/validator.py +0 -0
- {jit-utils-backend-0.0.1 → jit_utils_backend-0.0.3}/jit_utils/workday_constants.py +0 -0
- {jit-utils-backend-0.0.1 → jit_utils_backend-0.0.3}/jit_utils_backend.egg-info/dependency_links.txt +0 -0
- {jit-utils-backend-0.0.1 → jit_utils_backend-0.0.3}/jit_utils_backend.egg-info/requires.txt +0 -0
- {jit-utils-backend-0.0.1 → jit_utils_backend-0.0.3}/setup.cfg +0 -0
@@ -1,12 +1,9 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
|
-
Name:
|
3
|
-
Version: 0.0.
|
2
|
+
Name: jit_utils_backend
|
3
|
+
Version: 0.0.3
|
4
4
|
Summary: 极态后端工具包
|
5
|
-
Author:
|
6
|
-
Author-email:
|
7
|
-
Project-URL: Documentation, https://github.com/zangtao/jit-utils-backend
|
8
|
-
Project-URL: Source, https://github.com/zangtao/jit-utils-backend
|
9
|
-
Project-URL: Tracker, https://github.com/zangtao/jit-utils-backend/issues
|
5
|
+
Author: JitAi
|
6
|
+
Author-email: develop@wanyunapp.com
|
10
7
|
Keywords: python,jit,sdk,apiAuth,utils,backend
|
11
8
|
Classifier: Development Status :: 3 - Alpha
|
12
9
|
Classifier: Intended Audience :: Developers
|
@@ -32,7 +29,7 @@ Description-Content-Type: text/markdown
|
|
32
29
|
## 安装
|
33
30
|
|
34
31
|
```bash
|
35
|
-
pip install
|
32
|
+
pip install jit_utils_backend
|
36
33
|
```
|
37
34
|
|
38
35
|
## 使用方法
|
@@ -43,11 +40,15 @@ pip install jit-utils-backend
|
|
43
40
|
# 导入整个包
|
44
41
|
import jit_utils
|
45
42
|
|
46
|
-
#
|
47
|
-
from jit_utils import now
|
43
|
+
# 导入特定功能(从具体的子模块)
|
44
|
+
from jit_utils.time import now
|
45
|
+
from jit_utils.string import randomString
|
46
|
+
from jit_utils.qrcode import Qrcode
|
47
|
+
from jit_utils.barcode import Barcode
|
48
48
|
|
49
49
|
# 导入特定模块
|
50
|
-
|
50
|
+
import jit_utils.time
|
51
|
+
import jit_utils.string
|
51
52
|
```
|
52
53
|
|
53
54
|
## 主要功能
|
@@ -55,7 +56,7 @@ from jit_utils import time_utils, string_utils
|
|
55
56
|
### 1. 时间处理工具
|
56
57
|
|
57
58
|
```python
|
58
|
-
from jit_utils import now, today, dayShift, formatNow
|
59
|
+
from jit_utils.time import now, today, dayShift, formatNow
|
59
60
|
|
60
61
|
# 获取当前时间
|
61
62
|
current_time = now()
|
@@ -73,7 +74,7 @@ formatted_time = formatNow("%Y-%m-%d %H:%M:%S")
|
|
73
74
|
### 2. 字符串处理工具
|
74
75
|
|
75
76
|
```python
|
76
|
-
from jit_utils import randomString, md5Str, getUuidStr
|
77
|
+
from jit_utils.string import randomString, md5Str, getUuidStr
|
77
78
|
|
78
79
|
# 生成随机字符串
|
79
80
|
random_str = randomString(8)
|
@@ -88,7 +89,7 @@ uuid_str = getUuidStr()
|
|
88
89
|
### 3. 二维码生成
|
89
90
|
|
90
91
|
```python
|
91
|
-
from jit_utils import Qrcode
|
92
|
+
from jit_utils.qrcode import Qrcode
|
92
93
|
|
93
94
|
# 创建二维码
|
94
95
|
qr = Qrcode("https://example.com")
|
@@ -103,7 +104,7 @@ qr_str = qr.toStr()
|
|
103
104
|
### 4. 条形码生成
|
104
105
|
|
105
106
|
```python
|
106
|
-
from jit_utils import Barcode
|
107
|
+
from jit_utils.barcode import Barcode
|
107
108
|
|
108
109
|
# 创建条形码
|
109
110
|
barcode = Barcode("123456789")
|
@@ -118,7 +119,7 @@ barcode_str = barcode.toStr()
|
|
118
119
|
### 5. 数据验证
|
119
120
|
|
120
121
|
```python
|
121
|
-
from jit_utils import ParamsValidator
|
122
|
+
from jit_utils.validator import ParamsValidator
|
122
123
|
from dataclasses import dataclass
|
123
124
|
|
124
125
|
@dataclass
|
@@ -134,7 +135,7 @@ params = UserParams("test_function", name="John", age=25)
|
|
134
135
|
### 6. 装饰器
|
135
136
|
|
136
137
|
```python
|
137
|
-
from jit_utils import forward
|
138
|
+
from jit_utils.decorator import forward
|
138
139
|
|
139
140
|
@forward("module.submodule")
|
140
141
|
def my_function():
|
@@ -175,4 +176,4 @@ zangtao (noguchisyou123456@gmail.com)
|
|
175
176
|
|
176
177
|
## 版本
|
177
178
|
|
178
|
-
0.0.
|
179
|
+
0.0.3
|
@@ -5,7 +5,7 @@
|
|
5
5
|
## 安装
|
6
6
|
|
7
7
|
```bash
|
8
|
-
pip install
|
8
|
+
pip install jit_utils_backend
|
9
9
|
```
|
10
10
|
|
11
11
|
## 使用方法
|
@@ -16,11 +16,15 @@ pip install jit-utils-backend
|
|
16
16
|
# 导入整个包
|
17
17
|
import jit_utils
|
18
18
|
|
19
|
-
#
|
20
|
-
from jit_utils import now
|
19
|
+
# 导入特定功能(从具体的子模块)
|
20
|
+
from jit_utils.time import now
|
21
|
+
from jit_utils.string import randomString
|
22
|
+
from jit_utils.qrcode import Qrcode
|
23
|
+
from jit_utils.barcode import Barcode
|
21
24
|
|
22
25
|
# 导入特定模块
|
23
|
-
|
26
|
+
import jit_utils.time
|
27
|
+
import jit_utils.string
|
24
28
|
```
|
25
29
|
|
26
30
|
## 主要功能
|
@@ -28,7 +32,7 @@ from jit_utils import time_utils, string_utils
|
|
28
32
|
### 1. 时间处理工具
|
29
33
|
|
30
34
|
```python
|
31
|
-
from jit_utils import now, today, dayShift, formatNow
|
35
|
+
from jit_utils.time import now, today, dayShift, formatNow
|
32
36
|
|
33
37
|
# 获取当前时间
|
34
38
|
current_time = now()
|
@@ -46,7 +50,7 @@ formatted_time = formatNow("%Y-%m-%d %H:%M:%S")
|
|
46
50
|
### 2. 字符串处理工具
|
47
51
|
|
48
52
|
```python
|
49
|
-
from jit_utils import randomString, md5Str, getUuidStr
|
53
|
+
from jit_utils.string import randomString, md5Str, getUuidStr
|
50
54
|
|
51
55
|
# 生成随机字符串
|
52
56
|
random_str = randomString(8)
|
@@ -61,7 +65,7 @@ uuid_str = getUuidStr()
|
|
61
65
|
### 3. 二维码生成
|
62
66
|
|
63
67
|
```python
|
64
|
-
from jit_utils import Qrcode
|
68
|
+
from jit_utils.qrcode import Qrcode
|
65
69
|
|
66
70
|
# 创建二维码
|
67
71
|
qr = Qrcode("https://example.com")
|
@@ -76,7 +80,7 @@ qr_str = qr.toStr()
|
|
76
80
|
### 4. 条形码生成
|
77
81
|
|
78
82
|
```python
|
79
|
-
from jit_utils import Barcode
|
83
|
+
from jit_utils.barcode import Barcode
|
80
84
|
|
81
85
|
# 创建条形码
|
82
86
|
barcode = Barcode("123456789")
|
@@ -91,7 +95,7 @@ barcode_str = barcode.toStr()
|
|
91
95
|
### 5. 数据验证
|
92
96
|
|
93
97
|
```python
|
94
|
-
from jit_utils import ParamsValidator
|
98
|
+
from jit_utils.validator import ParamsValidator
|
95
99
|
from dataclasses import dataclass
|
96
100
|
|
97
101
|
@dataclass
|
@@ -107,7 +111,7 @@ params = UserParams("test_function", name="John", age=25)
|
|
107
111
|
### 6. 装饰器
|
108
112
|
|
109
113
|
```python
|
110
|
-
from jit_utils import forward
|
114
|
+
from jit_utils.decorator import forward
|
111
115
|
|
112
116
|
@forward("module.submodule")
|
113
117
|
def my_function():
|
@@ -148,4 +152,4 @@ zangtao (noguchisyou123456@gmail.com)
|
|
148
152
|
|
149
153
|
## 版本
|
150
154
|
|
151
|
-
0.0.
|
155
|
+
0.0.3
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# -*-coding:utf-8-*-
|
2
|
+
"""
|
3
|
+
JIT Utils Backend - 极态后端工具包
|
4
|
+
|
5
|
+
A comprehensive utility package for backend development with JIT.
|
6
|
+
|
7
|
+
主要功能:
|
8
|
+
- 时间处理工具
|
9
|
+
- 字符串处理工具
|
10
|
+
- 二维码和条形码生成
|
11
|
+
- 数据验证
|
12
|
+
- 网络工具
|
13
|
+
- 签名工具
|
14
|
+
等等...
|
15
|
+
|
16
|
+
使用方法:
|
17
|
+
from jit_utils.string import randomString
|
18
|
+
from jit_utils.time import now
|
19
|
+
from jit_utils.qrcode import Qrcode
|
20
|
+
...
|
21
|
+
"""
|
22
|
+
|
23
|
+
__version__ = '0.0.3'
|
24
|
+
__author__ = 'zangtao'
|
@@ -1,12 +1,9 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: jit-utils-backend
|
3
|
-
Version: 0.0.
|
3
|
+
Version: 0.0.3
|
4
4
|
Summary: 极态后端工具包
|
5
|
-
Author:
|
6
|
-
Author-email:
|
7
|
-
Project-URL: Documentation, https://github.com/zangtao/jit-utils-backend
|
8
|
-
Project-URL: Source, https://github.com/zangtao/jit-utils-backend
|
9
|
-
Project-URL: Tracker, https://github.com/zangtao/jit-utils-backend/issues
|
5
|
+
Author: JitAi
|
6
|
+
Author-email: develop@wanyunapp.com
|
10
7
|
Keywords: python,jit,sdk,apiAuth,utils,backend
|
11
8
|
Classifier: Development Status :: 3 - Alpha
|
12
9
|
Classifier: Intended Audience :: Developers
|
@@ -32,7 +29,7 @@ Description-Content-Type: text/markdown
|
|
32
29
|
## 安装
|
33
30
|
|
34
31
|
```bash
|
35
|
-
pip install
|
32
|
+
pip install jit_utils_backend
|
36
33
|
```
|
37
34
|
|
38
35
|
## 使用方法
|
@@ -43,11 +40,15 @@ pip install jit-utils-backend
|
|
43
40
|
# 导入整个包
|
44
41
|
import jit_utils
|
45
42
|
|
46
|
-
#
|
47
|
-
from jit_utils import now
|
43
|
+
# 导入特定功能(从具体的子模块)
|
44
|
+
from jit_utils.time import now
|
45
|
+
from jit_utils.string import randomString
|
46
|
+
from jit_utils.qrcode import Qrcode
|
47
|
+
from jit_utils.barcode import Barcode
|
48
48
|
|
49
49
|
# 导入特定模块
|
50
|
-
|
50
|
+
import jit_utils.time
|
51
|
+
import jit_utils.string
|
51
52
|
```
|
52
53
|
|
53
54
|
## 主要功能
|
@@ -55,7 +56,7 @@ from jit_utils import time_utils, string_utils
|
|
55
56
|
### 1. 时间处理工具
|
56
57
|
|
57
58
|
```python
|
58
|
-
from jit_utils import now, today, dayShift, formatNow
|
59
|
+
from jit_utils.time import now, today, dayShift, formatNow
|
59
60
|
|
60
61
|
# 获取当前时间
|
61
62
|
current_time = now()
|
@@ -73,7 +74,7 @@ formatted_time = formatNow("%Y-%m-%d %H:%M:%S")
|
|
73
74
|
### 2. 字符串处理工具
|
74
75
|
|
75
76
|
```python
|
76
|
-
from jit_utils import randomString, md5Str, getUuidStr
|
77
|
+
from jit_utils.string import randomString, md5Str, getUuidStr
|
77
78
|
|
78
79
|
# 生成随机字符串
|
79
80
|
random_str = randomString(8)
|
@@ -88,7 +89,7 @@ uuid_str = getUuidStr()
|
|
88
89
|
### 3. 二维码生成
|
89
90
|
|
90
91
|
```python
|
91
|
-
from jit_utils import Qrcode
|
92
|
+
from jit_utils.qrcode import Qrcode
|
92
93
|
|
93
94
|
# 创建二维码
|
94
95
|
qr = Qrcode("https://example.com")
|
@@ -103,7 +104,7 @@ qr_str = qr.toStr()
|
|
103
104
|
### 4. 条形码生成
|
104
105
|
|
105
106
|
```python
|
106
|
-
from jit_utils import Barcode
|
107
|
+
from jit_utils.barcode import Barcode
|
107
108
|
|
108
109
|
# 创建条形码
|
109
110
|
barcode = Barcode("123456789")
|
@@ -118,7 +119,7 @@ barcode_str = barcode.toStr()
|
|
118
119
|
### 5. 数据验证
|
119
120
|
|
120
121
|
```python
|
121
|
-
from jit_utils import ParamsValidator
|
122
|
+
from jit_utils.validator import ParamsValidator
|
122
123
|
from dataclasses import dataclass
|
123
124
|
|
124
125
|
@dataclass
|
@@ -134,7 +135,7 @@ params = UserParams("test_function", name="John", age=25)
|
|
134
135
|
### 6. 装饰器
|
135
136
|
|
136
137
|
```python
|
137
|
-
from jit_utils import forward
|
138
|
+
from jit_utils.decorator import forward
|
138
139
|
|
139
140
|
@forward("module.submodule")
|
140
141
|
def my_function():
|
@@ -175,4 +176,4 @@ zangtao (noguchisyou123456@gmail.com)
|
|
175
176
|
|
176
177
|
## 版本
|
177
178
|
|
178
|
-
0.0.
|
179
|
+
0.0.3
|
@@ -27,10 +27,4 @@ jit_utils_backend.egg-info/PKG-INFO
|
|
27
27
|
jit_utils_backend.egg-info/SOURCES.txt
|
28
28
|
jit_utils_backend.egg-info/dependency_links.txt
|
29
29
|
jit_utils_backend.egg-info/requires.txt
|
30
|
-
jit_utils_backend.egg-info/top_level.txt
|
31
|
-
tests/__init__.py
|
32
|
-
tests/run_tests.py
|
33
|
-
tests/test_package_imports.py
|
34
|
-
tests/test_qrcode_barcode.py
|
35
|
-
tests/test_string_utils.py
|
36
|
-
tests/test_time_utils.py
|
30
|
+
jit_utils_backend.egg-info/top_level.txt
|
@@ -10,12 +10,12 @@ Created on 2024/11/13
|
|
10
10
|
from setuptools import setup, find_packages
|
11
11
|
from pathlib import Path
|
12
12
|
|
13
|
-
__lib_name__ = '
|
13
|
+
__lib_name__ = 'jit_utils_backend'
|
14
14
|
|
15
15
|
this_directory = Path(__file__).parent
|
16
16
|
read_me_path = this_directory / "README.md"
|
17
17
|
|
18
|
-
VERSION = '0.0.
|
18
|
+
VERSION = '0.0.3'
|
19
19
|
DESCRIPTION = '极态后端工具包'
|
20
20
|
|
21
21
|
# 处理 README.md 文件
|
@@ -29,12 +29,12 @@ setup(
|
|
29
29
|
# 名称必须匹配文件名 'jit-utils-backend'
|
30
30
|
name=__lib_name__,
|
31
31
|
version=VERSION,
|
32
|
-
author="
|
33
|
-
author_email="
|
32
|
+
author="JitAi",
|
33
|
+
author_email="develop@wanyunapp.com",
|
34
34
|
description=DESCRIPTION,
|
35
35
|
long_description=LONG_DESCRIPTION,
|
36
36
|
long_description_content_type="text/markdown",
|
37
|
-
packages=find_packages(),
|
37
|
+
packages=find_packages(exclude=['tests', 'tests.*']),
|
38
38
|
install_requires=[
|
39
39
|
"requests",
|
40
40
|
"qrcode",
|
@@ -58,10 +58,5 @@ setup(
|
|
58
58
|
"Operating System :: POSIX :: Linux",
|
59
59
|
"Topic :: Software Development :: Libraries :: Python Modules",
|
60
60
|
"License :: OSI Approved :: MIT License",
|
61
|
-
]
|
62
|
-
project_urls={
|
63
|
-
"Documentation": "https://github.com/zangtao/jit-utils-backend",
|
64
|
-
"Source": "https://github.com/zangtao/jit-utils-backend",
|
65
|
-
"Tracker": "https://github.com/zangtao/jit-utils-backend/issues",
|
66
|
-
},
|
61
|
+
]
|
67
62
|
)
|
@@ -1,152 +0,0 @@
|
|
1
|
-
# -*-coding:utf-8-*-
|
2
|
-
"""
|
3
|
-
JIT Utils Backend - 极态后端工具包
|
4
|
-
|
5
|
-
A comprehensive utility package for backend development with JIT.
|
6
|
-
|
7
|
-
主要功能:
|
8
|
-
- 时间处理工具
|
9
|
-
- 字符串处理工具
|
10
|
-
- 二维码和条形码生成
|
11
|
-
- 数据验证
|
12
|
-
- 网络工具
|
13
|
-
- 签名工具
|
14
|
-
等等...
|
15
|
-
"""
|
16
|
-
|
17
|
-
__version__ = '0.0.1'
|
18
|
-
__author__ = 'zangtao'
|
19
|
-
|
20
|
-
# 导入主要的工具类和函数
|
21
|
-
try:
|
22
|
-
from .decorator import forward
|
23
|
-
except ImportError:
|
24
|
-
pass
|
25
|
-
|
26
|
-
# 时间工具
|
27
|
-
try:
|
28
|
-
from . import time as time_utils
|
29
|
-
# 导出一些常用的时间函数
|
30
|
-
from .time import (
|
31
|
-
now, today, get, dayShift,
|
32
|
-
monday, weekShift, monthStart, monthShift,
|
33
|
-
quarterStart, quarterShift, yearStart, yearShift,
|
34
|
-
getTimestamp, timeStampToDateTime, strToTimestamp,
|
35
|
-
formatNow, datetime2string, string2datetime
|
36
|
-
)
|
37
|
-
except ImportError:
|
38
|
-
pass
|
39
|
-
|
40
|
-
# 字符串工具
|
41
|
-
try:
|
42
|
-
from . import string as string_utils
|
43
|
-
from .string import (
|
44
|
-
randomString, randomNum, getUuidStr,
|
45
|
-
md5Bytes, md5Str, getFileMd5,
|
46
|
-
renderTemplateString
|
47
|
-
)
|
48
|
-
except ImportError:
|
49
|
-
pass
|
50
|
-
|
51
|
-
# 二维码工具
|
52
|
-
try:
|
53
|
-
from .qrcode import Qrcode
|
54
|
-
except ImportError:
|
55
|
-
Qrcode = None
|
56
|
-
|
57
|
-
# 条形码工具
|
58
|
-
try:
|
59
|
-
from .barcode import Barcode
|
60
|
-
except ImportError:
|
61
|
-
Barcode = None
|
62
|
-
|
63
|
-
# 验证工具
|
64
|
-
try:
|
65
|
-
from .validator import ParamsValidator
|
66
|
-
except ImportError:
|
67
|
-
ParamsValidator = None
|
68
|
-
|
69
|
-
# 网络工具
|
70
|
-
try:
|
71
|
-
from . import network
|
72
|
-
except ImportError:
|
73
|
-
pass
|
74
|
-
|
75
|
-
# 签名工具
|
76
|
-
try:
|
77
|
-
from . import signature
|
78
|
-
except ImportError:
|
79
|
-
pass
|
80
|
-
|
81
|
-
# 匹配工具
|
82
|
-
try:
|
83
|
-
from . import matchTool
|
84
|
-
except ImportError:
|
85
|
-
pass
|
86
|
-
|
87
|
-
# 类工具
|
88
|
-
try:
|
89
|
-
from . import clsTool
|
90
|
-
except ImportError:
|
91
|
-
pass
|
92
|
-
|
93
|
-
# 转换工具
|
94
|
-
try:
|
95
|
-
from .convert import Converter, MemoryCompiler
|
96
|
-
except ImportError:
|
97
|
-
# 如果导入失败,创建占位符避免 __all__ 报错
|
98
|
-
Converter = None
|
99
|
-
MemoryCompiler = None
|
100
|
-
|
101
|
-
# 异常处理
|
102
|
-
try:
|
103
|
-
from . import exceptions
|
104
|
-
except ImportError:
|
105
|
-
pass
|
106
|
-
|
107
|
-
# 工作日常量
|
108
|
-
try:
|
109
|
-
from . import workday_constants
|
110
|
-
except ImportError:
|
111
|
-
pass
|
112
|
-
|
113
|
-
# 配置相关
|
114
|
-
try:
|
115
|
-
from . import config
|
116
|
-
except ImportError:
|
117
|
-
pass
|
118
|
-
|
119
|
-
# 定义 __all__ 列表,控制 from jit_utils import * 的行为
|
120
|
-
__all__ = [
|
121
|
-
# 版本信息
|
122
|
-
'__version__',
|
123
|
-
'__author__',
|
124
|
-
|
125
|
-
# 装饰器
|
126
|
-
'forward',
|
127
|
-
|
128
|
-
# 时间工具
|
129
|
-
'time_utils',
|
130
|
-
'now', 'today', 'get', 'dayShift',
|
131
|
-
'monday', 'weekShift', 'monthStart', 'monthShift',
|
132
|
-
'quarterStart', 'quarterShift', 'yearStart', 'yearShift',
|
133
|
-
'getTimestamp', 'timeStampToDateTime', 'strToTimestamp',
|
134
|
-
'formatNow', 'datetime2string', 'string2datetime',
|
135
|
-
|
136
|
-
# 字符串工具
|
137
|
-
'string_utils',
|
138
|
-
'randomString', 'randomNum', 'getUuidStr',
|
139
|
-
'md5Bytes', 'md5Str', 'getFileMd5',
|
140
|
-
'renderTemplateString',
|
141
|
-
|
142
|
-
# 二维码和条形码
|
143
|
-
'Qrcode', 'Barcode',
|
144
|
-
|
145
|
-
# 验证工具
|
146
|
-
'ParamsValidator',
|
147
|
-
|
148
|
-
# 其他模块
|
149
|
-
'network', 'signature', 'matchTool',
|
150
|
-
'clsTool', 'exceptions', 'workday_constants',
|
151
|
-
'config', 'Converter', 'MemoryCompiler'
|
152
|
-
]
|
@@ -1,102 +0,0 @@
|
|
1
|
-
#!/usr/bin/env python3
|
2
|
-
# -*-coding:utf-8-*-
|
3
|
-
"""
|
4
|
-
JIT Utils Backend 测试运行器
|
5
|
-
|
6
|
-
运行所有测试并生成报告
|
7
|
-
"""
|
8
|
-
import sys
|
9
|
-
import unittest
|
10
|
-
import os
|
11
|
-
|
12
|
-
# 添加项目根目录到Python路径
|
13
|
-
project_root = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
14
|
-
sys.path.insert(0, project_root)
|
15
|
-
|
16
|
-
|
17
|
-
def run_all_tests():
|
18
|
-
"""运行所有测试"""
|
19
|
-
# 发现测试目录中的所有测试
|
20
|
-
test_dir = os.path.dirname(os.path.abspath(__file__))
|
21
|
-
|
22
|
-
# 创建测试套件
|
23
|
-
loader = unittest.TestLoader()
|
24
|
-
suite = loader.discover(test_dir, pattern='test_*.py')
|
25
|
-
|
26
|
-
# 运行测试
|
27
|
-
runner = unittest.TextTestRunner(verbosity=2, stream=sys.stdout)
|
28
|
-
result = runner.run(suite)
|
29
|
-
|
30
|
-
# 打印总结
|
31
|
-
print("\n" + "="*60)
|
32
|
-
print("测试总结:")
|
33
|
-
print(f"运行测试数: {result.testsRun}")
|
34
|
-
print(f"失败数: {len(result.failures)}")
|
35
|
-
print(f"错误数: {len(result.errors)}")
|
36
|
-
print(f"跳过数: {len(result.skipped)}")
|
37
|
-
|
38
|
-
if result.failures:
|
39
|
-
print("\n失败的测试:")
|
40
|
-
for test, traceback in result.failures:
|
41
|
-
print(f" - {test}: {traceback.split('AssertionError:')[-1].strip()}")
|
42
|
-
|
43
|
-
if result.errors:
|
44
|
-
print("\n出错的测试:")
|
45
|
-
for test, traceback in result.errors:
|
46
|
-
print(f" - {test}: {traceback.split('Error:')[-1].strip()}")
|
47
|
-
|
48
|
-
if result.skipped:
|
49
|
-
print("\n跳过的测试:")
|
50
|
-
for test, reason in result.skipped:
|
51
|
-
print(f" - {test}: {reason}")
|
52
|
-
|
53
|
-
success_rate = ((result.testsRun - len(result.failures) - len(result.errors)) / result.testsRun * 100) if result.testsRun > 0 else 0
|
54
|
-
print(f"\n成功率: {success_rate:.1f}%")
|
55
|
-
|
56
|
-
return result.wasSuccessful()
|
57
|
-
|
58
|
-
|
59
|
-
def run_specific_test(test_name):
|
60
|
-
"""运行特定的测试模块"""
|
61
|
-
test_dir = os.path.dirname(os.path.abspath(__file__))
|
62
|
-
|
63
|
-
try:
|
64
|
-
# 动态导入测试模块
|
65
|
-
test_module = __import__(f'tests.{test_name}', fromlist=[test_name])
|
66
|
-
|
67
|
-
# 创建测试套件
|
68
|
-
loader = unittest.TestLoader()
|
69
|
-
suite = loader.loadTestsFromModule(test_module)
|
70
|
-
|
71
|
-
# 运行测试
|
72
|
-
runner = unittest.TextTestRunner(verbosity=2)
|
73
|
-
result = runner.run(suite)
|
74
|
-
|
75
|
-
return result.wasSuccessful()
|
76
|
-
|
77
|
-
except ImportError as e:
|
78
|
-
print(f"无法导入测试模块 '{test_name}': {e}")
|
79
|
-
return False
|
80
|
-
|
81
|
-
|
82
|
-
def main():
|
83
|
-
"""主函数"""
|
84
|
-
if len(sys.argv) > 1:
|
85
|
-
# 运行特定测试
|
86
|
-
test_name = sys.argv[1]
|
87
|
-
if not test_name.startswith('test_'):
|
88
|
-
test_name = f'test_{test_name}'
|
89
|
-
|
90
|
-
print(f"运行测试模块: {test_name}")
|
91
|
-
success = run_specific_test(test_name)
|
92
|
-
else:
|
93
|
-
# 运行所有测试
|
94
|
-
print("运行所有测试...")
|
95
|
-
success = run_all_tests()
|
96
|
-
|
97
|
-
# 根据测试结果设置退出码
|
98
|
-
sys.exit(0 if success else 1)
|
99
|
-
|
100
|
-
|
101
|
-
if __name__ == '__main__':
|
102
|
-
main()
|