Skip to content

Commit

Permalink
chore(ci): add third party lib test
Browse files Browse the repository at this point in the history
  • Loading branch information
williamfzc committed Nov 26, 2023
1 parent 194b0a5 commit daf85e2
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,7 @@ jobs:
poetry run python3 examples/write.py
poetry run python3 examples/read.py
poetry run pytest
- name: Third Party Test
run: |
git clone https://github.com/axios/axios.git
poetry run python3 examples/for_axios.py
35 changes: 35 additions & 0 deletions examples/for_axios.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import pathlib
import sys
import warnings

from srctag.collector import Collector
from srctag.storage import Storage
from srctag.tagger import Tagger

axios_repo = pathlib.Path(__file__).parent.parent / "axios"
if not axios_repo.is_dir():
warnings.warn(f"clone axios to {axios_repo} first")
sys.exit(0)

collector = Collector()
collector.config.repo_root = axios_repo
collector.config.max_depth_limit = -1
collector.config.include_regex = r"lib.*"

ctx = collector.collect_metadata()
storage = Storage()
storage.embed_ctx(ctx)
tagger = Tagger()
tagger.config.tags = [
"XMLHttpRequests from browser",
"HTTP requests from node.js",
"Promise API support",
"Request and response interception",
"Request and response data transformation",
"Request cancellation",
"Automatic JSON data transforms",
"Automatic serialization of data objects",
"Client-side XSRF protection"
]
tag_dict = tagger.tag(storage)
print(tag_dict.scores_df.to_string(index=False))

0 comments on commit daf85e2

Please sign in to comment.