-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: unit test for client module (#15)
###Summary 1. Unit test for client module 2. fix a bug of initialize response processor 3. error handling for invalid api key error in threads pool ###Checklist * [x]Does your PR title have the correct title format? * Does your PR have a breaking change?: no
- Loading branch information
1 parent
887d1ee
commit 0cdb0b4
Showing
17 changed files
with
388 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
name: Publish to PyPI | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
dryRun: | ||
description: 'Do a dry run to preview instead of a real release' | ||
required: true | ||
default: 'true' | ||
|
||
jobs: | ||
authorize: | ||
name: Authorize | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: ${{ github.actor }} permission check to do a release | ||
uses: "lannonbr/repo-permission-check-action@2.0.2" | ||
with: | ||
permission: "write" | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
build-n-publish: | ||
name: Build and publish to PyPI | ||
runs-on: ubuntu-latest | ||
needs: [authorize] | ||
steps: | ||
- name: Checkout for release to PyPI | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Python 3.7 | ||
uses: actions/setup-python@v3 | ||
with: | ||
python-version: 3.7 | ||
|
||
- name: Run Test | ||
run: python -m unittest discover -s ./src -p 'test_*.py' | ||
|
||
- name: Publish distribution PyPI --dry-run | ||
if: ${{ github.event.inputs.dryRun == 'true'}} | ||
run: | | ||
python -m pip install python-semantic-release | ||
semantic-release publish --noop | ||
- name: Publish distribution PyPI | ||
if: ${{ github.event.inputs.dryRun == 'false'}} | ||
uses: relekang/python-semantic-release@master | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
repository_username: __token__ | ||
repository_password: ${{ secrets.PYPI_API_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
name: Unit Test | ||
|
||
on: [pull_request] | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python-version: [ "3.6" ] | ||
steps: | ||
- name: Checkout source code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v3 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Unit Test | ||
run: python -m unittest discover -s ./src -p 'test_*.py' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -134,3 +134,4 @@ dmypy.json | |
# Local system files | ||
.DS_Store | ||
.vscode/ | ||
buildandupload.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,3 +17,4 @@ def callback_fun(event, code, message): | |
} | ||
client.track(event) | ||
client.flush() | ||
client.shutdown() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
[tool.semantic_release] | ||
version_variable = [ | ||
"src/amplitude/constants.py:SDK_VERSION" | ||
] | ||
major_on_zero = true | ||
branch = "main" | ||
upload_to_PyPI = true | ||
upload_to_release = true | ||
build_command = "pip install build && python -m build" | ||
version_source = "commit" | ||
commit_version_number = true | ||
commit_subject = "chore(release): Bump version to {version}" | ||
commit_message = "chore(release): Bump version to {version}" | ||
commit_author = "amplitude-sdk-bot <amplitude-sdk-bot@users.noreply.github.com>" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.