@@ -50,7 +50,7 @@ def test_package(host, docker_image):
50
50
}[docker_image ]
51
51
if release is None :
52
52
with pytest .raises (NotImplementedError ):
53
- ssh .release
53
+ ssh .release # noqa: B018
54
54
else :
55
55
assert release in ssh .release
56
56
@@ -66,7 +66,7 @@ def test_held_package(host):
66
66
def test_rpmdb_corrupted (host ):
67
67
host .check_output ("dd if=/dev/zero of=/var/lib/rpm/rpmdb.sqlite bs=1024 count=1" )
68
68
with pytest .raises (RuntimeError ) as excinfo :
69
- host .package ("zsh" ).is_installed
69
+ host .package ("zsh" ).is_installed # noqa: B018
70
70
assert (
71
71
"Could not check if RPM package 'zsh' is installed. error: sqlite failure:"
72
72
) in str (excinfo .value )
@@ -82,7 +82,7 @@ def test_non_default_package_tool(host):
82
82
@pytest .mark .destructive
83
83
def test_uninstalled_package_version (host ):
84
84
with pytest .raises (AssertionError ) as excinfo :
85
- host .package ("zsh" ).version
85
+ host .package ("zsh" ).version # noqa: B018
86
86
assert (
87
87
"The package zsh is not installed, dpkg-query output: unknown ok not-installed"
88
88
in str (excinfo .value )
@@ -91,7 +91,7 @@ def test_uninstalled_package_version(host):
91
91
host .check_output ("apt-get -y remove sudo" )
92
92
assert not host .package ("sudo" ).is_installed
93
93
with pytest .raises (AssertionError ) as excinfo :
94
- host .package ("sudo" ).version
94
+ host .package ("sudo" ).version # noqa: B018
95
95
assert (
96
96
"The package sudo is not installed, dpkg-query output: "
97
97
"deinstall ok config-files 1.9."
@@ -114,11 +114,7 @@ def test_systeminfo(host, docker_image):
114
114
115
115
@all_images
116
116
def test_ssh_service (host , docker_image ):
117
- if docker_image == "rockylinux9" :
118
- name = "sshd"
119
- else :
120
- name = "ssh"
121
-
117
+ name = "sshd" if docker_image == "rockylinux9" else "ssh"
122
118
ssh = host .service (name )
123
119
# wait at max 10 seconds for ssh is running
124
120
for _ in range (10 ):
@@ -196,7 +192,7 @@ def test_socket(host):
196
192
197
193
assert not host .socket ("tcp://4242" ).is_listening
198
194
199
- if not host .backend .get_connection_type () = = "docker" :
195
+ if host .backend .get_connection_type () ! = "docker" :
200
196
# FIXME
201
197
for spec in (
202
198
"tcp://22" ,
@@ -324,7 +320,7 @@ def test_file(host):
324
320
assert link .linked_to == "/d/f"
325
321
assert link .linked_to == f
326
322
assert f == host .file ("/d/f" )
327
- assert not d = = f
323
+ assert d ! = f
328
324
329
325
host .check_output ("ln /d/f /d/h" )
330
326
hardlink = host .file ("/d/h" )
@@ -334,7 +330,7 @@ def test_file(host):
334
330
assert isinstance (f .inode , int )
335
331
assert hardlink .inode == f .inode
336
332
assert f == host .file ("/d/f" )
337
- assert not d = = f
333
+ assert d ! = f
338
334
339
335
host .check_output ("rm -f /d/p && mkfifo /d/p" )
340
336
assert host .file ("/d/p" ).is_pipe
@@ -516,7 +512,7 @@ def test_supervisor(host, supervisorctl_path, supervisorctl_conf):
516
512
host .run ("service supervisor stop" )
517
513
assert not host .service ("supervisor" ).is_running
518
514
with pytest .raises (RuntimeError ) as excinfo :
519
- host .supervisor (
515
+ host .supervisor ( # noqa: B018
520
516
"tail" ,
521
517
supervisorctl_path = supervisorctl_path ,
522
518
supervisorctl_conf = supervisorctl_conf ,
@@ -551,9 +547,9 @@ def test_sudo_from_root(host):
551
547
552
548
def test_sudo_fail_from_root (host ):
553
549
assert host .user ().name == "root"
554
- with pytest . raises ( AssertionError ) as exc :
555
- with host .sudo ( "unprivileged" ):
556
- assert host . user (). name == "unprivileged"
550
+ with host . sudo ( "unprivileged" ) :
551
+ assert host .user (). name == "unprivileged"
552
+ with pytest . raises ( AssertionError ) as exc :
557
553
host .check_output ("ls /root/invalid" )
558
554
assert str (exc .value ).startswith ("Unexpected exit code" )
559
555
with host .sudo ():
0 commit comments