Skip to content

Commit af32a96

Browse files
luke-hackwellalextercete
authored andcommitted
Suppress ADBDriver output
1 parent 8786e31 commit af32a96

File tree

1 file changed

+24
-3
lines changed

1 file changed

+24
-3
lines changed

labgrid/driver/adb.py

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,13 @@ def __attrs_post_init__(self):
4646
subprocess.run(
4747
[self.tool, "disconnect", f"{self._host}:{str(self._port)}"],
4848
stderr=subprocess.DEVNULL,
49+
stdout=subprocess.DEVNULL,
4950
timeout=ADB_TIMEOUT,
5051
check=False,
5152
)
5253
subprocess.run(
5354
[self.tool, "connect", f"{self._host}:{str(self._port)}"],
55+
stderr=subprocess.DEVNULL,
5456
stdout=subprocess.DEVNULL,
5557
timeout=ADB_TIMEOUT,
5658
check=True,
@@ -63,6 +65,7 @@ def on_deactivate(self):
6365
subprocess.run(
6466
[self.tool, "disconnect", f"{self._host}:{str(self._port)}"],
6567
stderr=subprocess.DEVNULL,
68+
stdout=subprocess.DEVNULL,
6669
timeout=ADB_TIMEOUT,
6770
check=True,
6871
)
@@ -97,12 +100,24 @@ def get_status(self):
97100
@Driver.check_active
98101
@step(args=["filename", "remotepath", "timeout"])
99102
def put(self, filename: str, remotepath: str, timeout: float = ADB_TIMEOUT):
100-
subprocess.run([*self._base_command, "push", filename, remotepath], timeout=timeout, check=True)
103+
subprocess.run(
104+
[*self._base_command, "push", filename, remotepath],
105+
timeout=timeout,
106+
check=True,
107+
stderr=subprocess.DEVNULL,
108+
stdout=subprocess.DEVNULL,
109+
)
101110

102111
@Driver.check_active
103112
@step(args=["filename", "destination", "timeout"])
104113
def get(self, filename: str, destination: str, timeout: float = ADB_TIMEOUT):
105-
subprocess.run([*self._base_command, "pull", filename, destination], timeout=timeout, check=True)
114+
subprocess.run(
115+
[*self._base_command, "pull", filename, destination],
116+
timeout=timeout,
117+
check=True,
118+
stderr=subprocess.DEVNULL,
119+
stdout=subprocess.DEVNULL,
120+
)
106121

107122
# Reset Protocol
108123

@@ -117,4 +132,10 @@ def reset(self, mode=None):
117132
raise ValueError(f"{mode} must be one of: {', '.join(valid_modes)}")
118133
cmd.append(mode)
119134

120-
subprocess.run(cmd, timeout=ADB_TIMEOUT, check=True)
135+
subprocess.run(
136+
cmd,
137+
timeout=ADB_TIMEOUT,
138+
check=True,
139+
stderr=subprocess.DEVNULL,
140+
stdout=subprocess.DEVNULL,
141+
)

0 commit comments

Comments
 (0)