added ruff for code review
This commit is contained in:
@@ -14,11 +14,11 @@ from orisys_sensor_design.deform import (
|
||||
DEFAULT_PROBE,
|
||||
DEFORM_JOB_FILENAME,
|
||||
DEFORM_JOB_SCHEMA,
|
||||
FRAMES_NPZ_FILENAME,
|
||||
DEFORM_REPORT_FILENAME,
|
||||
FRAMES_NPZ_FILENAME,
|
||||
PatternInfo,
|
||||
ProbeConfigError,
|
||||
ProbeFrame,
|
||||
PatternInfo,
|
||||
build_deform_job,
|
||||
deform_job_path,
|
||||
frame_plan,
|
||||
|
||||
@@ -9,12 +9,12 @@ import pytest
|
||||
|
||||
np = pytest.importorskip("numpy")
|
||||
|
||||
from orisys_sensor_design.manifest import RevisionPaths, repo_root
|
||||
from orisys_sensor_design.optics import (
|
||||
AIR_INDEX,
|
||||
Interface,
|
||||
OpticalStack,
|
||||
OpticsConfigError,
|
||||
OpticsLayer,
|
||||
OpticalStack,
|
||||
intersect_mesh,
|
||||
load_optics_block,
|
||||
quantify,
|
||||
@@ -24,7 +24,6 @@ from orisys_sensor_design.optics import (
|
||||
trace_ray,
|
||||
validate_optics_block,
|
||||
)
|
||||
from orisys_sensor_design.manifest import RevisionPaths, repo_root
|
||||
|
||||
REPO = repo_root()
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import math
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
@@ -11,14 +10,13 @@ import pytest
|
||||
np = pytest.importorskip("numpy")
|
||||
|
||||
from orisys_sensor_design.optics import (
|
||||
AIR_INDEX,
|
||||
Interface,
|
||||
OpticsLayer,
|
||||
OpticalStack,
|
||||
OpticsLayer,
|
||||
camera_rays,
|
||||
quantify,
|
||||
sample_stack,
|
||||
summarize,
|
||||
quantify,
|
||||
)
|
||||
from orisys_sensor_design.optics_plot import (
|
||||
DEFAULT_SANITY_MM,
|
||||
|
||||
@@ -341,7 +341,7 @@ def test_reference_cross_printable_flag(tmp_path: Path) -> None:
|
||||
_polygon("patch-1", "0,0 50,0 50,50 0,50")
|
||||
+ "\n"
|
||||
+ ' <g id="reference-cross">\n'
|
||||
+ f' <rect id="cross-arm-0" x="0" y="0" width="20" '
|
||||
+ ' <rect id="cross-arm-0" x="0" y="0" width="20" '
|
||||
+ f'height="{height_px}" fill="#ff0000"/>\n'
|
||||
+ " </g>"
|
||||
)
|
||||
|
||||
@@ -76,11 +76,14 @@ requires_blender = pytest.mark.skipif(
|
||||
|
||||
def _run_blender(script: Path, job: Path, timeout: int = 900) -> subprocess.CompletedProcess:
|
||||
assert BLENDER is not None
|
||||
# check=False is deliberate: several tests assert on non-zero Blender exit
|
||||
# codes (2/3), so a non-zero status is data, not an error to raise on.
|
||||
return subprocess.run(
|
||||
[str(BLENDER), "-b", str(SOURCE_BLEND), "-P", str(script), "--", "--job", str(job)],
|
||||
capture_output=True,
|
||||
text=True,
|
||||
timeout=timeout,
|
||||
check=False,
|
||||
)
|
||||
|
||||
|
||||
@@ -248,7 +251,7 @@ def test_job_carries_the_hard_render_settings(paths, settings, tmp_path):
|
||||
assert job["objects"] == {"mesh": "sensing_surface", "camera": "cam_sensor"}
|
||||
assert job["null_frame"] == {"name": REFERENCE_NULL_NAME, "seed": 1}
|
||||
assert job["artifacts"]["report"] == str(
|
||||
(Path(tmp_path).resolve() / render.MANIFEST_FILENAME)
|
||||
Path(tmp_path).resolve() / render.MANIFEST_FILENAME
|
||||
)
|
||||
assert job["artifacts"]["frames_npz"] == str(
|
||||
deform.probe_artifact_paths(Path(tmp_path))["frames"]
|
||||
|
||||
@@ -195,7 +195,6 @@ def _stub_sdk(monkeypatch: pytest.MonkeyPatch, calls: dict, mask_mode: str = "va
|
||||
arrays["valid_mask"] = np.ones((4, 4), bool)
|
||||
arrays["world_xyz"] = np.zeros((4, 4, 3), np.float32)
|
||||
np.savez(map_path, **arrays)
|
||||
return None
|
||||
|
||||
monkeypatch.setattr(geometry, "scale_camera_geometry", fake_scale_camera_geometry)
|
||||
monkeypatch.setattr(precompute, "build_or_load_domain", fake_build_or_load_domain)
|
||||
@@ -306,7 +305,6 @@ def test_a_map_without_a_valid_mask_is_fatal(
|
||||
calls["build_kwargs"] = kwargs
|
||||
height, width = int(kwargs["out_height"]), int(kwargs["out_width"])
|
||||
np.savez(map_path, map_x=np.zeros((height, width), np.float32))
|
||||
return None
|
||||
|
||||
monkeypatch.setattr(precompute, "build_or_load_domain", build_without_mask)
|
||||
with pytest.raises(uv.UvMapError, match="valid_mask"):
|
||||
|
||||
Reference in New Issue
Block a user