summaryrefslogtreecommitdiffstats
path: root/run_tests
diff options
context:
space:
mode:
Diffstat (limited to 'run_tests')
-rwxr-xr-xrun_tests24
1 files changed, 21 insertions, 3 deletions
diff --git a/run_tests b/run_tests
index 0ea098a6..e76f9d8c 100755
--- a/run_tests
+++ b/run_tests
@@ -13,10 +13,28 @@
13# See the License for the specific language governing permissions and 13# See the License for the specific language governing permissions and
14# limitations under the License. 14# limitations under the License.
15 15
16"""Wrapper to run pytest with the right settings.""" 16"""Wrapper to run black and pytest with the right settings."""
17 17
18import os
19import subprocess
18import sys 20import sys
19import pytest 21import pytest
20 22
21if __name__ == '__main__': 23
22 sys.exit(pytest.main(sys.argv[1:])) 24def run_black():
25 """Returns the exit code of running `black --check`."""
26 dirpath = os.path.dirname(os.path.realpath(__file__))
27 return subprocess.run(
28 [sys.executable, "-m", "black", "--check", dirpath], check=False
29 ).returncode
30
31
32def main(argv):
33 """The main entry."""
34 black_ret = 0 if argv else run_black()
35 pytest_ret = pytest.main(argv)
36 return 0 if not black_ret and not pytest_ret else 1
37
38
39if __name__ == "__main__":
40 sys.exit(main(sys.argv[1:]))