Skip to content

De-parallelize integration test #1744

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 31, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions test/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand All @@ -144,7 +144,7 @@ def _run(cmd: list, custom_working_dir=None, custom_env=None):
# 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

Expand Down
4 changes: 1 addition & 3 deletions test/pytest.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 2 additions & 2 deletions test/test_board.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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()]
Expand Down
6 changes: 3 additions & 3 deletions test/test_completion.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"])
Expand Down
10 changes: 5 additions & 5 deletions test/test_lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand All @@ -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)
Expand Down Expand Up @@ -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)
Expand All @@ -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

Expand Down Expand Up @@ -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)
Expand Down