Skip to content

Commit 8e1bd1b

Browse files
author
劲松
committed
test: make tests a regular package and fix find_packages exclude
- 补 tests/__init__.py 与 tests/unit/__init__.py:仓库测试从 namespace 目录变 为正规包,避免被 site-packages 中同名 tests 包遮蔽(本机 2026-09-02 实测: 环境被装入了带 __init__.py 的 tests 包后,tests.unit.mock_server 无法导入) - setup.py find_packages 的 exclude=("tests") 裸字符串按字符拆分、实际不排除 任何包;改为 ("tests", "tests.*"),防止 tests 进入 wheel
1 parent e812483 commit 8e1bd1b

3 files changed

Lines changed: 3 additions & 1 deletion

File tree

‎setup.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def readme():
4848
license="Apache 2.0",
4949
url=url,
5050
packages=setuptools.find_packages(
51-
exclude=("tests"),
51+
exclude=("tests", "tests.*"),
5252
), # pylint: disable=superfluous-parens
5353
classifiers=[
5454
"Development Status :: 4 - Beta",

‎tests/__init__.py‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# -*- coding: utf-8 -*-

‎tests/unit/__init__.py‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# -*- coding: utf-8 -*-

0 commit comments

Comments
 (0)