Skip to content

Commit 8d188ea

Browse files
authored
Merge pull request #41 from roxell/fix-stylecheck
Reformat code for black 26.1.0
2 parents 7af938f + 32ed191 commit 8d188ea

File tree

7 files changed

+12
-32
lines changed

7 files changed

+12
-32
lines changed

test/unit/test_main.py

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -438,16 +438,14 @@ def test_tuxmake_directory(tmp_path, run):
438438

439439
tuxmake_build = tmp_path / "build"
440440
tuxmake_build.mkdir()
441-
(tuxmake_build / "metadata.json").write_text(
442-
"""
441+
(tuxmake_build / "metadata.json").write_text("""
443442
{
444443
"results": {
445444
"artifacts": {"kernel": ["bzImage"], "modules": ["modules.tar.xz"]}
446445
},
447446
"build": {"target_arch": "x86_64"}
448447
}
449-
"""
450-
)
448+
""")
451449

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

462460
tuxmake_build = tmp_path / "build"
463461
tuxmake_build.mkdir()
464-
(tuxmake_build / "metadata.json").write_text(
465-
"""
462+
(tuxmake_build / "metadata.json").write_text("""
466463
{
467464
"results": {
468465
"artifacts": {"kernel": ["bzImage"]}
469466
},
470467
"build": {"target_arch": "x86_64"}
471468
}
472-
"""
473-
)
469+
""")
474470

475471
tux = tuxmake_directory(tuxmake_build)
476472
assert tux.modules == []
@@ -614,9 +610,7 @@ def test_update_cache(mocker, monkeypatch, capsys):
614610
with pytest.raises(SystemExit):
615611
main()
616612
stdout, stderr = capsys.readouterr()
617-
assert (
618-
stdout
619-
== """Updating local cache:
613+
assert stdout == """Updating local cache:
620614
* Rootfs:
621615
* avh-imx93
622616
* avh-rpi4b
@@ -643,7 +637,6 @@ def test_update_cache(mocker, monkeypatch, capsys):
643637
* qemu-x86_64
644638
* Test definitions
645639
"""
646-
)
647640

648641

649642
def test_save_results_json(tuxrun_args, lava_run, mocker, tmp_path):

test/unit/test_writer.py

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,7 @@ def test_write_log_file(tmp_path):
1515
encoding="utf-8"
1616
) == '{"lvl": "info", "msg": "Hello, world", "dt": "2021-04-08T18:42:25.139513"}\n'
1717

18-
assert (
19-
html_file.read_text(encoding="utf-8")
20-
== """<!DOCTYPE html>
18+
assert html_file.read_text(encoding="utf-8") == """<!DOCTYPE html>
2119
<html lang="en">
2220
<head>
2321
<title>TuxTest log</title>
@@ -40,7 +38,6 @@ def test_write_log_file(tmp_path):
4038
</pre>
4139
</body>
4240
</html>"""
43-
)
4441
assert text_file.read_text(encoding="utf-8") == ""
4542

4643

@@ -70,9 +67,7 @@ def test_write_stdout_logs(capsys, tmp_path):
7067
yaml_file.read_text(encoding="utf-8")
7168
== """- {"lvl": "info", "msg": "Hello, world", "dt": "2021-04-08T18:42:25.139513"}\n"""
7269
)
73-
assert (
74-
html_file.read_text(encoding="utf-8")
75-
== """<!DOCTYPE html>
70+
assert html_file.read_text(encoding="utf-8") == """<!DOCTYPE html>
7671
<html lang="en">
7772
<head>
7873
<title>TuxTest log</title>
@@ -95,7 +90,6 @@ def test_write_stdout_logs(capsys, tmp_path):
9590
</pre>
9691
</body>
9792
</html>"""
98-
)
9993
assert text_file.read_text(encoding="utf-8") == ""
10094

10195

@@ -125,9 +119,7 @@ def test_write_stdout_feedback_logs(capsys, tmp_path):
125119
yaml_file.read_text(encoding="utf-8")
126120
== """- {"lvl": "feedback", "msg": "Hello, world", "dt": "2021-04-08T18:42:25.139513", "ns": "testing"}\n"""
127121
)
128-
assert (
129-
html_file.read_text(encoding="utf-8")
130-
== """<!DOCTYPE html>
122+
assert html_file.read_text(encoding="utf-8") == """<!DOCTYPE html>
131123
<html lang="en">
132124
<head>
133125
<title>TuxTest log</title>
@@ -151,7 +143,6 @@ def test_write_stdout_feedback_logs(capsys, tmp_path):
151143
</pre>
152144
</body>
153145
</html>"""
154-
)
155146
assert text_file.read_text(encoding="utf-8") == "<testing> Hello, world\n"
156147

157148

@@ -164,14 +155,11 @@ def test_writer_invalid_yaml(capsys, tmpdir):
164155
writer.write(data)
165156
writer.write("{hello: world}")
166157
out, err = capsys.readouterr()
167-
assert (
168-
out
169-
== """{
158+
assert out == """{
170159
hello world
171160
{}
172161
{hello: world}
173162
"""
174-
)
175163
assert err == ""
176164
assert (tmpdir / "logs").read_text(
177165
encoding="utf-8"

tuxrun/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,5 @@
77
"""
88
Command line tool for testing Linux under QEMU
99
"""
10+
1011
__version__ = "1.4.0"

tuxrun/__main__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ def run(options, tmpdir: Path, cache_dir: Optional[Path], artefacts: dict) -> in
294294
] + extra_assets:
295295
ro = True
296296
if isinstance(path, tuple):
297-
(path, ro) = path
297+
path, ro = path
298298
if not path:
299299
continue
300300
if urlparse(path).scheme == "file":

tuxrun/runtimes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ def cmd(self, args):
125125
srcs = set()
126126
dsts = set()
127127
for binding in self.__bindings__:
128-
(src, dst, ro, device) = binding
128+
src, dst, ro, device = binding
129129
if src in srcs:
130130
LOG.error("Duplicated mount source %r", src)
131131
raise Exception("Duplicated mount source %r" % src)

tuxrun/templates/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99

1010
import jinja2
1111

12-
1312
BASE = (Path(__file__) / "..").resolve()
1413

1514

tuxrun/utils.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
from tuxrun import requests, xdg
1919
from tuxrun.yaml import yaml_load
2020

21-
2221
DEFAULT_DISPATCHER_DOWNLOAD_DIR = "/var/lib/lava/dispatcher/tmp"
2322

2423

0 commit comments

Comments
 (0)