Skip to content

Commit aba6a78

Browse files
cmaglieumbynos
andauthored
[ski-changelog] De-parallelize integration test (#1744)
* De-parallelize and increase verbosity of integration tests * Hide output of some test Otherwise Windows runners may raise this exception: E UnicodeEncodeError: 'charmap' codec can't encode characters in position 890-897: character maps to <undefined> * Update test/pytest.ini Co-authored-by: Umberto Baldi <[email protected]> Co-authored-by: Umberto Baldi <[email protected]>
1 parent 5f9c126 commit aba6a78

File tree

5 files changed

+13
-15
lines changed

5 files changed

+13
-15
lines changed

Diff for: test/conftest.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ def run_command(pytestconfig, data_dir, downloads_dir, working_dir):
124124
}
125125
(Path(data_dir) / "packages").mkdir(exist_ok=True)
126126

127-
def _run(cmd: list, custom_working_dir=None, custom_env=None):
127+
def _run(cmd: list, custom_working_dir=None, custom_env=None, hide=False):
128128
if cmd is None:
129129
cmd = []
130130
quoted_cmd = [f'"{t}"' for t in cmd]
@@ -144,7 +144,7 @@ def _run(cmd: list, custom_working_dir=None, custom_env=None):
144144
# It escapes spaces in the path using "\ " but it doesn't always work,
145145
# wrapping the path in quotation marks is the safest approach
146146
with run_context.prefix(f'{cd_command} "{custom_working_dir}"'):
147-
return run_context.run(cli_full_line, echo=False, hide=True, warn=True, env=custom_env, encoding="utf-8")
147+
return run_context.run(cli_full_line, echo=True, hide=hide, warn=True, env=custom_env, encoding="utf-8")
148148

149149
return _run
150150

Diff for: test/pytest.ini

+1-3
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,5 @@ markers =
1111
# -s to disable per-test capture
1212
# --verbose is what is says it is
1313
# --tb=long sets the length of the traceback in case of failures
14-
# -n=auto sets the numbers of parallel processes to use
15-
# --dist=loadfile distributes the tests in the parallel processes dividing them per file
1614
# See https://pypi.org/project/pytest-xdist/#parallelization for more info on parallelization
17-
addopts = -x -s --verbose --tb=long -n=auto --dist=loadfile
15+
addopts = -x -s --verbose --tb=long

Diff for: test/test_board.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -516,7 +516,7 @@ def test_board_details_list_programmers_without_flag(run_command):
516516
run_command(["core", "update-index"])
517517
# Download samd core pinned to 1.8.6
518518
run_command(["core", "install", "arduino:[email protected]"])
519-
result = run_command(["board", "details", "-b", "arduino:samd:nano_33_iot"])
519+
result = run_command(["board", "details", "-b", "arduino:samd:nano_33_iot"], hide=True)
520520
assert result.ok
521521
lines = [l.strip().split() for l in result.stdout.splitlines()]
522522
assert ["Programmers:", "Id", "Name"] in lines
@@ -529,7 +529,7 @@ def test_board_details_list_programmers_flag(run_command):
529529
run_command(["core", "update-index"])
530530
# Download samd core pinned to 1.8.6
531531
run_command(["core", "install", "arduino:[email protected]"])
532-
result = run_command(["board", "details", "-b", "arduino:samd:nano_33_iot", "--list-programmers"])
532+
result = run_command(["board", "details", "-b", "arduino:samd:nano_33_iot", "--list-programmers"], hide=True)
533533
assert result.ok
534534

535535
lines = [l.strip() for l in result.stdout.splitlines()]

Diff for: test/test_completion.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -135,11 +135,11 @@ def test_config_completion(run_command):
135135
# here we test if the completions coming from the libs are working
136136
def test_lib_completion(run_command):
137137
assert run_command(["lib", "update-index"])
138-
result = run_command(["__complete", "lib", "install", ""])
138+
result = run_command(["__complete", "lib", "install", ""], hide=True)
139139
assert "WiFi101" in result.stdout
140-
result = run_command(["__complete", "lib", "download", ""])
140+
result = run_command(["__complete", "lib", "download", ""], hide=True)
141141
assert "WiFi101" in result.stdout
142-
result = run_command(["__complete", "lib", "uninstall", ""])
142+
result = run_command(["__complete", "lib", "uninstall", ""], hide=True)
143143
assert "WiFi101" not in result.stdout # not yet installed
144144

145145
assert run_command(["lib", "install", "WiFi101"])

Diff for: test/test_lib.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def test_list(run_command):
5858
assert result.ok
5959
assert "" == result.stderr
6060
assert "No libraries installed." in result.stdout.strip()
61-
result = run_command(["lib", "list", "--format", "json"])
61+
result = run_command(["lib", "list", "--format", "json"], hide=True)
6262
assert result.ok
6363
assert "" == result.stderr
6464
assert 0 == len(json.loads(result.stdout))
@@ -83,7 +83,7 @@ def test_list(run_command):
8383
assert "An efficient and elegant JSON library..." == toks[4]
8484

8585
# Look at the JSON output
86-
result = run_command(["lib", "list", "--format", "json"])
86+
result = run_command(["lib", "list", "--format", "json"], hide=True)
8787
assert result.ok
8888
assert "" == result.stderr
8989
data = json.loads(result.stdout)
@@ -159,7 +159,7 @@ def test_list_with_fqbn(run_command):
159159
assert "ArduinoJson" == toks[0]
160160

161161
# Look at the JSON output
162-
result = run_command(["lib", "list", "-b", "arduino:avr:uno", "--format", "json"])
162+
result = run_command(["lib", "list", "-b", "arduino:avr:uno", "--format", "json"], hide=True)
163163
assert result.ok
164164
assert "" == result.stderr
165165
data = json.loads(result.stdout)
@@ -180,7 +180,7 @@ def test_list_provides_includes_fallback(run_command):
180180
assert run_command(["lib", "install", "[email protected]"])
181181

182182
# List all libraries, even the ones installed with the above core
183-
result = run_command(["lib", "list", "--all", "--fqbn", "arduino:avr:uno", "--format", "json"])
183+
result = run_command(["lib", "list", "--all", "--fqbn", "arduino:avr:uno", "--format", "json"], hide=True)
184184
assert result.ok
185185
assert "" == result.stderr
186186

@@ -545,7 +545,7 @@ def test_lib_list_with_updatable_flag(run_command):
545545
assert "An efficient and elegant JSON library..." == line[4]
546546

547547
# Look at the JSON output
548-
res = run_command(["lib", "list", "--updatable", "--format", "json"])
548+
res = run_command(["lib", "list", "--updatable", "--format", "json"], hide=True)
549549
assert res.ok
550550
assert "" == res.stderr
551551
data = json.loads(res.stdout)

0 commit comments

Comments
 (0)