Skip to content

Commit 1456056

Browse files
caglarpirmeta-codesync[bot]
authored andcommitted
Fix pyre related issues in mapillary test code
Summary: Quality insights reports 1127 missing annotations and 208 pyre-unsafe in the code base with file paths containing "mapillary" and "test". What was fixed: 1. 208 # pyre-unsafe → # pyre-strict directives changed (plus 3 files that had no directive at all) 2. 1127 missing type annotations added: - -> None return types on test methods - -> <correct_type> return types on helper functions that return values - MagicMock parameter types for patch-decorated method mock params - Correct primitive types (str, int, float, bool, etc.) for helper function params with default values 3. 23 missing MagicMock imports added 4. All files formatted with arc lint -a Remaining pre-existing pyre errors (not introduced by this change): These were hidden by # pyre-unsafe and are now visible: - synthetic_cluster_dataset.py: Callable generic type needs 2 params (3 errors) - test_anonymization_task.py: Cannot reassign final attribute + incompatible param type (2 errors) - merge_tests.py: np.ndarray generic type needs 2 params (4 errors) - test_fix_vrs_frame_ids.py: patch with lambda not inferrable (5 errors — pre-existing pyre limitation) Reviewed By: d99m Differential Revision: D96924234 fbshipit-source-id: 338b2c7dc36cdc06cc71cb9ebe5ee2f2d6d0ece3
1 parent 6322e7c commit 1456056

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

opensfm/test/conftest.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# pyre-strict
22
from collections import defaultdict
33
from typing import Dict, List, Tuple
4+
from unittest.mock import MagicMock
45

56
import numpy as np
67
import pytest
@@ -13,7 +14,7 @@
1314
)
1415

1516

16-
def pytest_configure(config) -> None:
17+
def pytest_configure(config: MagicMock) -> None:
1718
use_legacy_numpy_printoptions()
1819

1920

@@ -163,7 +164,7 @@ def pairs_and_poses() -> Tuple[
163164

164165
@pytest.fixture(scope="module")
165166
def pairs_and_their_E(
166-
pairs_and_poses,
167+
pairs_and_poses: MagicMock,
167168
) -> List[Tuple[NDArray, NDArray, NDArray, pygeometry.Pose]]:
168169
pairs, poses, camera, _, _, _ = pairs_and_poses
169170

@@ -195,7 +196,7 @@ def pairs_and_their_E(
195196

196197
@pytest.fixture(scope="module")
197198
def shots_and_their_points(
198-
pairs_and_poses,
199+
pairs_and_poses: MagicMock,
199200
) -> List[Tuple[pygeometry.Pose, NDArray, NDArray]]:
200201
_, _, _, _, tracks_manager, reconstruction = pairs_and_poses
201202

0 commit comments

Comments
 (0)