Skip to content
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
17 changes: 5 additions & 12 deletions test/unit/test_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -438,16 +438,14 @@ def test_tuxmake_directory(tmp_path, run):

tuxmake_build = tmp_path / "build"
tuxmake_build.mkdir()
(tuxmake_build / "metadata.json").write_text(
"""
(tuxmake_build / "metadata.json").write_text("""
{
"results": {
"artifacts": {"kernel": ["bzImage"], "modules": ["modules.tar.xz"]}
},
"build": {"target_arch": "x86_64"}
}
"""
)
""")

tux = tuxmake_directory(tuxmake_build)
assert tux.kernel == f"file://{tuxmake_build}/bzImage"
Expand All @@ -461,16 +459,14 @@ def test_no_modules(tmp_path):

tuxmake_build = tmp_path / "build"
tuxmake_build.mkdir()
(tuxmake_build / "metadata.json").write_text(
"""
(tuxmake_build / "metadata.json").write_text("""
{
"results": {
"artifacts": {"kernel": ["bzImage"]}
},
"build": {"target_arch": "x86_64"}
}
"""
)
""")

tux = tuxmake_directory(tuxmake_build)
assert tux.modules == []
Expand Down Expand Up @@ -614,9 +610,7 @@ def test_update_cache(mocker, monkeypatch, capsys):
with pytest.raises(SystemExit):
main()
stdout, stderr = capsys.readouterr()
assert (
stdout
== """Updating local cache:
assert stdout == """Updating local cache:
* Rootfs:
* avh-imx93
* avh-rpi4b
Expand All @@ -643,7 +637,6 @@ def test_update_cache(mocker, monkeypatch, capsys):
* qemu-x86_64
* Test definitions
"""
)


def test_save_results_json(tuxrun_args, lava_run, mocker, tmp_path):
Expand Down
20 changes: 4 additions & 16 deletions test/unit/test_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@ def test_write_log_file(tmp_path):
encoding="utf-8"
) == '{"lvl": "info", "msg": "Hello, world", "dt": "2021-04-08T18:42:25.139513"}\n'

assert (
html_file.read_text(encoding="utf-8")
== """<!DOCTYPE html>
assert html_file.read_text(encoding="utf-8") == """<!DOCTYPE html>
<html lang="en">
<head>
<title>TuxTest log</title>
Expand All @@ -40,7 +38,6 @@ def test_write_log_file(tmp_path):
</pre>
</body>
</html>"""
)
assert text_file.read_text(encoding="utf-8") == ""


Expand Down Expand Up @@ -70,9 +67,7 @@ def test_write_stdout_logs(capsys, tmp_path):
yaml_file.read_text(encoding="utf-8")
== """- {"lvl": "info", "msg": "Hello, world", "dt": "2021-04-08T18:42:25.139513"}\n"""
)
assert (
html_file.read_text(encoding="utf-8")
== """<!DOCTYPE html>
assert html_file.read_text(encoding="utf-8") == """<!DOCTYPE html>
<html lang="en">
<head>
<title>TuxTest log</title>
Expand All @@ -95,7 +90,6 @@ def test_write_stdout_logs(capsys, tmp_path):
</pre>
</body>
</html>"""
)
assert text_file.read_text(encoding="utf-8") == ""


Expand Down Expand Up @@ -125,9 +119,7 @@ def test_write_stdout_feedback_logs(capsys, tmp_path):
yaml_file.read_text(encoding="utf-8")
== """- {"lvl": "feedback", "msg": "Hello, world", "dt": "2021-04-08T18:42:25.139513", "ns": "testing"}\n"""
)
assert (
html_file.read_text(encoding="utf-8")
== """<!DOCTYPE html>
assert html_file.read_text(encoding="utf-8") == """<!DOCTYPE html>
<html lang="en">
<head>
<title>TuxTest log</title>
Expand All @@ -151,7 +143,6 @@ def test_write_stdout_feedback_logs(capsys, tmp_path):
</pre>
</body>
</html>"""
)
assert text_file.read_text(encoding="utf-8") == "<testing> Hello, world\n"


Expand All @@ -164,14 +155,11 @@ def test_writer_invalid_yaml(capsys, tmpdir):
writer.write(data)
writer.write("{hello: world}")
out, err = capsys.readouterr()
assert (
out
== """{
assert out == """{
hello world
{}
{hello: world}
"""
)
assert err == ""
assert (tmpdir / "logs").read_text(
encoding="utf-8"
Expand Down
1 change: 1 addition & 0 deletions tuxrun/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@
"""
Command line tool for testing Linux under QEMU
"""

__version__ = "1.4.0"
2 changes: 1 addition & 1 deletion tuxrun/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ def run(options, tmpdir: Path, cache_dir: Optional[Path], artefacts: dict) -> in
] + extra_assets:
ro = True
if isinstance(path, tuple):
(path, ro) = path
path, ro = path
if not path:
continue
if urlparse(path).scheme == "file":
Expand Down
2 changes: 1 addition & 1 deletion tuxrun/runtimes.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ def cmd(self, args):
srcs = set()
dsts = set()
for binding in self.__bindings__:
(src, dst, ro, device) = binding
src, dst, ro, device = binding
if src in srcs:
LOG.error("Duplicated mount source %r", src)
raise Exception("Duplicated mount source %r" % src)
Expand Down
1 change: 0 additions & 1 deletion tuxrun/templates/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

import jinja2


BASE = (Path(__file__) / "..").resolve()


Expand Down
1 change: 0 additions & 1 deletion tuxrun/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
from tuxrun import requests, xdg
from tuxrun.yaml import yaml_load


DEFAULT_DISPATCHER_DOWNLOAD_DIR = "/var/lib/lava/dispatcher/tmp"


Expand Down