Skip to content

Commit

Permalink
Add comma and quotes flake8 plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
JakobGM committed May 5, 2018
1 parent 3719fc8 commit 11a50fe
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 19 deletions.
4 changes: 2 additions & 2 deletions astrality/module.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ def replace_placeholders(match: Match) -> str:

if absolute_path in performed_compilations:
# TODO: Is joining the right thing to do here?
return " ".join(
return ' '.join(
[
str(path)
for path
Expand Down Expand Up @@ -345,7 +345,7 @@ def valid_module(
else:
logger.warning(
f'[module/{name}] ' +
", ".join([
', '.join([
repr(requirement)
for requirement
in requirements
Expand Down
2 changes: 1 addition & 1 deletion astrality/tests/event_listener/test_periodic.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def periodic():
return Periodic({'type': 'periodic'})


@pytest.mark.parametrize("event, is_event", [
@pytest.mark.parametrize('event, is_event', [
('0', True),
('1', True),
('80', True),
Expand Down
6 changes: 3 additions & 3 deletions astrality/tests/module/test_permissions.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
from astrality.module import ModuleManager


@pytest.mark.parametrize("specified_permission,expected_permission", [
("777", 0o777),
("100", 0o100),
@pytest.mark.parametrize('specified_permission,expected_permission', [
('777', 0o777),
('100', 0o100),
])
def test_compiling_template_with_specific_permissions(
test_config_directory,
Expand Down
10 changes: 5 additions & 5 deletions astrality/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,11 @@ def generate_expanded_env_dict() -> Dict[str, str]:
env_dict[name] = os.path.expandvars(value)
except ValueError as e:
if 'invalid interpolation syntax' in str(e):
logger.warning(f'''
Could not use environment variable {name}={value}.
It is too complex for expansion, using unexpanded value
instead...
''')
logger.warning(
f'Could not use environment variable {name}={value}.'
'It is too complex for expansion, using unexpanded value'
'instead...',
)
env_dict[name] = value
else:
raise
Expand Down
10 changes: 5 additions & 5 deletions conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@

def pytest_addoption(parser):
"""Add command line flags to pytest."""
parser.addoption("--runslow", action="store_true",
default=False, help="run slow tests")
parser.addoption('--runslow", action="store_true',
default=False, help='run slow tests')


def pytest_collection_modifyitems(config, items):
"""Skip slow tests if not --runslow is given to pytest."""
if config.getoption("--runslow"):
if config.getoption('--runslow'):
# --runslow given in cli: do not skip slow tests
return
else: # pragma: no cover
skip_slow = pytest.mark.skip(reason="need --runslow option to run")
skip_slow = pytest.mark.skip(reason='need --runslow option to run')
for item in items:
if "slow" in item.keywords:
if 'slow' in item.keywords:
item.add_marker(skip_slow)
6 changes: 6 additions & 0 deletions requirements.in
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ watchdog
# For linting python files
flake8

# For enforcing trailing commas
flake8-commas

# For enforcing single quote string literals
flake8-quotes

# Sphinx extension which inspects type annotations when using autodoc
sphinx-autodoc-typehints

Expand Down
2 changes: 2 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ click==6.7 # via pip-tools
coloredlogs==9.3.1
docutils==0.14 # via sphinx
first==2.0.1 # via pip-tools
flake8-commas==2.0.0
flake8-quotes==1.0.0
flake8==3.5.0
freezegun==0.3.10 # via pytest-freezegun
humanfriendly==4.12 # via coloredlogs
Expand Down
6 changes: 3 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ def readme():
author_email='jakobgm@gmail.com',
description='A dynamic configuration file manager.',
long_description=readme(),
license="MIT",
keywords="unix configuration management",
url="http://github.com/JakobGM/astrality",
license='MIT',
keywords='unix configuration management',
url='http://github.com/JakobGM/astrality',

classifiers=[
'Development Status :: 4 - Beta',
Expand Down

0 comments on commit 11a50fe

Please sign in to comment.