mirror of
https://github.com/mvt-project/mvt.git
synced 2026-10-02 22:16:58 +02:00
Make the test suite pass on Windows
The Filesystem module stored the paths of an iOS dump with the separator of the system checking it, so on Windows the process and file path indicators, which split paths on "/", never matched. It now stores them as POSIX paths. The rest are test fixes: - the completion install tests also redirect USERPROFILE, which Path.home() reads on Windows; they wrote to the real home folder; - the plugin table helpers accept the light header Rich draws on consoles that cannot show the heavy one; - the completion test quotes the command path, whose backslashes were dropped when COMP_WORDS was split; - tests that need symbolic links or the sqlite3 binary are skipped when those are not available; - two assertions no longer depend on the path separator or on the line ending text mode writes.
This commit is contained in:
1 parent
777db67291
commit
99b3b5f014
8 files changed
+34
-14
No files matched your search
@@ -1,3 +1,4 @@
|
||||
import shlex
|
||||
from types import SimpleNamespace
|
||||
|
||||
import click
|
||||
@@ -110,7 +111,7 @@ def test_load_command_option_supports_folders_and_repeated_paths(tmp_path):
|
||||
def test_loaded_command_participates_in_shell_completion(tmp_path):
|
||||
command_path = _write_command(tmp_path / "hello.py", "hello")
|
||||
group = _make_group()
|
||||
words = f"group --load-command {command_path} he"
|
||||
words = f"group --load-command {shlex.quote(str(command_path))} he"
|
||||
|
||||
result = CliRunner().invoke(
|
||||
group,
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import json
|
||||
import re
|
||||
from types import SimpleNamespace
|
||||
|
||||
import pytest
|
||||
@@ -54,20 +55,23 @@ def _run(command, arguments):
|
||||
return CliRunner().invoke(command, arguments, env={"COLUMNS": "200"})
|
||||
|
||||
|
||||
def _table_rows(output):
|
||||
"""Return the content of the table rows, without the header and the box."""
|
||||
def _table_lines(output):
|
||||
"""Return the cells of each line of the table, header first."""
|
||||
return [
|
||||
[cell.strip() for cell in line.strip().strip("│").split("│")]
|
||||
[cell.strip() for cell in re.split("[│┃]", line.strip().strip("│┃"))]
|
||||
for line in output.splitlines()
|
||||
if "│" in line
|
||||
if "│" in line or "┃" in line
|
||||
]
|
||||
|
||||
|
||||
def _table_rows(output):
|
||||
"""Return the content of the table rows, without the header and the box."""
|
||||
return _table_lines(output)[1:]
|
||||
|
||||
|
||||
def _table_header(output):
|
||||
for line in output.splitlines():
|
||||
if "┃" in line:
|
||||
return [cell.strip() for cell in line.strip().strip("┃").split("┃")]
|
||||
return []
|
||||
lines = _table_lines(output)
|
||||
return lines[0] if lines else []
|
||||
|
||||
|
||||
def _install(monkeypatch, distributions, entry_points):
|
||||
|
||||
Reference in new issue
Block a user