From 2ed1572c3cfd54749d6e838cb83260a984a90964 Mon Sep 17 00:00:00 2001 From: cclauss Date: Fri, 17 May 2019 09:00:25 +0200 Subject: [PATCH 1/2] Travis CI: Use flake8 to find Python syntax errors Also, put the execution steps in order: 1. before_install --> 2. install --> 3. before_script --> 4. script --> 5. after success --> 6. notifications --- .travis.yml | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/.travis.yml b/.travis.yml index 6c8e2ac8..b8ba56e7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,8 +7,13 @@ python: dist: xenial services: - docker +cache: pip +before_install: + - pip install --upgrade pip wheel + - pip install codecov coveralls flake8 mock pytest pytest-cov selenium + # - docker build -t zeronet . + # - docker run -d -v $PWD:/root/data -p 15441:15441 -p 127.0.0.1:43110:43110 zeronet install: - - pip install -U pip wheel - pip install -r requirements.txt - pip list before_script: @@ -26,18 +31,10 @@ script: - python -m pytest src/Test --cov=src --cov-config src/Test/coverage.ini - mv plugins/disabled-Multiuser plugins/Multiuser && python -m pytest -x plugins/Multiuser/Test - mv plugins/disabled-Bootstrapper plugins/Bootstrapper && python -m pytest -x plugins/Bootstrapper/Test -before_install: - - pip install -U pytest mock pytest-cov selenium - - pip install codecov - - pip install coveralls - # - docker build -t zeronet . - # - docker run -d -v $PWD:/root/data -p 15441:15441 -p 127.0.0.1:43110:43110 zeronet + - flake8 . --count --select=E9,F63,F72,F82 --show-source --statistics after_success: - codecov - coveralls --rcfile=src/Test/coverage.ini -cache: - directories: - - $HOME/.cache/pip notifications: email: recipients: From 8962c16670bdb01be7c7ffc4611fa81510d2672a Mon Sep 17 00:00:00 2001 From: cclauss Date: Fri, 17 May 2019 12:33:10 +0200 Subject: [PATCH 2/2] Declare 'err' because Python 3 has stricter scoping rules I Python 3, __err__ will go out of scope after the __try / except__ block. This change preserves the value after the end of the __try / except__ block. --- src/main.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main.py b/src/main.py index c3ea2176..b6d8c27d 100644 --- a/src/main.py +++ b/src/main.py @@ -208,6 +208,7 @@ class Actions(object): for content_inner_path in site.content_manager.contents: s = time.time() logging.info("Verifing %s signature..." % content_inner_path) + err = None try: file_correct = site.content_manager.verifyFile( content_inner_path, site.storage.open(content_inner_path, "rb"), ignore_same=False