summaryrefslogtreecommitdiff
path: root/zephyr
diff options
context:
space:
mode:
authorJack Rosenthal <jrosenth@chromium.org>2021-07-02 11:36:05 -0600
committerCommit Bot <commit-bot@chromium.org>2021-07-02 23:36:41 +0000
commit4d2c524af57e22adc2b57fed5555980cef6ed49a (patch)
tree0aa3ca3fb6a41cc4269b59e974a7fa6f62f5ee2c /zephyr
parent65b8e9a2a37b91c47e22151c9438b121d7b02558 (diff)
downloadchrome-ec-4d2c524af57e22adc2b57fed5555980cef6ed49a.tar.gz
zephyr: zmake: Run isort on all files, add check to run_tests.sh
Run isort on all files, and enforce future formatting checks by putting in run_tests.sh. BUG=b:192389533 BRANCH=none TEST=run_tests.sh Cq-Depend: chromium:3003455 Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: I5795ffae30b88fe3a5f093ab7a0d8cd9389da285 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3002838 Reviewed-by: Yuval Peress <peress@chromium.org>
Diffstat (limited to 'zephyr')
-rwxr-xr-xzephyr/zmake/run_tests.sh3
-rw-r--r--zephyr/zmake/setup.py1
-rw-r--r--zephyr/zmake/tests/test_build_config.py7
-rw-r--r--zephyr/zmake/tests/test_modules.py4
-rw-r--r--zephyr/zmake/tests/test_multiproc_logging.py2
-rw-r--r--zephyr/zmake/tests/test_packers.py7
-rw-r--r--zephyr/zmake/tests/test_print_versions.py1
-rw-r--r--zephyr/zmake/tests/test_project.py8
-rw-r--r--zephyr/zmake/tests/test_toolchains.py2
-rw-r--r--zephyr/zmake/tests/test_util.py6
-rw-r--r--zephyr/zmake/tests/test_zmake.py3
-rw-r--r--zephyr/zmake/zmake/jobserver.py2
-rw-r--r--zephyr/zmake/zmake/version.py2
13 files changed, 29 insertions, 19 deletions
diff --git a/zephyr/zmake/run_tests.sh b/zephyr/zmake/run_tests.sh
index 2dd1a21939..30c1bf4159 100755
--- a/zephyr/zmake/run_tests.sh
+++ b/zephyr/zmake/run_tests.sh
@@ -24,3 +24,6 @@ export PYTHONPATH="${PWD}"
# CPU by running pytest alongside all the ninjas, which no longer
# happens. Remove this flag.
pytest --hypothesis-profile=cq .
+
+# Check import sorting.
+isort --check .
diff --git a/zephyr/zmake/setup.py b/zephyr/zmake/setup.py
index 72c80e924d..0aed990e09 100644
--- a/zephyr/zmake/setup.py
+++ b/zephyr/zmake/setup.py
@@ -4,7 +4,6 @@
import setuptools
-
setuptools.setup(
name='zephyr-chrome-utils',
version='0.1',
diff --git a/zephyr/zmake/tests/test_build_config.py b/zephyr/zmake/tests/test_build_config.py
index 8f60f6dcf8..5eb72eb058 100644
--- a/zephyr/zmake/tests/test_build_config.py
+++ b/zephyr/zmake/tests/test_build_config.py
@@ -3,14 +3,15 @@
# found in the LICENSE file.
import argparse
-import hypothesis
-import hypothesis.strategies as st
import os
import pathlib
-import pytest
import string
import tempfile
+import hypothesis
+import hypothesis.strategies as st
+import pytest
+
import zmake.jobserver
import zmake.util as util
from zmake.build_config import BuildConfig
diff --git a/zephyr/zmake/tests/test_modules.py b/zephyr/zmake/tests/test_modules.py
index 6fa7a38b24..2c934628f6 100644
--- a/zephyr/zmake/tests/test_modules.py
+++ b/zephyr/zmake/tests/test_modules.py
@@ -2,14 +2,14 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
+import pathlib
import tempfile
+
import hypothesis
import hypothesis.strategies as st
-import pathlib
import zmake.modules
-
module_lists = st.lists(st.one_of(*map(st.just, zmake.modules.known_modules)),
unique=True)
diff --git a/zephyr/zmake/tests/test_multiproc_logging.py b/zephyr/zmake/tests/test_multiproc_logging.py
index a50e5161b9..11fef0be97 100644
--- a/zephyr/zmake/tests/test_multiproc_logging.py
+++ b/zephyr/zmake/tests/test_multiproc_logging.py
@@ -4,8 +4,8 @@
import io
import logging
import os
-import unittest.mock as mock
import threading
+import unittest.mock as mock
import zmake.multiproc
diff --git a/zephyr/zmake/tests/test_packers.py b/zephyr/zmake/tests/test_packers.py
index 21361a925f..34b256bce6 100644
--- a/zephyr/zmake/tests/test_packers.py
+++ b/zephyr/zmake/tests/test_packers.py
@@ -2,13 +2,14 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
-import hypothesis
-import hypothesis.strategies as st
import pathlib
-import pytest
import tempfile
import unittest.mock as mock
+import hypothesis
+import hypothesis.strategies as st
+import pytest
+
import zmake.output_packers as packers
# Strategies for use with hypothesis
diff --git a/zephyr/zmake/tests/test_print_versions.py b/zephyr/zmake/tests/test_print_versions.py
index 0e7df2f3a0..68abe79c43 100644
--- a/zephyr/zmake/tests/test_print_versions.py
+++ b/zephyr/zmake/tests/test_print_versions.py
@@ -4,6 +4,7 @@
import pathlib
import tempfile
+
import zmake.zmake as zm
diff --git a/zephyr/zmake/tests/test_project.py b/zephyr/zmake/tests/test_project.py
index 732e397354..3279d6ce31 100644
--- a/zephyr/zmake/tests/test_project.py
+++ b/zephyr/zmake/tests/test_project.py
@@ -2,17 +2,17 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
-import hypothesis
-import hypothesis.strategies as st
import pathlib
-import pytest
import string
import tempfile
+import hypothesis
+import hypothesis.strategies as st
+import pytest
+
import zmake.modules
import zmake.project
-
board_names = st.text(alphabet=set(string.ascii_lowercase) | {'_'},
min_size=1)
sets_of_board_names = st.lists(st.lists(board_names, unique=True))
diff --git a/zephyr/zmake/tests/test_toolchains.py b/zephyr/zmake/tests/test_toolchains.py
index 5ad9a8e159..d5549faebf 100644
--- a/zephyr/zmake/tests/test_toolchains.py
+++ b/zephyr/zmake/tests/test_toolchains.py
@@ -3,7 +3,9 @@
# found in the LICENSE file.
import pathlib
+
import mock
+
import zmake.toolchains as toolchains
diff --git a/zephyr/zmake/tests/test_util.py b/zephyr/zmake/tests/test_util.py
index b656b1318f..258694d890 100644
--- a/zephyr/zmake/tests/test_util.py
+++ b/zephyr/zmake/tests/test_util.py
@@ -2,15 +2,15 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
+import pathlib
+import tempfile
+
import hypothesis
import hypothesis.strategies as st
-import pathlib
import pytest
-import tempfile
import zmake.util as util
-
# Strategies for use with hypothesis
relative_path = st.from_regex(regex=r"\A\w+[\w/]*\Z")
diff --git a/zephyr/zmake/tests/test_zmake.py b/zephyr/zmake/tests/test_zmake.py
index 816278e46a..f037ab82f8 100644
--- a/zephyr/zmake/tests/test_zmake.py
+++ b/zephyr/zmake/tests/test_zmake.py
@@ -13,12 +13,13 @@ import unittest
import unittest.mock as mock
from unittest.mock import patch
+from testfixtures import LogCapture
+
import zmake.build_config
import zmake.jobserver
import zmake.multiproc as multiproc
import zmake.project
import zmake.zmake as zm
-from testfixtures import LogCapture
OUR_PATH = os.path.dirname(os.path.realpath(__file__))
diff --git a/zephyr/zmake/zmake/jobserver.py b/zephyr/zmake/zmake/jobserver.py
index 0a5a8b9255..a4a8512b82 100644
--- a/zephyr/zmake/zmake/jobserver.py
+++ b/zephyr/zmake/zmake/jobserver.py
@@ -9,8 +9,10 @@ import os
import re
import select
import subprocess
+
import zmake
+
class JobHandle:
"""Small object to handle claim of a job."""
def __init__(self, release_func, *args, **kwargs):
diff --git a/zephyr/zmake/zmake/version.py b/zephyr/zmake/zmake/version.py
index 6cc37f95d4..cddce86ca5 100644
--- a/zephyr/zmake/zmake/version.py
+++ b/zephyr/zmake/zmake/version.py
@@ -2,8 +2,8 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
-import subprocess
import os
+import subprocess
import zmake.util as util