Unverified Commit aba6a789 authored by Cristian Maglie's avatar Cristian Maglie Committed by GitHub

[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: default avatarUmberto Baldi <34278123+umbynos@users.noreply.github.com>
Co-authored-by: default avatarUmberto Baldi <34278123+umbynos@users.noreply.github.com>
parent 5f9c1266
......@@ -124,7 +124,7 @@ def run_command(pytestconfig, data_dir, downloads_dir, working_dir):
}
(Path(data_dir) / "packages").mkdir(exist_ok=True)
def _run(cmd: list, custom_working_dir=None, custom_env=None):
def _run(cmd: list, custom_working_dir=None, custom_env=None, hide=False):
if cmd is None:
cmd = []
quoted_cmd = [f'"{t}"' for t in cmd]
......@@ -144,7 +144,7 @@ def run_command(pytestconfig, data_dir, downloads_dir, working_dir):
# It escapes spaces in the path using "\ " but it doesn't always work,
# wrapping the path in quotation marks is the safest approach
with run_context.prefix(f'{cd_command} "{custom_working_dir}"'):
return run_context.run(cli_full_line, echo=False, hide=True, warn=True, env=custom_env, encoding="utf-8")
return run_context.run(cli_full_line, echo=True, hide=hide, warn=True, env=custom_env, encoding="utf-8")
return _run
......
......@@ -11,7 +11,5 @@ markers =
# -s to disable per-test capture
# --verbose is what is says it is
# --tb=long sets the length of the traceback in case of failures
# -n=auto sets the numbers of parallel processes to use
# --dist=loadfile distributes the tests in the parallel processes dividing them per file
# See https://pypi.org/project/pytest-xdist/#parallelization for more info on parallelization
addopts = -x -s --verbose --tb=long -n=auto --dist=loadfile
addopts = -x -s --verbose --tb=long
......@@ -516,7 +516,7 @@ def test_board_details_list_programmers_without_flag(run_command):
run_command(["core", "update-index"])
# Download samd core pinned to 1.8.6
run_command(["core", "install", "arduino:samd@1.8.6"])
result = run_command(["board", "details", "-b", "arduino:samd:nano_33_iot"])
result = run_command(["board", "details", "-b", "arduino:samd:nano_33_iot"], hide=True)
assert result.ok
lines = [l.strip().split() for l in result.stdout.splitlines()]
assert ["Programmers:", "Id", "Name"] in lines
......@@ -529,7 +529,7 @@ def test_board_details_list_programmers_flag(run_command):
run_command(["core", "update-index"])
# Download samd core pinned to 1.8.6
run_command(["core", "install", "arduino:samd@1.8.6"])
result = run_command(["board", "details", "-b", "arduino:samd:nano_33_iot", "--list-programmers"])
result = run_command(["board", "details", "-b", "arduino:samd:nano_33_iot", "--list-programmers"], hide=True)
assert result.ok
lines = [l.strip() for l in result.stdout.splitlines()]
......
......@@ -135,11 +135,11 @@ def test_config_completion(run_command):
# here we test if the completions coming from the libs are working
def test_lib_completion(run_command):
assert run_command(["lib", "update-index"])
result = run_command(["__complete", "lib", "install", ""])
result = run_command(["__complete", "lib", "install", ""], hide=True)
assert "WiFi101" in result.stdout
result = run_command(["__complete", "lib", "download", ""])
result = run_command(["__complete", "lib", "download", ""], hide=True)
assert "WiFi101" in result.stdout
result = run_command(["__complete", "lib", "uninstall", ""])
result = run_command(["__complete", "lib", "uninstall", ""], hide=True)
assert "WiFi101" not in result.stdout # not yet installed
assert run_command(["lib", "install", "WiFi101"])
......
......@@ -58,7 +58,7 @@ def test_list(run_command):
assert result.ok
assert "" == result.stderr
assert "No libraries installed." in result.stdout.strip()
result = run_command(["lib", "list", "--format", "json"])
result = run_command(["lib", "list", "--format", "json"], hide=True)
assert result.ok
assert "" == result.stderr
assert 0 == len(json.loads(result.stdout))
......@@ -83,7 +83,7 @@ def test_list(run_command):
assert "An efficient and elegant JSON library..." == toks[4]
# Look at the JSON output
result = run_command(["lib", "list", "--format", "json"])
result = run_command(["lib", "list", "--format", "json"], hide=True)
assert result.ok
assert "" == result.stderr
data = json.loads(result.stdout)
......@@ -159,7 +159,7 @@ def test_list_with_fqbn(run_command):
assert "ArduinoJson" == toks[0]
# Look at the JSON output
result = run_command(["lib", "list", "-b", "arduino:avr:uno", "--format", "json"])
result = run_command(["lib", "list", "-b", "arduino:avr:uno", "--format", "json"], hide=True)
assert result.ok
assert "" == result.stderr
data = json.loads(result.stdout)
......@@ -180,7 +180,7 @@ def test_list_provides_includes_fallback(run_command):
assert run_command(["lib", "install", "ArduinoJson@6.17.2"])
# List all libraries, even the ones installed with the above core
result = run_command(["lib", "list", "--all", "--fqbn", "arduino:avr:uno", "--format", "json"])
result = run_command(["lib", "list", "--all", "--fqbn", "arduino:avr:uno", "--format", "json"], hide=True)
assert result.ok
assert "" == result.stderr
......@@ -545,7 +545,7 @@ def test_lib_list_with_updatable_flag(run_command):
assert "An efficient and elegant JSON library..." == line[4]
# Look at the JSON output
res = run_command(["lib", "list", "--updatable", "--format", "json"])
res = run_command(["lib", "list", "--updatable", "--format", "json"], hide=True)
assert res.ok
assert "" == res.stderr
data = json.loads(res.stdout)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment