Skip to content

Commit 5b92fee

Browse files
committed
Move testcase to tests dir and generate code coverage.
1 parent bdaa5bd commit 5b92fee

File tree

6 files changed

+16
-3
lines changed

6 files changed

+16
-3
lines changed

pyproject.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@ ignore_missing_imports = true
1515

1616
# refer to: https://docs.pytest.org/en/stable/mark.html
1717
[tool.pytest.ini_options]
18+
minversion = "6.0"
19+
addopts = "--cov-report term-missing --cov=src/"
20+
testpaths = [
21+
"tests",
22+
]
1823
markers = [
1924
"asyncio"
2025
]

requirements-dev.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ pylint
66
pylint-quotes
77
pytest
88
pytest-asyncio
9+
pytest-cov
910
pytype>=2021.3.3
1011
semver
1112
pyee
@@ -16,4 +17,4 @@ lxml
1617
pre-commit
1718
mkdocs
1819
mkdocs-material
19-
types-requests
20+
types-requests

src/wechaty/accessory_test.py renamed to tests/accessory_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
)
1414
import pytest
1515

16-
from .accessory import (
16+
from wechaty.accessory import (
1717
Accessory,
1818
)
1919

File renamed without changes.

tests/conftest.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import sys
2+
from os.path import abspath, dirname, join
3+
4+
5+
WORKSPACE = dirname(dirname(abspath(__file__)))
6+
SCRIPT_DIR = join(WORKSPACE, "src")
7+
sys.path.append(SCRIPT_DIR)

src/wechaty/version_test.py renamed to tests/version_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"""
44
# import pytest # type: ignore
55

6-
from .version import VERSION
6+
from wechaty.version import VERSION
77

88

99
def test_version() -> None:

0 commit comments

Comments
 (0)