-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #35 from Jim137/develop_fix
Add test files
- Loading branch information
Showing
14 changed files
with
308 additions
and
237 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,46 @@ | ||
name: Test | ||
|
||
on: | ||
pull_request: | ||
push: | ||
branches: | ||
- master | ||
|
||
jobs: | ||
lint_and_test: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python-version: ['3.8', '3.9', '3.10', '3.11'] | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
submodules: recursive | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Set Variables | ||
id: set_variables | ||
shell: bash | ||
run: | | ||
echo "PY=$(python -c 'import hashlib, sys;print(hashlib.sha256(sys.version.encode()+sys.executable.encode()).hexdigest())')" >> $GITHUB_OUTPUT | ||
echo "PIP_CACHE=$(pip cache dir)" >> $GITHUB_OUTPUT | ||
- name: Cache PIP | ||
uses: actions/cache@v3 | ||
with: | ||
path: ${{ steps.set_variables.outputs.PIP_CACHE }} | ||
key: ${{ runner.os }}-pip-${{ steps.set_variables.outputs.PY }} | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install -r requirements.txt | ||
pip install flake8 | ||
- name: Lint with flake8 | ||
run: | | ||
# stop the build if there are Python syntax errors or undefined names | ||
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics | ||
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide | ||
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics --per-file-ignores="paifulogger/log.py:C901,F401,F403,F405,E501 paifulogger/src/__init__.py:F401 test/test.py:E402" --exclude mjlog2mjai | ||
- name: Test with test | ||
run: python ./test/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 |
---|---|---|
@@ -1,48 +1,7 @@ | ||
import argparse | ||
import sys | ||
|
||
from paifulogger import log | ||
|
||
|
||
def main(): | ||
parser = argparse.ArgumentParser() | ||
parser.add_argument("url", | ||
nargs='*', | ||
help="URL of the match.") | ||
parser.add_argument("-l", | ||
"--lang", | ||
type=str, | ||
help="Language of the program and output files. Default is English. Available languages: English(en), 繁體中文(zh_tw), 简体中文(zh), 日本語(ja).") | ||
parser.add_argument("-f", | ||
"--format", | ||
type=str, | ||
help="Format of the output file. Default is xlsx. Available formats: xlsx, html.", | ||
choices=['xlsx', 'html']) | ||
parser.add_argument("-a", | ||
"--all-formats", | ||
action="store_true", | ||
help="Output all formats.") | ||
parser.add_argument("-r", | ||
"--remake", | ||
action="store_true", | ||
help="Remake the log file from url_log.h5 (past logging log). Use this when the program is updated, changing format or language of the log file, or the log file is missing. Note that this will overwrite the log file.") | ||
parser.add_argument("-o", | ||
"--output", | ||
type=str, | ||
help="Output directory. Default is './'.") | ||
parser.add_argument("-v", | ||
"--version", | ||
action="store_true", | ||
help="Show version of the program. If this is used, all other arguments will be ignored and the program will be closed.") | ||
parser.add_argument("--mjai", | ||
action="store_true", | ||
help="Output MJAI format paifu.") | ||
# Args for Debugging | ||
parser.add_argument("--ignore-duplicated", | ||
action="store_true", | ||
help=argparse.SUPPRESS) | ||
args = parser.parse_args() | ||
log.log(args) | ||
|
||
|
||
if __name__ == '__main__': | ||
main() | ||
if __name__ == "__main__": | ||
sys.exit(log.main()) |
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 |
---|---|---|
@@ -1,48 +1,7 @@ | ||
import argparse | ||
import sys | ||
|
||
from paifulogger import log | ||
|
||
|
||
def main(): | ||
parser = argparse.ArgumentParser() | ||
parser.add_argument("url", | ||
nargs='*', | ||
help="URL of the match.") | ||
parser.add_argument("-l", | ||
"--lang", | ||
type=str, | ||
help="Language of the program and output files. Default is English. Available languages: English(en), 繁體中文(zh_tw), 简体中文(zh), 日本語(ja).") | ||
parser.add_argument("-f", | ||
"--format", | ||
type=str, | ||
help="Format of the output file. Default is xlsx. Available formats: xlsx, html.", | ||
choices=['xlsx', 'html']) | ||
parser.add_argument("-a", | ||
"--all-formats", | ||
action="store_true", | ||
help="Output all formats.") | ||
parser.add_argument("-r", | ||
"--remake", | ||
action="store_true", | ||
help="Remake the log file from url_log.h5 (past logging log). Use this when the program is updated, changing format or language of the log file, or the log file is missing. Note that this will overwrite the log file.") | ||
parser.add_argument("-o", | ||
"--output", | ||
type=str, | ||
help="Output directory. Default is './'.") | ||
parser.add_argument("-v", | ||
"--version", | ||
action="store_true", | ||
help="Show version of the program. If this is used, all other arguments will be ignored and the program will be closed.") | ||
parser.add_argument("--mjai", | ||
action="store_true", | ||
help="Output MJAI format paifu.") | ||
# Args for Debugging | ||
parser.add_argument("--ignore-duplicated", | ||
action="store_true", | ||
help=argparse.SUPPRESS) | ||
args = parser.parse_args() | ||
log.log(args) | ||
|
||
|
||
if __name__ == '__main__': | ||
main() | ||
if __name__ == "__main__": | ||
sys.exit(log.main()) |
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
Oops, something went wrong.