Skip to content

Commit

Permalink
add github actions for tests (#17)
Browse files Browse the repository at this point in the history
  • Loading branch information
njzjz authored Sep 13, 2022
1 parent 85d770b commit 36f0c0f
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 8 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Python package

on:
- push
- pull_request

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3
- run: pip install .[test] coverage
- name: Test
run: coverage run --source=./dargs -m unittest -v && coverage report
- uses: codecov/codecov-action@v3
Empty file added tests/__init__.py
Empty file.
4 changes: 2 additions & 2 deletions tests/dpmdargs.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from context import dargs
from .context import dargs
from dargs import dargs, Argument, Variant

ACTIVATION_FN_DICT = {
Expand Down Expand Up @@ -615,4 +615,4 @@ def normalize(data):
if __name__ == "__main__":
import json
data = json.loads(example_json_str)
normalize(data)
normalize(data)
2 changes: 1 addition & 1 deletion tests/test_checker.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from context import dargs
from .context import dargs
import unittest
from dargs import Argument, Variant
from dargs.dargs import ArgumentKeyError, ArgumentTypeError, ArgumentValueError
Expand Down
2 changes: 1 addition & 1 deletion tests/test_creation.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from context import dargs
from .context import dargs
import unittest
from dargs import Argument, Variant

Expand Down
4 changes: 2 additions & 2 deletions tests/test_docgen.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from context import dargs
from .context import dargs
import unittest
import json
from dargs import Argument, Variant, ArgumentEncoder
Expand Down Expand Up @@ -119,7 +119,7 @@ def test_multi_variants(self):

def test_dpmd(self):
from dargs import dargs
from dpmdargs import gen_doc
from .dpmdargs import gen_doc
dargs.RAW_ANCHOR = False
docstr = gen_doc(make_anchor=True, make_link=True)
# print("\n\n"+docstr)
Expand Down
4 changes: 2 additions & 2 deletions tests/test_normalizer.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from context import dargs
from .context import dargs
import unittest
from dargs import Argument, Variant

Expand Down Expand Up @@ -118,7 +118,7 @@ def test_complicated(self):

def test_dpmd(self):
import json
from dpmdargs import normalize, example_json_str
from .dpmdargs import normalize, example_json_str
data = json.loads(example_json_str)
normalize(data)

Expand Down

0 comments on commit 36f0c0f

Please sign in to comment.