mirror of
https://github.com/suyiiyii/nonebot-bison.git
synced 2025-06-03 18:06:13 +08:00
use coverage
This commit is contained in:
parent
d6192153da
commit
c62a8d2f5e
@ -12,10 +12,7 @@ orbs:
|
||||
workflows:
|
||||
build-test-publish:
|
||||
jobs:
|
||||
- python/test:
|
||||
pkg-manager: poetry
|
||||
test-tool: pytest
|
||||
version: "3.9"
|
||||
- test:
|
||||
filters:
|
||||
tags:
|
||||
only: /.*/
|
||||
@ -29,29 +26,24 @@ workflows:
|
||||
only: /^v.*/
|
||||
|
||||
jobs:
|
||||
# test:
|
||||
# docker:
|
||||
# - image: cimg/python:3.9
|
||||
# steps:
|
||||
# - checkout
|
||||
# # - run: sed -e '41,45d' -i pyproject.toml
|
||||
# - restore_cache:
|
||||
# keys:
|
||||
# - venv-cache-{{ checksum "poetry.lock" }}
|
||||
# - run:
|
||||
# name: Poetry install
|
||||
# command: |
|
||||
# poetry config virtualenvs.in-project true
|
||||
# poetry install -v
|
||||
# - save_cache:
|
||||
# paths:
|
||||
# - .venv
|
||||
# key: venv-cache-{{ checksum "poetry.lock" }}
|
||||
# - run:
|
||||
# name: pytest
|
||||
# command: poetry run pytest --junitxml=test-results/junit.xml
|
||||
# - store_test_results:
|
||||
# path: test-results
|
||||
test:
|
||||
docker:
|
||||
- image: cimg/python:3.9
|
||||
steps:
|
||||
- checkout
|
||||
# - run: sed -e '41,45d' -i pyproject.toml
|
||||
- python/install-packages:
|
||||
pkg-manager: poetry
|
||||
- run:
|
||||
name: Coverage test
|
||||
command: poetry run coverage run -m pytest --junitxml=test-results/junit.xml
|
||||
- store_test_results:
|
||||
path: test-results
|
||||
- run:
|
||||
name: Collect coverage
|
||||
command: coverage html --include='src/*'
|
||||
- store_artifacts:
|
||||
path: htmlcov
|
||||
build-publish:
|
||||
docker:
|
||||
- image: cimg/python:3.9
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
|
||||
[](https://pypi.org/project/nonebot-hk-reporter/)
|
||||
[](https://circleci.com/gh/felinae98/nonebot-hk-reporter)
|
||||
[](https://circleci.com/gh/felinae98/nonebot-hk-reporter)
|
||||
[](https://qm.qq.com/cgi-bin/qm/qr?k=pXYMGB_e8b6so3QTqgeV6lkKDtEeYE4f&jump_from=webapi)
|
||||
|
||||
</div>
|
||||
|
@ -62,11 +62,12 @@ class Weibo(Platform):
|
||||
def get_tags(self, raw_post: RawPost) -> Optional[list[Tag]]:
|
||||
"Return Tag list of given RawPost"
|
||||
text = raw_post['mblog']['text']
|
||||
soup = bs(text, 'html.parser')
|
||||
return list(map(
|
||||
lambda x: x[1:-1],
|
||||
filter(
|
||||
lambda s: s[0] == '#' and s[-1] == '#',
|
||||
map(lambda x:x.text, text.find_all('span', class_='surl-text'))
|
||||
map(lambda x:x.text, soup.find_all('span', class_='surl-text'))
|
||||
)
|
||||
))
|
||||
|
||||
|
@ -74,5 +74,6 @@ async def test_parse_long(weibo):
|
||||
assert(not '全文' in post.text)
|
||||
assert(detail_router.called)
|
||||
|
||||
def text_tag(weibo, weibo_ak_list_1):
|
||||
assert(weibo.get_tags(weibo_ak_list_1) == ['明日方舟', '音律联觉'])
|
||||
def test_tag(weibo, weibo_ak_list_1):
|
||||
raw_post = weibo_ak_list_1['data']['cards'][0]
|
||||
assert(weibo.get_tags(raw_post) == ['明日方舟', '音律联觉'])
|
||||
|
Loading…
x
Reference in New Issue
Block a user