ueshin commented on a change in pull request #34296:
URL: https://github.com/apache/spark/pull/34296#discussion_r734833122



##########
File path: dev/lint-python
##########
@@ -124,39 +125,76 @@ function pycodestyle_test {
     fi
 }
 
-function mypy_test {
-    local MYPY_REPORT=
-    local MYPY_STATUS=
 
-    if ! hash "$MYPY_BUILD" 2> /dev/null; then
-        echo "The $MYPY_BUILD command was not found. Skipping for now."
-        return
+function mypy_annotation_test {

Review comment:
       So this is the mypy test equivalent to the existing one, right?

##########
File path: dev/lint-python
##########
@@ -124,39 +125,76 @@ function pycodestyle_test {
     fi
 }
 
-function mypy_test {
-    local MYPY_REPORT=
-    local MYPY_STATUS=
 
-    if ! hash "$MYPY_BUILD" 2> /dev/null; then
-        echo "The $MYPY_BUILD command was not found. Skipping for now."
-        return
+function mypy_annotation_test {
+    local PYTEST_REPORT=
+    local PYTEST_STATUS=

Review comment:
       We can keep the names `MYPY_REPORT` and `MYPY_STATUS`?

##########
File path: dev/lint-python
##########
@@ -124,39 +125,76 @@ function pycodestyle_test {
     fi
 }
 
-function mypy_test {
-    local MYPY_REPORT=
-    local MYPY_STATUS=
 
-    if ! hash "$MYPY_BUILD" 2> /dev/null; then
-        echo "The $MYPY_BUILD command was not found. Skipping for now."
-        return
+function mypy_annotation_test {
+    local PYTEST_REPORT=
+    local PYTEST_STATUS=
+
+    echo "starting mypy annotations test..."
+    PYTEST_REPORT=$( ($MYPY_BUILD \
+      --config-file python/mypy.ini \
+      --cache-dir /tmp/.mypy_cache/ \
+      python/pyspark) 2>&1)
+    PYTEST_STATUS=$?
+
+    if [ "$PYTEST_STATUS" -ne 0 ]; then
+        echo "annotations failed mypy checks:"
+        echo "$PYTEST_REPORT"
+        echo "$PYTEST_STATUS"
+        exit "$PYTEST_STATUS"
+    else
+        echo "annotations passed mypy checks."
+        echo
     fi
+}
 
-    _MYPY_VERSION=($($MYPY_BUILD --version))
-    MYPY_VERSION="${_MYPY_VERSION[1]}"
-    EXPECTED_MYPY="$(satisfies_min_version $MYPY_VERSION $MINIMUM_MYPY)"
 
-    if [[ "$EXPECTED_MYPY" == "False" ]]; then
-        echo "The minimum mypy version needs to be $MINIMUM_MYPY. Your current 
version is $MYPY_VERSION. Skipping for now."
-        return

Review comment:
       Seems like this check is missing? We should keep it in `mypy_test`?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to