From cf82752c1da14ef0f20966a3327255cdd1548a6b Mon Sep 17 00:00:00 2001 From: Atsushi Mori Date: Sat, 27 Jul 2019 22:42:49 +0900 Subject: [PATCH 1/2] Fix: CI doesn't fail even if autopep8 makes changes --- .pre-commit-config.yaml | 2 +- appium/webdriver/extensions/applications.py | 4 ++-- ci.sh | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 20327acc..c612326a 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -2,7 +2,7 @@ rev: v1.4 hooks: - id: autopep8 - args: ["--global-config", ".config-pep8", "-i"] + args: ["-a", "--global-config", ".config-pep8", "-i"] - repo: https://github.com/pre-commit/mirrors-isort rev: v4.3.20 hooks: diff --git a/appium/webdriver/extensions/applications.py b/appium/webdriver/extensions/applications.py index 5456441a..6f77d7e7 100644 --- a/appium/webdriver/extensions/applications.py +++ b/appium/webdriver/extensions/applications.py @@ -177,9 +177,9 @@ def app_strings(self, language=None, string_file=None): string_file (str): the name of the string file to query """ data = {} - if language != None: + if language is not None: data['language'] = language - if string_file != None: + if string_file is not None: data['stringFile'] = string_file return self.execute(Command.GET_APP_STRINGS, data)['value'] diff --git a/ci.sh b/ci.sh index 0d5a6fd4..e471dede 100755 --- a/ci.sh +++ b/ci.sh @@ -1,8 +1,8 @@ #!/bin/bash -if ! python -m autopep8 -r --global-config .config-pep8 -i . ; then - echo "Please run command 'python -m autopep8 -r --global-config .config-pep8 -i .' on your local and commit the result" +if ! python -m autopep8 --exit-code -a -r --global-config .config-pep8 -i . ; then + echo "Please run command 'python -m autopep8 -a -r --global-config .config-pep8 -i .' on your local and commit the result" exit 1 fi From 16b4a1444b5cc2a79a27287a130e1b9d49b3e54c Mon Sep 17 00:00:00 2001 From: Atsushi Mori Date: Sat, 27 Jul 2019 23:03:23 +0900 Subject: [PATCH 2/2] Fix: CI failure --- test/unit/webdriver/device/location_test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/unit/webdriver/device/location_test.py b/test/unit/webdriver/device/location_test.py index 6ad6aef0..8e25e4a1 100644 --- a/test/unit/webdriver/device/location_test.py +++ b/test/unit/webdriver/device/location_test.py @@ -75,7 +75,7 @@ def test_set_location_without_altitude(self): d = get_httpretty_request_body(httpretty.last_request()) assert abs(d['location']['latitude'] - 11.1) <= FLT_EPSILON assert abs(d['location']['longitude'] - 22.2) <= FLT_EPSILON - assert d['location'].get('altitude') == None + assert d['location'].get('altitude') is None @httpretty.activate def test_location(self):