Skip to content

Commit 75d4b5d

Browse files
committed
Add integration tests for environment variable config
1 parent 2f5dd3b commit 75d4b5d

File tree

3 files changed

+48
-0
lines changed

3 files changed

+48
-0
lines changed

test/test_all.py

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,45 @@ def test_version(run_command):
178178
dateutil.parser.isoparse(output_list[1])
179179

180180

181+
def test_arduino_lint_official(run_command):
182+
project_path = test_data_path.joinpath("ARDUINO_LINT_OFFICIAL")
183+
184+
result = run_command(cmd=[project_path])
185+
assert not result.ok
186+
187+
result = run_command(cmd=[project_path], custom_env={"ARDUINO_LINT_OFFICIAL": "true"})
188+
assert result.ok
189+
190+
result = run_command(cmd=[project_path], custom_env={"ARDUINO_LINT_OFFICIAL": "false"})
191+
assert not result.ok
192+
193+
result = run_command(cmd=[project_path], custom_env={"ARDUINO_LINT_OFFICIAL": "foo"})
194+
assert not result.ok
195+
196+
197+
def test_arduino_lint_log_level(run_command):
198+
project_path = test_data_path.joinpath("ValidSketch")
199+
200+
result = run_command(cmd=[project_path], custom_env={"ARDUINO_LINT_LOG_LEVEL": "debug"})
201+
assert result.ok
202+
203+
result = run_command(cmd=[project_path], custom_env={"ARDUINO_LINT_LOG_LEVEL": "foo"})
204+
assert not result.ok
205+
206+
207+
def test_arduino_lint_log_format(run_command):
208+
project_path = test_data_path.joinpath("ValidSketch")
209+
210+
result = run_command(cmd=[project_path], custom_env={"ARDUINO_LINT_LOG_FORMAT": "text"})
211+
assert result.ok
212+
213+
result = run_command(cmd=[project_path], custom_env={"ARDUINO_LINT_LOG_FORMAT": "json"})
214+
assert result.ok
215+
216+
result = run_command(cmd=[project_path], custom_env={"ARDUINO_LINT_LOG_FORMAT": "foo"})
217+
assert not result.ok
218+
219+
181220
@pytest.fixture(scope="function")
182221
def run_command(pytestconfig, working_dir) -> typing.Callable[..., invoke.runners.Result]:
183222
"""Provide a wrapper around invoke's `run` API so that every test will work in the same temporary folder.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
name=Arduino_Lib
2+
version=1.0.0
3+
author=Cristian Maglie <[email protected]>, Pippo Pluto <[email protected]>
4+
maintainer=Cristian Maglie <[email protected]>
5+
sentence=A library that makes coding a Webserver a breeze.
6+
paragraph=Supports HTTP1.1 and you can do GET and POST.
7+
category=Communication
8+
url=http://example.com/
9+
architectures=avr

test/testdata/ARDUINO_LINT_OFFICIAL/Arduino_Lib/src/Arduino_Lib.h

Whitespace-only changes.

0 commit comments

Comments
 (0)