Skip to content

Commit b4b3d02

Browse files
committed
remove deprecated test files: eliminate test_android_setup.py and test_fetch_versions.py related to retired setup_android_tools.py script
1 parent e338f39 commit b4b3d02

32 files changed

+297
-1042
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,3 +135,4 @@ CLAUDE.md
135135
experiments/results/
136136
ovmb_cache
137137
artifacts
138+
junit.xml

ovmobilebench/android/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@
1212
"ensure_android_tools",
1313
"export_android_env",
1414
"verify_installation",
15-
]
15+
]

ovmobilebench/android/installer/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
Example:
77
>>> from ovmobilebench.android.installer import ensure_android_tools, NdkSpec
88
>>> from pathlib import Path
9-
>>>
9+
>>>
1010
>>> result = ensure_android_tools(
1111
... sdk_root=Path("/opt/android-sdk"),
1212
... api=30,
@@ -40,4 +40,4 @@
4040
"InstallerResult",
4141
"NdkSpec",
4242
"Target",
43-
]
43+
]

ovmobilebench/android/installer/api.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def ensure_android_tools(
5555
>>> from pathlib import Path
5656
>>> from ovmobilebench.android.installer.api import ensure_android_tools
5757
>>> from ovmobilebench.android.installer.types import NdkSpec
58-
>>>
58+
>>>
5959
>>> result = ensure_android_tools(
6060
... sdk_root=Path("/opt/android-sdk"),
6161
... api=30,
@@ -117,7 +117,7 @@ def export_android_env(
117117
Example:
118118
>>> from pathlib import Path
119119
>>> from ovmobilebench.android.installer.api import export_android_env
120-
>>>
120+
>>>
121121
>>> env_vars = export_android_env(
122122
... sdk_root=Path("/opt/android-sdk"),
123123
... ndk_path=Path("/opt/android-sdk/ndk/26.1.10909125"),
@@ -147,7 +147,7 @@ def verify_installation(sdk_root: Path, verbose: bool = False) -> dict:
147147
Example:
148148
>>> from pathlib import Path
149149
>>> from ovmobilebench.android.installer.api import verify_installation
150-
>>>
150+
>>>
151151
>>> status = verify_installation(Path("/opt/android-sdk"))
152152
>>> print(f"Platform tools: {status['platform_tools']}")
153153
>>> print(f"NDK versions: {status.get('ndk_versions', [])}")
@@ -167,4 +167,4 @@ def verify_installation(sdk_root: Path, verbose: bool = False) -> dict:
167167
"NdkSpec",
168168
"Target",
169169
"Arch",
170-
]
170+
]

ovmobilebench/android/installer/avd.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -208,12 +208,12 @@ def get_info(self, name: str) -> Optional[dict]:
208208
"""
209209
try:
210210
result = self._run_avdmanager(["list", "avd"])
211-
211+
212212
# Parse output to find AVD info
213213
lines = result.stdout.split("\n")
214214
avd_info = {}
215215
in_avd = False
216-
216+
217217
for line in lines:
218218
line = line.strip()
219219
if f"Name: {name}" in line:
@@ -226,9 +226,9 @@ def get_info(self, name: str) -> Optional[dict]:
226226
elif ":" in line:
227227
key, value = line.split(":", 1)
228228
avd_info[key.strip().lower().replace(" ", "_")] = value.strip()
229-
229+
230230
return avd_info if avd_info else None
231-
231+
232232
except (AvdManagerError, ComponentNotFoundError):
233233
return None
234234

@@ -273,4 +273,4 @@ def __enter__(self):
273273
return self
274274

275275
def __exit__(self, *args):
276-
pass
276+
pass

ovmobilebench/android/installer/cli.py

Lines changed: 29 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ def setup(
142142
config_table = Table(show_header=False)
143143
config_table.add_column("Setting", style="cyan")
144144
config_table.add_column("Value")
145-
145+
146146
config_table.add_row("SDK Root", str(sdk_root))
147147
config_table.add_row("API Level", str(api))
148148
config_table.add_row("Target", target)
@@ -155,12 +155,16 @@ def setup(
155155
if create_avd:
156156
config_table.add_row("AVD", create_avd)
157157
config_table.add_row("Dry Run", "Yes" if dry_run else "No")
158-
158+
159159
console.print(config_table)
160160
console.print()
161161

162162
# Run installation
163-
with console.status("[bold green]Installing Android tools...") if not verbose else nullcontext():
163+
with (
164+
console.status("[bold green]Installing Android tools...")
165+
if not verbose
166+
else nullcontext()
167+
):
164168
result = ensure_android_tools(
165169
sdk_root=sdk_root,
166170
api=api,
@@ -185,7 +189,7 @@ def setup(
185189
sdk_root=result["sdk_root"],
186190
ndk_path=result["ndk_path"],
187191
)
188-
192+
189193
if export_env and verbose:
190194
console.print(f"[green]✓[/green] Environment exported to: {export_env}")
191195

@@ -208,6 +212,7 @@ def setup(
208212
console.print(f"[bold red]Unexpected error:[/bold red] {e}")
209213
if verbose:
210214
import traceback
215+
211216
traceback.print_exc()
212217
sys.exit(1)
213218

@@ -236,43 +241,43 @@ def verify(
236241
"""
237242
try:
238243
console.print(f"[cyan]Verifying installation at: {sdk_root}[/cyan]\n")
239-
244+
240245
status = verify_installation(sdk_root, verbose=verbose)
241-
246+
242247
# Create status table
243248
table = Table(title="Installation Status")
244249
table.add_column("Component", style="cyan")
245250
table.add_column("Status", style="green")
246251
table.add_column("Details")
247-
252+
248253
# SDK root
249254
table.add_row(
250255
"SDK Root",
251256
"✓" if status["sdk_root_exists"] else "✗",
252257
str(sdk_root) if status["sdk_root_exists"] else "Not found",
253258
)
254-
259+
255260
# Command-line tools
256261
table.add_row(
257262
"Command-line Tools",
258263
"✓" if status["cmdline_tools"] else "✗",
259264
"Installed" if status["cmdline_tools"] else "Not installed",
260265
)
261-
266+
262267
# Platform tools
263268
table.add_row(
264269
"Platform Tools",
265270
"✓" if status["platform_tools"] else "✗",
266271
"Installed" if status["platform_tools"] else "Not installed",
267272
)
268-
273+
269274
# Emulator
270275
table.add_row(
271276
"Emulator",
272277
"✓" if status["emulator"] else "✗",
273278
"Installed" if status["emulator"] else "Not installed",
274279
)
275-
280+
276281
# NDK
277282
ndk_details = "Not installed"
278283
if status["ndk"] and status.get("ndk_versions"):
@@ -282,7 +287,7 @@ def verify(
282287
"✓" if status["ndk"] else "✗",
283288
ndk_details,
284289
)
285-
290+
286291
# AVDs
287292
avd_details = "None"
288293
if status.get("avds"):
@@ -292,19 +297,19 @@ def verify(
292297
"✓" if status.get("avds") else "-",
293298
avd_details,
294299
)
295-
300+
296301
console.print(table)
297-
302+
298303
# Show installed components if verbose
299304
if verbose and status.get("components"):
300305
console.print("\n[bold]Installed Components:[/bold]")
301306
for component in status["components"]:
302307
console.print(f" • {component}")
303-
308+
304309
# Exit code based on status
305310
if not status["sdk_root_exists"]:
306311
sys.exit(1)
307-
312+
308313
except Exception as e:
309314
console.print(f"[bold red]Error:[/bold red] {e}")
310315
sys.exit(1)
@@ -317,9 +322,9 @@ def list_targets() -> None:
317322
Shows all supported combinations for system images.
318323
"""
319324
from .plan import Planner
320-
325+
321326
console.print("[bold]Supported System Image Combinations:[/bold]\n")
322-
327+
323328
# Group by API level
324329
combinations: Dict[int, Dict[str, list]] = {}
325330
for api, target, arch in Planner.VALID_COMBINATIONS:
@@ -328,29 +333,31 @@ def list_targets() -> None:
328333
if target not in combinations[api]:
329334
combinations[api][target] = []
330335
combinations[api][target].append(arch)
331-
336+
332337
# Display as table
333338
for api in sorted(combinations.keys(), reverse=True):
334339
table = Table(title=f"API Level {api}")
335340
table.add_column("Target", style="cyan")
336341
table.add_column("Architectures")
337-
342+
338343
for target in sorted(combinations[api].keys()):
339344
archs = ", ".join(sorted(combinations[api][target]))
340345
table.add_row(target, archs)
341-
346+
342347
console.print(table)
343348
console.print()
344349

345350

346351
# Context manager for when console status is not needed
347352
class nullcontext:
348353
"""Null context manager."""
354+
349355
def __enter__(self):
350356
return self
357+
351358
def __exit__(self, *args):
352359
pass
353360

354361

355362
if __name__ == "__main__":
356-
app()
363+
app()

ovmobilebench/android/installer/core.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ def ensure(
143143
if plan.need_cmdline_tools:
144144
self.sdk.ensure_cmdline_tools()
145145
performed["cmdline_tools"] = True
146-
146+
147147
self.sdk.accept_licenses()
148148
performed["licenses_accepted"] = True
149149

@@ -209,7 +209,7 @@ def _check_permissions(self) -> None:
209209
# Create SDK root if it doesn't exist
210210
try:
211211
self.sdk_root.mkdir(parents=True, exist_ok=True)
212-
212+
213213
# Try to create a test file
214214
test_file = self.sdk_root / ".permission_test"
215215
test_file.touch()
@@ -248,6 +248,7 @@ def cleanup(self, remove_downloads: bool = True, remove_temp: bool = True) -> No
248248
if self.logger:
249249
self.logger.debug(f"Removing directory: {temp_dir.name}")
250250
import shutil
251+
251252
shutil.rmtree(temp_dir)
252253
cleanup_count += 1
253254

@@ -294,13 +295,11 @@ def verify(self) -> dict:
294295

295296
# List installed components
296297
try:
297-
results["components"] = [
298-
comp.package_id for comp in self.sdk.list_installed()
299-
]
298+
results["components"] = [comp.package_id for comp in self.sdk.list_installed()]
300299
except Exception:
301300
results["components"] = []
302301

303302
if self.logger:
304303
self.logger.info("Verification complete", results=results)
305304

306-
return results
305+
return results

ovmobilebench/android/installer/detect.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,4 +218,4 @@ def get_recommended_settings(host: Optional[HostInfo] = None) -> dict:
218218
settings["target"] = "google_atd" # Optimized for testing
219219
settings["install_emulator"] = True
220220

221-
return settings
221+
return settings

ovmobilebench/android/installer/env.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,4 +245,4 @@ def export_android_env(
245245
print_stdout=print_stdout,
246246
sdk_root=sdk_root,
247247
ndk_path=ndk_path,
248-
)
248+
)

ovmobilebench/android/installer/errors.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,7 @@ class SdkManagerError(InstallerError):
4848
def __init__(self, command: str, exit_code: int, stderr: str):
4949
"""Initialize with command details."""
5050
message = f"sdkmanager failed with exit code {exit_code}: {stderr}"
51-
super().__init__(
52-
message, {"command": command, "exit_code": exit_code, "stderr": stderr}
53-
)
51+
super().__init__(message, {"command": command, "exit_code": exit_code, "stderr": stderr})
5452

5553

5654
class AvdManagerError(InstallerError):
@@ -59,9 +57,7 @@ class AvdManagerError(InstallerError):
5957
def __init__(self, operation: str, avd_name: str, reason: str):
6058
"""Initialize with AVD operation details."""
6159
message = f"AVD {operation} failed for '{avd_name}': {reason}"
62-
super().__init__(
63-
message, {"operation": operation, "avd_name": avd_name, "reason": reason}
64-
)
60+
super().__init__(message, {"operation": operation, "avd_name": avd_name, "reason": reason})
6561

6662

6763
class PermissionError(InstallerError):
@@ -82,7 +78,8 @@ def __init__(self, component: str, search_path: Optional[Path] = None):
8278
if search_path:
8379
message += f" in {search_path}"
8480
super().__init__(
85-
message, {"component": component, "search_path": str(search_path) if search_path else None}
81+
message,
82+
{"component": component, "search_path": str(search_path) if search_path else None},
8683
)
8784

8885

@@ -98,7 +95,12 @@ def __init__(self, platform: str, operation: str):
9895
class DependencyError(InstallerError):
9996
"""Missing or incompatible dependency."""
10097

101-
def __init__(self, dependency: str, required_version: Optional[str] = None, found_version: Optional[str] = None):
98+
def __init__(
99+
self,
100+
dependency: str,
101+
required_version: Optional[str] = None,
102+
found_version: Optional[str] = None,
103+
):
102104
"""Initialize with dependency details."""
103105
message = f"Dependency '{dependency}' "
104106
if required_version and found_version:
@@ -143,4 +145,4 @@ def __init__(self, operation: str, reason: str, proxy_hint: bool = False):
143145
message += "\nHint: Check proxy settings or network connectivity"
144146
super().__init__(
145147
message, {"operation": operation, "reason": reason, "proxy_hint": proxy_hint}
146-
)
148+
)

0 commit comments

Comments
 (0)