Skip to content

Commit 6551072

Browse files
committed
Add integration tests
1 parent 7e3e026 commit 6551072

File tree

33 files changed

+933
-4
lines changed

33 files changed

+933
-4
lines changed

.flake8

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
[flake8]
2+
doctests = True
3+
ignore =
4+
# W503 and W504 are mutually exclusive, so one or the other must be ignored.
5+
# PEP 8 recommends line break before, so we keep W504.
6+
W503
7+
max-complexity = 10
8+
max-line-length = 120
9+
select = E,W,F,C,N

.github/workflows/lint-python.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Lint Python code
2+
3+
on:
4+
push:
5+
paths:
6+
- "**.py"
7+
- ".flake8"
8+
- "pyproject.toml"
9+
- "Taskfile.yml"
10+
pull_request:
11+
paths:
12+
- "**.py"
13+
- ".flake8"
14+
- "pyproject.toml"
15+
- "Taskfile.yml"
16+
17+
jobs:
18+
lint-python:
19+
runs-on: ubuntu-latest
20+
21+
steps:
22+
- name: Checkout
23+
uses: actions/checkout@v2
24+
25+
- name: Install Taskfile
26+
uses: arduino/actions/setup-taskfile@master
27+
with:
28+
repo-token: ${{ secrets.GITHUB_TOKEN }}
29+
version: 3.x
30+
31+
- name: Install Python
32+
uses: actions/setup-python@v2
33+
with:
34+
python-version: "3.8"
35+
36+
- name: Install Poetry
37+
run: pip install poetry
38+
39+
- name: Lint Python files
40+
run: task python:check

.github/workflows/test.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ on:
99
- "go.sum"
1010
- "**/*.go"
1111
- "**/testdata/**"
12+
- "pyproject.toml"
13+
- "test/**"
14+
- "Taskfile.yml"
1215
pull_request:
1316
paths:
1417
- ".github/workflows/test.yml"
@@ -17,6 +20,9 @@ on:
1720
- "go.sum"
1821
- "**/*.go"
1922
- "**/testdata/**"
23+
- "pyproject.toml"
24+
- "test/**"
25+
- "Taskfile.yml"
2026

2127
jobs:
2228
test-go:
@@ -49,3 +55,14 @@ jobs:
4955

5056
- name: Run unit tests
5157
run: task go:test-unit
58+
59+
- name: Install Python
60+
uses: actions/setup-python@v2
61+
with:
62+
python-version: "3.8"
63+
64+
- name: Install Poetry
65+
run: pip install poetry
66+
67+
- name: Run integration tests
68+
run: task test-integration

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Build artifacts
22
arduino-check
33
arduino-check.exe
4+
__pycache__/
45

56
# Test artifacts
67
coverage_unit.txt

Taskfile.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,20 @@ tasks:
1010
desc: Run tests
1111
cmds:
1212
- task: go:test-unit
13+
- task: test-integration
1314
- task: schema:compile
1415

1516
go:test-unit:
1617
desc: Run unit tests
1718
cmds:
1819
- go test -short -run '{{ default ".*" .TEST_REGEX }}' {{ default "-v" .GOFLAGS }} -coverprofile=coverage_unit.txt {{ default .DEFAULT_PACKAGES .PACKAGES }}
1920

21+
test-integration:
22+
desc: Run integration tests
23+
cmds:
24+
- poetry install --no-root
25+
- poetry run pytest test
26+
2027
schema:compile:
2128
desc: Compile JSON schema
2229
cmds:
@@ -26,6 +33,7 @@ tasks:
2633
desc: Lint and check formatting of all files
2734
cmds:
2835
- task: go:check
36+
- task: python:check
2937
- task: docs:check
3038
- task: config:check
3139
- task: check-spelling
@@ -34,6 +42,7 @@ tasks:
3442
desc: Lint all files
3543
cmds:
3644
- task: go:lint
45+
- task: python:lint
3746
- task: docs:lint
3847
- task: config:lint
3948

@@ -48,6 +57,7 @@ tasks:
4857
desc: Format all files
4958
cmds:
5059
- task: go:format
60+
- task: python:format
5161
- task: docs:format
5262
- task: config:format
5363

@@ -78,6 +88,22 @@ tasks:
7888
cmds:
7989
- go fmt {{ default .DEFAULT_PACKAGES .PACKAGES }}
8090

91+
python:check:
92+
cmds:
93+
- task: python:lint
94+
95+
python:lint:
96+
desc: Lint Python code
97+
cmds:
98+
- poetry install --no-root
99+
- poetry run flake8
100+
101+
python:format:
102+
desc: Automatically formats Python files
103+
cmds:
104+
- poetry install --no-root
105+
- poetry run black .
106+
81107
docs:check:
82108
desc: Lint and check formatting of documentation files
83109
cmds:

0 commit comments

Comments
 (0)