Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 88632d3

Browse files
authored
Merge pull request #101 from arduino/per1234/integration-tests
Add integration tests
2 parents 4602827 + c105d0f commit 88632d3

File tree

34 files changed

+944
-5
lines changed

34 files changed

+944
-5
lines changed

‎.editorconfig‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@ trim_trailing_whitespace = true
1111
indent_style = tab
1212
indent_size = 4
1313

14-
[*.yml,*.yaml]
14+
[*.{yml,yaml}]
1515
indent_style = space
1616
indent_size = 2

‎.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
@@ -10,6 +10,9 @@ on:
1010
- "**/*.go"
1111
- "**/testdata/**"
1212
- "etc/schemas/**/*.json"
13+
- "pyproject.toml"
14+
- "test/**"
15+
- "Taskfile.yml"
1316
pull_request:
1417
paths:
1518
- ".github/workflows/test.yml"
@@ -19,6 +22,9 @@ on:
1922
- "**/*.go"
2023
- "**/testdata/**"
2124
- "etc/schemas/**/*.json"
25+
- "pyproject.toml"
26+
- "test/**"
27+
- "Taskfile.yml"
2228

2329
jobs:
2430
test-go:
@@ -57,3 +63,14 @@ jobs:
5763

5864
- name: Run unit tests
5965
run: task go:test-unit
66+
67+
- name: Install Python
68+
uses: actions/setup-python@v2
69+
with:
70+
python-version: "3.8"
71+
72+
- name: Install Poetry
73+
run: pip install poetry
74+
75+
- name: Run integration tests
76+
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-lint
33
arduino-lint.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,6 +10,7 @@ tasks:
1010
desc: Run tests
1111
cmds:
1212
- task: go:test-unit
13+
- task: test-integration
1314
- task: schema:compile
1415

1516
go:generate:
@@ -27,6 +28,12 @@ tasks:
2728
cmds:
2829
- go test -short -run '{{ default ".*" .TEST_REGEX }}' {{ default "-v" .GOFLAGS }} -coverprofile=coverage_unit.txt {{ default .DEFAULT_PACKAGES .PACKAGES }}
2930

31+
test-integration:
32+
desc: Run integration tests
33+
cmds:
34+
- poetry install --no-root
35+
- poetry run pytest test
36+
3037
schema:compile:
3138
desc: Compile JSON schema
3239
cmds:
@@ -36,6 +43,7 @@ tasks:
3643
desc: Lint and check formatting of all files
3744
cmds:
3845
- task: go:check
46+
- task: python:check
3947
- task: docs:check
4048
- task: config:check
4149
- task: check-spelling
@@ -44,6 +52,7 @@ tasks:
4452
desc: Lint all files
4553
cmds:
4654
- task: go:lint
55+
- task: python:lint
4756
- task: docs:lint
4857
- task: config:lint
4958

@@ -58,6 +67,7 @@ tasks:
5867
desc: Format all files
5968
cmds:
6069
- task: go:format
70+
- task: python:format
6171
- task: docs:format
6272
- task: config:format
6373

@@ -88,6 +98,22 @@ tasks:
8898
cmds:
8999
- gofmt -l -w {{ default .DEFAULT_PATHS .PATHS }}
90100

101+
python:check:
102+
cmds:
103+
- task: python:lint
104+
105+
python:lint:
106+
desc: Lint Python code
107+
cmds:
108+
- poetry install --no-root
109+
- poetry run flake8
110+
111+
python:format:
112+
desc: Automatically formats Python files
113+
cmds:
114+
- poetry install --no-root
115+
- poetry run black .
116+
91117
docs:check:
92118
desc: Lint and check formatting of documentation files
93119
cmds:

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /