Skip to content

Commit

Permalink
Fix linter errors, add linter to tox
Browse files Browse the repository at this point in the history
  • Loading branch information
mesozoic committed Apr 21, 2022
1 parent ba2a8ab commit a1935ec
Show file tree
Hide file tree
Showing 27 changed files with 33 additions and 31 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ jobs:
run:
name: "tests & coverage"
runs-on: macos-latest
strategy:
matrix:
python-version: [3.8]

env:
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }}
Expand All @@ -19,7 +23,7 @@ jobs:
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: 3.8
python-version: ${{ matrix.python-version }}

- name: Install test dependencies
run: |
Expand Down
1 change: 0 additions & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
"""Common pytest fixtures."""



from contextlib import contextmanager
import os
from shutil import rmtree
Expand Down
1 change: 0 additions & 1 deletion tests/test_background.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
"""Unit tests for :mod:`workflow.background`."""



import os
from time import sleep

Expand Down
1 change: 0 additions & 1 deletion tests/test_notify.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
"""Unit tests for notifications."""



import hashlib
import logging
import os
Expand Down
1 change: 0 additions & 1 deletion tests/test_util_atomic.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
"""Unit tests for :func:`~workflow.util.atomic_writer`."""



import json
import os

Expand Down
1 change: 0 additions & 1 deletion tests/test_util_lockfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
"""Test LockFile functionality."""



from collections import namedtuple
from multiprocessing import Pool
import os
Expand Down
1 change: 0 additions & 1 deletion tests/test_util_uninterruptible.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
"""Unit tests for ``uninterruptible`` decorator."""



import os
import signal

Expand Down
5 changes: 4 additions & 1 deletion tests/test_web.py
Original file line number Diff line number Diff line change
Expand Up @@ -344,12 +344,15 @@ def test_file_upload_without_form_data(self):
def test_file_upload_with_unicode(self):
"""File upload with Unicode contents is converted to bytes"""
url = HTTPBIN_URL + '/post'
content = 'Hére ïs søme ÜÑÎÇÒDÈ™'
files = {'file': {'filename': 'cönfüsed.txt',
'content': 'Hére ïs søme ÜÑÎÇÒDÈ™'
'content': content
}}
r = web.post(url, files=files)
self.assertEqual(r.status_code, 200)
data = r.json()
bindata = data['files']['file']
self.assertEqual(bindata, content)

def test_json_encoding(self):
"""JSON decoded correctly"""
Expand Down
1 change: 0 additions & 1 deletion tests/test_web_http_encoding.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
"""HTTP unit tests."""



import os

import pytest
Expand Down
1 change: 0 additions & 1 deletion tests/test_workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
"""Unit tests for :mod:`workflow.Workflow`."""



import logging
import os
import sys
Expand Down
1 change: 0 additions & 1 deletion tests/test_workflow3.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
"""Test Workflow3 feedback."""



import json
import os
from io import StringIO
Expand Down
1 change: 0 additions & 1 deletion tests/test_workflow_encoding.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
"""Unit tests for serializers."""



import pytest


Expand Down
1 change: 0 additions & 1 deletion tests/test_workflow_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
"""Unit tests for environment/info.plist."""



import logging
import os

Expand Down
1 change: 0 additions & 1 deletion tests/test_workflow_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
"""Unit tests for Workflow directory & file APIs."""



import json
import os
import time
Expand Down
1 change: 0 additions & 1 deletion tests/test_workflow_filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
"""Unit tests for :meth:`workflow.Workflow.filter`."""



import pytest

from workflow.workflow import (
Expand Down
1 change: 0 additions & 1 deletion tests/test_workflow_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
"""Unit tests for sys.path manipulation."""



import os
import sys

Expand Down
1 change: 0 additions & 1 deletion tests/test_workflow_keychain.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
"""Unit tests for Keychain API."""



import pytest

from workflow.workflow import PasswordNotFound, KeychainError
Expand Down
1 change: 0 additions & 1 deletion tests/test_workflow_magic.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
"""Unit tests for magic arguments."""



import os

import pytest
Expand Down
1 change: 0 additions & 1 deletion tests/test_workflow_magic_alfred2.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
"""Unit tests for Alfred 2 magic argument handling."""



import pytest

from workflow import Workflow
Expand Down
1 change: 0 additions & 1 deletion tests/test_workflow_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
"""Unit tests for Workflow.run."""



from io import StringIO
import sys

Expand Down
1 change: 0 additions & 1 deletion tests/test_workflow_serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
"""Unit tests for serializer classes."""



import os

import pytest
Expand Down
1 change: 0 additions & 1 deletion tests/test_workflow_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
"""Unit tests for Workflow.settings API."""



import json
import os
import shutil
Expand Down
21 changes: 16 additions & 5 deletions tests/test_workflow_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
"""Unit tests for Workflow's update API."""



from contextlib import contextmanager

import os
Expand Down Expand Up @@ -91,13 +90,19 @@ def update(wf):
with fakeresponse(httpserver, RELEASES_JSON, HTTP_HEADERS_JSON):
with ctx() as (wf, c):
wf.run(update)
assert c.cmd == ['/usr/bin/python3', '-m', 'workflow.background', '__workflow_update_check']
assert c.cmd == [
'/usr/bin/python3', '-m', 'workflow.background',
'__workflow_update_check'
]

update_settings = UPDATE_SETTINGS.copy()
update_settings['prereleases'] = True
with ctx(update_settings=update_settings) as (wf, c):
wf.run(update)
assert c.cmd == ['/usr/bin/python3', '-m', 'workflow.background', '__workflow_update_check']
assert c.cmd == [
'/usr/bin/python3', '-m', 'workflow.background',
'__workflow_update_check'
]


def test_install_update(httpserver, alfred4):
Expand All @@ -114,7 +119,10 @@ def fake(wf):

print('Magic update command : {0!r}'.format(c.cmd))

assert c.cmd == ['/usr/bin/python3', '-m', 'workflow.background', '__workflow_update_install']
assert c.cmd == [
'/usr/bin/python3', '-m', 'workflow.background',
'__workflow_update_install'
]

update_settings = UPDATE_SETTINGS.copy()
del update_settings['version']
Expand Down Expand Up @@ -161,7 +169,10 @@ def fake(wf):

print('Magic update command : {!r}'.format(c.cmd))

assert c.cmd == ['/usr/bin/python3', '-m', 'workflow.background', '__workflow_update_install']
assert c.cmd == [
'/usr/bin/python3', '-m', 'workflow.background',
'__workflow_update_install'
]

with env(alfred_workflow_version='v10.0-beta'):
update_settings = UPDATE_SETTINGS.copy()
Expand Down
1 change: 0 additions & 1 deletion tests/test_workflow_versions.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
"""Unit tests for workflow version determination."""



import pytest

from workflow.update import Version
Expand Down
1 change: 0 additions & 1 deletion tests/test_workflow_xml.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
"""Unit tests for Workflow's XML feedback generation."""



from contextlib import contextmanager
from io import StringIO
import sys
Expand Down
1 change: 0 additions & 1 deletion tests/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
"""Stuff used in multiple tests."""



from io import StringIO
import sys
import os
Expand Down
9 changes: 8 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,15 @@ usedevelop = true
deps =
-r requirements-test.txt
coverage
commands =
./run-tests.sh

commands = ./run-tests.sh
[testenv:lint]
usedevelop = true
deps =
-r requirements-test.txt
commands =
./run-tests.sh -l

[flake8]
builtins = unicode
Expand Down

0 comments on commit a1935ec

Please sign in to comment.