diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index f8987870..46a47341 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -21,3 +21,7 @@ hooks: - id: reorder-python-imports language_version: python2.7 +- repo: https://github.com/asottile/add-trailing-comma + sha: v0.3.0 + hooks: + - id: add-trailing-comma diff --git a/.travis.yml b/.travis.yml index 5ce1af6c..900446d2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,6 +12,7 @@ matrix: - env: TOXENV=py36 python: 3.6 - env: TOXENV=pypy + python: pypy-5.7.1 install: pip install coveralls tox script: tox before_install: diff --git a/pre_commit/color_windows.py b/pre_commit/color_windows.py index d44e0b80..dae41afe 100644 --- a/pre_commit/color_windows.py +++ b/pre_commit/color_windows.py @@ -20,18 +20,18 @@ def bool_errcheck(result, func, args): GetStdHandle = WINFUNCTYPE(HANDLE, DWORD)( ("GetStdHandle", windll.kernel32), - ((1, "nStdHandle"), ) + ((1, "nStdHandle"), ), ) GetConsoleMode = WINFUNCTYPE(BOOL, HANDLE, POINTER(DWORD))( ("GetConsoleMode", windll.kernel32), - ((1, "hConsoleHandle"), (2, "lpMode")) + ((1, "hConsoleHandle"), (2, "lpMode")), ) GetConsoleMode.errcheck = bool_errcheck SetConsoleMode = WINFUNCTYPE(BOOL, HANDLE, DWORD)( ("SetConsoleMode", windll.kernel32), - ((1, "hConsoleHandle"), (1, "dwMode")) + ((1, "hConsoleHandle"), (1, "dwMode")), ) SetConsoleMode.errcheck = bool_errcheck diff --git a/pre_commit/commands/autoupdate.py b/pre_commit/commands/autoupdate.py index 99a5d62f..620a8a6e 100644 --- a/pre_commit/commands/autoupdate.py +++ b/pre_commit/commands/autoupdate.py @@ -59,7 +59,7 @@ def _update_repo(repo_config, runner, tags_only): if hooks_missing: raise RepositoryCannotBeUpdatedError( 'Cannot update because the tip of master is missing these hooks:\n' - '{}'.format(', '.join(sorted(hooks_missing))) + '{}'.format(', '.join(sorted(hooks_missing))), ) return new_config diff --git a/pre_commit/commands/install_uninstall.py b/pre_commit/commands/install_uninstall.py index 6268b918..36b0d7d7 100644 --- a/pre_commit/commands/install_uninstall.py +++ b/pre_commit/commands/install_uninstall.py @@ -51,7 +51,7 @@ def install( 'Running in migration mode with existing hooks at {}\n' 'Use -f to use only pre-commit.'.format( legacy_path, - ) + ), ) with io.open(hook_path, 'w') as pre_commit_file_obj: diff --git a/pre_commit/commands/run.py b/pre_commit/commands/run.py index 99d3a189..676c5044 100644 --- a/pre_commit/commands/run.py +++ b/pre_commit/commands/run.py @@ -235,7 +235,7 @@ def run(runner, args, environ=os.environ): logger.error( 'Your .pre-commit-config.yaml is unstaged.\n' '`git add .pre-commit-config.yaml` to fix this.\n' - 'Run pre-commit with --allow-unstaged-config to silence this.' + 'Run pre-commit with --allow-unstaged-config to silence this.', ) return 1 diff --git a/pre_commit/git.py b/pre_commit/git.py index 754514aa..4b519c86 100644 --- a/pre_commit/git.py +++ b/pre_commit/git.py @@ -21,7 +21,7 @@ def get_root(): except CalledProcessError: raise FatalError( 'git failed. Is it installed, and are you in a Git repository ' - 'directory?' + 'directory?', ) @@ -79,7 +79,7 @@ def get_staged_files(): return cmd_output( 'git', 'diff', '--staged', '--name-only', '--no-ext-diff', # Everything except for D - '--diff-filter=ACMRTUXB' + '--diff-filter=ACMRTUXB', )[1].splitlines() @@ -130,5 +130,5 @@ def check_for_cygwin_mismatch(): ' - git {}\n'.format( exe_type[is_cygwin_python], exe_type[is_cygwin_git], - ) + ), ) diff --git a/pre_commit/languages/docker.py b/pre_commit/languages/docker.py index 59dc1b41..8404ac84 100644 --- a/pre_commit/languages/docker.py +++ b/pre_commit/languages/docker.py @@ -23,7 +23,7 @@ def md5(s): # pragma: windows no cover def docker_tag(repo_cmd_runner): # pragma: windows no cover return 'pre-commit-{}'.format( - md5(os.path.basename(repo_cmd_runner.path())) + md5(os.path.basename(repo_cmd_runner.path())), ).lower() @@ -92,7 +92,7 @@ def run_hook(repo_cmd_runner, hook, file_args): # pragma: windows no cover '-v', '{}:/src:rw'.format(os.getcwd()), '--workdir', '/src', '--entrypoint', entry_executable, - docker_tag(repo_cmd_runner) + docker_tag(repo_cmd_runner), ) + cmd_rest return xargs(cmd, file_args) diff --git a/pre_commit/languages/python.py b/pre_commit/languages/python.py index eea156b4..11f37765 100644 --- a/pre_commit/languages/python.py +++ b/pre_commit/languages/python.py @@ -107,7 +107,7 @@ def install_environment(repo_cmd_runner, version, additional_dependencies): with clean_path_on_failure(repo_cmd_runner.path(directory)): venv_cmd = [ sys.executable, '-m', 'virtualenv', - '{{prefix}}{}'.format(directory) + '{{prefix}}{}'.format(directory), ] if version != 'default': venv_cmd.extend(['-p', norm_version(version)]) diff --git a/pre_commit/languages/ruby.py b/pre_commit/languages/ruby.py index 26e303c3..6a0bde27 100644 --- a/pre_commit/languages/ruby.py +++ b/pre_commit/languages/ruby.py @@ -81,7 +81,7 @@ def _install_rbenv( # directory "export GEM_HOME='{directory}/gems'\n" 'export PATH="$GEM_HOME/bin:$PATH"\n' - '\n'.format(directory=repo_cmd_runner.path(directory)) + '\n'.format(directory=repo_cmd_runner.path(directory)), ) # If we aren't using the system ruby, add a version here diff --git a/pre_commit/logging_handler.py b/pre_commit/logging_handler.py index 78c2827a..7241cd67 100644 --- a/pre_commit/logging_handler.py +++ b/pre_commit/logging_handler.py @@ -30,7 +30,7 @@ class LoggingHandler(logging.Handler): self.use_color, ) + ' ', record.getMessage(), - ) + ), ) diff --git a/pre_commit/main.py b/pre_commit/main.py index baaf84b6..02eed40e 100644 --- a/pre_commit/main.py +++ b/pre_commit/main.py @@ -41,7 +41,7 @@ def _add_color_option(parser): def _add_config_option(parser): parser.add_argument( '-c', '--config', default='.pre-commit-config.yaml', - help='Path to alternate config file' + help='Path to alternate config file', ) @@ -228,11 +228,11 @@ def main(argv=None): return sample_config() else: raise NotImplementedError( - 'Command {} not implemented.'.format(args.command) + 'Command {} not implemented.'.format(args.command), ) raise AssertionError( - 'Command {} failed to exit with a returncode'.format(args.command) + 'Command {} failed to exit with a returncode'.format(args.command), ) diff --git a/pre_commit/make_archives.py b/pre_commit/make_archives.py index 4baaaa18..c672fc18 100644 --- a/pre_commit/make_archives.py +++ b/pre_commit/make_archives.py @@ -28,7 +28,7 @@ REPOS = ( RESOURCES_DIR = os.path.abspath( - os.path.join(os.path.dirname(__file__), 'resources') + os.path.join(os.path.dirname(__file__), 'resources'), ) diff --git a/pre_commit/manifest.py b/pre_commit/manifest.py index 081f3c60..c0c627fc 100644 --- a/pre_commit/manifest.py +++ b/pre_commit/manifest.py @@ -31,7 +31,7 @@ class Manifest(object): 'If `pre-commit autoupdate` does not silence this warning ' 'consider making an issue / pull request.'.format( self.repo_url, C.MANIFEST_FILE_LEGACY, C.MANIFEST_FILE, - ) + ), ) return load_manifest(legacy_path) else: diff --git a/pre_commit/output.py b/pre_commit/output.py index 36596090..478ad5e6 100644 --- a/pre_commit/output.py +++ b/pre_commit/output.py @@ -50,7 +50,7 @@ def get_hook_message( raise ValueError('Expected one of (`end_msg`, `end_len`)') if end_msg is not None and (end_color is None or use_color is None): raise ValueError( - '`end_color` and `use_color` are required with `end_msg`' + '`end_color` and `use_color` are required with `end_msg`', ) if end_len: diff --git a/pre_commit/prefixed_command_runner.py b/pre_commit/prefixed_command_runner.py index 6ae85099..c2de526b 100644 --- a/pre_commit/prefixed_command_runner.py +++ b/pre_commit/prefixed_command_runner.py @@ -20,7 +20,7 @@ class PrefixedCommandRunner(object): self, prefix_dir, popen=subprocess.Popen, - makedirs=os.makedirs + makedirs=os.makedirs, ): self.prefix_dir = prefix_dir.rstrip(os.sep) + os.sep self.__popen = popen diff --git a/pre_commit/repository.py b/pre_commit/repository.py index 2c1eedb3..fcc79bd6 100644 --- a/pre_commit/repository.py +++ b/pre_commit/repository.py @@ -72,7 +72,7 @@ def _install_all(venvs, repo_url): if need_installed: logger.info( - 'Installing environment for {}.'.format(repo_url) + 'Installing environment for {}.'.format(repo_url), ) logger.info('Once installed this environment will be reused.') logger.info('This may take a few minutes...') @@ -102,7 +102,7 @@ def _validate_minimum_version(hook): 'version {} is installed. ' 'Perhaps run `pip install --upgrade pre-commit`.'.format( hook['id'], hook_version, C.VERSION_PARSED, - ) + ), ) exit(1) return hook @@ -147,7 +147,7 @@ class Repository(object): 'Typo? Perhaps it is introduced in a newer version? ' 'Often `pre-commit autoupdate` fixes this.'.format( hook['id'], self.repo_config['repo'], - ) + ), ) exit(1) diff --git a/pre_commit/schema.py b/pre_commit/schema.py index d34ad737..5f22277d 100644 --- a/pre_commit/schema.py +++ b/pre_commit/schema.py @@ -112,7 +112,7 @@ def _check_conditional(self, dct): cond_key=self.condition_key, op=op, cond_val=cond_val, - ) + ), ) diff --git a/pre_commit/staged_files_only.py b/pre_commit/staged_files_only.py index d6ace66f..862c6bd1 100644 --- a/pre_commit/staged_files_only.py +++ b/pre_commit/staged_files_only.py @@ -49,7 +49,7 @@ def staged_files_only(cmd_runner): except CalledProcessError: logger.warning( 'Stashed changes conflicted with hook auto-fixes... ' - 'Rolling back fixes...' + 'Rolling back fixes...', ) # We failed to apply the patch, presumably due to fixes made # by hooks. diff --git a/pre_commit/store.py b/pre_commit/store.py index 67564483..ee1f755b 100644 --- a/pre_commit/store.py +++ b/pre_commit/store.py @@ -49,7 +49,7 @@ class Store(object): with io.open(os.path.join(self.directory, 'README'), 'w') as readme: readme.write( 'This directory is maintained by the pre-commit project.\n' - 'Learn more: https://github.com/pre-commit/pre-commit\n' + 'Learn more: https://github.com/pre-commit/pre-commit\n', ) def _write_sqlite_db(self): @@ -68,7 +68,7 @@ class Store(object): ' ref CHAR(255) NOT NULL,' ' path CHAR(255) NOT NULL,' ' PRIMARY KEY (repo, ref)' - ');' + ');', ) # Atomic file move diff --git a/pre_commit/util.py b/pre_commit/util.py index 4c3ad421..b0095843 100644 --- a/pre_commit/util.py +++ b/pre_commit/util.py @@ -124,7 +124,7 @@ class CalledProcessError(RuntimeError): if maybe_text: output.append( b'\n ' + - five.to_bytes(maybe_text).replace(b'\n', b'\n ') + five.to_bytes(maybe_text).replace(b'\n', b'\n '), ) else: output.append(b'(none)') @@ -134,8 +134,8 @@ class CalledProcessError(RuntimeError): 'Command: {!r}\n' 'Return code: {}\n' 'Expected return code: {}\n'.format( - self.cmd, self.returncode, self.expected_returncode - ) + self.cmd, self.returncode, self.expected_returncode, + ), ), b'Output: ', output[0], b'\n', b'Errors: ', output[1], b'\n', diff --git a/testing/fixtures.py b/testing/fixtures.py index dffff4ca..4a3f1446 100644 --- a/testing/fixtures.py +++ b/testing/fixtures.py @@ -75,7 +75,7 @@ def config_with_local_hooks(): ('entry', 'DO NOT COMMIT'), ('language', 'pcre'), ('files', '^(.*)$'), - ))]) + ))]), )) diff --git a/testing/util.py b/testing/util.py index 4d752f3e..332b6418 100644 --- a/testing/util.py +++ b/testing/util.py @@ -34,7 +34,7 @@ def cmd_output_mocked_pre_commit_home(*args, **kwargs): skipif_cant_run_docker = pytest.mark.skipif( docker_is_running() is False, - reason='Docker isn\'t running or can\'t be accessed' + reason='Docker isn\'t running or can\'t be accessed', ) skipif_slowtests_false = pytest.mark.skipif( @@ -44,7 +44,7 @@ skipif_slowtests_false = pytest.mark.skipif( skipif_cant_run_swift = pytest.mark.skipif( parse_shebang.find_executable('swift') is None, - reason='swift isn\'t installed or can\'t be found' + reason='swift isn\'t installed or can\'t be found', ) xfailif_windows_no_ruby = pytest.mark.xfail( diff --git a/tests/clientlib_test.py b/tests/clientlib_test.py index 65209a64..9e66025d 100644 --- a/tests/clientlib_test.py +++ b/tests/clientlib_test.py @@ -208,7 +208,7 @@ def test_validate_manifest_main(args, expected_output): }], True, ), - ) + ), ) def test_valid_manifests(manifest_obj, expected): ret = is_valid_according_to_schema(manifest_obj, MANIFEST_SCHEMA) diff --git a/tests/commands/autoupdate_test.py b/tests/commands/autoupdate_test.py index 550946b6..8dac48c4 100644 --- a/tests/commands/autoupdate_test.py +++ b/tests/commands/autoupdate_test.py @@ -105,7 +105,7 @@ def test_out_of_date_repo(out_of_date_repo, runner_with_mocked_store): def test_autoupdate_out_of_date_repo( - out_of_date_repo, in_tmpdir, mock_out_store_directory + out_of_date_repo, in_tmpdir, mock_out_store_directory, ): # Write out the config config = make_config_from_repo( @@ -181,7 +181,7 @@ def hook_disappearing_repo(tempdir_factory): def test_hook_disppearing_repo_raises( - hook_disappearing_repo, runner_with_mocked_store + hook_disappearing_repo, runner_with_mocked_store, ): config = make_config_from_repo( hook_disappearing_repo.path, @@ -193,7 +193,7 @@ def test_hook_disppearing_repo_raises( def test_autoupdate_hook_disappearing_repo( - hook_disappearing_repo, in_tmpdir, mock_out_store_directory + hook_disappearing_repo, in_tmpdir, mock_out_store_directory, ): config = make_config_from_repo( hook_disappearing_repo.path, @@ -222,7 +222,7 @@ def test_autoupdate_local_hooks(tempdir_factory): def test_autoupdate_local_hooks_with_out_of_date_repo( - out_of_date_repo, in_tmpdir, mock_out_store_directory + out_of_date_repo, in_tmpdir, mock_out_store_directory, ): stale_config = make_config_from_repo( out_of_date_repo.path, sha=out_of_date_repo.original_sha, check=False, diff --git a/tests/commands/install_uninstall_test.py b/tests/commands/install_uninstall_test.py index d00d55d7..1fb0f8f1 100644 --- a/tests/commands/install_uninstall_test.py +++ b/tests/commands/install_uninstall_test.py @@ -145,7 +145,7 @@ NORMAL_PRE_COMMIT_RUN = re.compile( r'Bash hook\.+Passed\r?\n' r'\[master [a-f0-9]{7}\] Commit!\r?\n' + FILES_CHANGED + - r' create mode 100644 foo\r?\n$' + r' create mode 100644 foo\r?\n$', ) @@ -259,7 +259,7 @@ FAILING_PRE_COMMIT_RUN = re.compile( r'\r?\n' r'Fail\r?\n' r'foo\r?\n' - r'\r?\n$' + r'\r?\n$', ) @@ -277,7 +277,7 @@ EXISTING_COMMIT_RUN = re.compile( r'^legacy hook\r?\n' r'\[master [a-f0-9]{7}\] Commit!\r?\n' + FILES_CHANGED + - r' create mode 100644 baz\r?\n$' + r' create mode 100644 baz\r?\n$', ) @@ -332,7 +332,7 @@ def test_install_existing_hook_no_overwrite_idempotent(tempdir_factory): FAIL_OLD_HOOK = re.compile( r'fail!\r?\n' r'\[INFO\] Initializing environment for .+\.\r?\n' - r'Bash hook\.+Passed\r?\n' + r'Bash hook\.+Passed\r?\n', ) @@ -448,7 +448,7 @@ PRE_INSTALLED = re.compile( r'Bash hook\.+Passed\r?\n' r'\[master [a-f0-9]{7}\] Commit!\r?\n' + FILES_CHANGED + - r' create mode 100644 foo\r?\n$' + r' create mode 100644 foo\r?\n$', ) diff --git a/tests/commands/run_test.py b/tests/commands/run_test.py index 1643cbb8..01164a63 100644 --- a/tests/commands/run_test.py +++ b/tests/commands/run_test.py @@ -220,7 +220,7 @@ def test_show_diff_on_failure( True, ), ({}, (b'Bash hook', b'(no files to check)', b'Skipped'), 0, False), - ) + ), ) def test_run( cap_out, @@ -259,7 +259,7 @@ def test_run_output_logfile( git_path, {}, expected_output, expected_ret=1, - stage=True + stage=True, ) logfile_path = os.path.join(git_path, 'test.log') assert os.path.exists(logfile_path) @@ -301,7 +301,7 @@ def test_always_run_alt_config( (b'Bash hook', b'Passed'), 0, stage=False, - config_file=alt_config_file + config_file=alt_config_file, ) @@ -311,7 +311,7 @@ def test_always_run_alt_config( ('master', 'master', False), ('master', '', True), ('', 'master', True), - ) + ), ) def test_origin_source_error_msg( repo_with_passing_hook, origin, source, expect_failure, @@ -588,7 +588,7 @@ def test_lots_of_files(mock_out_store_directory, tempdir_factory): ('commit', [], ['commit'], [b'hook 1', b'hook 2']), ('commit', ['push'], ['commit'], [b'', b'hook 2']), ('commit', ['commit'], ['push'], [b'hook 1', b'']), - ) + ), ) def test_local_hook_for_stages( cap_out, @@ -606,15 +606,15 @@ def test_local_hook_for_stages( ('entry', 'python -m flake8.__main__'), ('language', 'system'), ('files', r'\.py$'), - ('stages', stage_for_first_hook) + ('stages', stage_for_first_hook), )), OrderedDict(( ('id', 'do_not_commit'), ('name', 'hook 2'), ('entry', 'DO NOT COMMIT'), ('language', 'pcre'), ('files', '^(.*)$'), - ('stages', stage_for_second_hook) - )))) + ('stages', stage_for_second_hook), + )))), )) add_config_to_repo(repo_with_passing_hook, config) @@ -628,7 +628,7 @@ def test_local_hook_for_stages( {'hook_stage': hook_stage}, expected_outputs=expected_output, expected_ret=0, - stage=False + stage=False, ) @@ -649,7 +649,7 @@ def test_local_hook_passes( ('entry', 'DO NOT COMMIT'), ('language', 'pcre'), ('files', '^(.*)$'), - )))) + )))), )) add_config_to_repo(repo_with_passing_hook, config) @@ -678,7 +678,7 @@ def test_local_hook_fails( ('entry', 'sh -c "! grep -iI todo $@" --'), ('language', 'system'), ('files', ''), - ))]) + ))]), )) add_config_to_repo(repo_with_passing_hook, config) @@ -770,7 +770,7 @@ def test_files_running_subdir( (False, [], b''), (True, ['some', 'args'], b'some args foo.py'), (False, ['some', 'args'], b'some args'), - ) + ), ) def test_pass_filenames( cap_out, repo_with_passing_hook, mock_out_store_directory, diff --git a/tests/languages/docker_test.py b/tests/languages/docker_test.py index 6ca2ed5c..9f7f55cf 100644 --- a/tests/languages/docker_test.py +++ b/tests/languages/docker_test.py @@ -10,6 +10,6 @@ from pre_commit.util import CalledProcessError def test_docker_is_running_process_error(): with mock.patch( 'pre_commit.languages.docker.cmd_output', - side_effect=CalledProcessError(*(None,) * 4) + side_effect=CalledProcessError(*(None,) * 4), ): assert docker.docker_is_running() is False diff --git a/tests/prefixed_command_runner_test.py b/tests/prefixed_command_runner_test.py index 132c2a86..41b436c1 100644 --- a/tests/prefixed_command_runner_test.py +++ b/tests/prefixed_command_runner_test.py @@ -31,7 +31,7 @@ def test_CalledProcessError_str(): def test_CalledProcessError_str_nooutput(): error = CalledProcessError( - 1, [str('git'), str('status')], 0, (str(''), str('')) + 1, [str('git'), str('status')], 0, (str(''), str('')), ) assert str(error) == ( "Command: ['git', 'status']\n" diff --git a/tests/repository_test.py b/tests/repository_test.py index 7131d75b..9096161e 100644 --- a/tests/repository_test.py +++ b/tests/repository_test.py @@ -62,7 +62,7 @@ def test_python_hook(tempdir_factory, store): _test_hook_repo( tempdir_factory, store, 'python_hooks_repo', 'foo', [os.devnull], - b"['" + five.to_bytes(os.devnull) + b"']\nHello World\n" + b"['" + five.to_bytes(os.devnull) + b"']\nHello World\n", ) @@ -78,7 +78,7 @@ def test_python_hook_args_with_spaces(tempdir_factory, store): 'hooks': [{ 'id': 'foo', 'args': ['i have spaces', 'and"\'quotes', '$and !this'], - }] + }], }, ) @@ -93,7 +93,7 @@ def test_python_hook_weird_setup_cfg(tempdir_factory, store): _test_hook_repo( tempdir_factory, store, 'python_hooks_repo', 'foo', [os.devnull], - b"['" + five.to_bytes(os.devnull) + b"']\nHello World\n" + b"['" + five.to_bytes(os.devnull) + b"']\nHello World\n", ) @@ -160,7 +160,7 @@ def test_run_a_failing_docker_hook(tempdir_factory, store): tempdir_factory, store, 'docker_hooks_repo', 'docker-hook-failing', ['Hello World from docker'], b'', - expected_return_code=1 + expected_return_code=1, ) @@ -219,7 +219,7 @@ def test_run_ruby_hook_with_disable_shared_gems( tmpdir.join('.bundle').mkdir() tmpdir.join('.bundle', 'config').write( 'BUNDLE_DISABLE_SHARED_GEMS: true\n' - 'BUNDLE_PATH: vendor/gem\n' + 'BUNDLE_PATH: vendor/gem\n', ) with cwd(tmpdir.strpath): _test_hook_repo( @@ -322,7 +322,7 @@ def test_run_hook_with_curly_braced_arguments(tempdir_factory, store): 'hooks': [{ 'id': 'arg-per-line', 'args': ['hi {1}', "I'm {a} problem"], - }] + }], }, ) diff --git a/tests/runner_test.py b/tests/runner_test.py index a4f8cb7c..eb1f48ef 100644 --- a/tests/runner_test.py +++ b/tests/runner_test.py @@ -70,7 +70,7 @@ def test_local_hooks(tempdir_factory, mock_out_store_directory): ('entry', 'DO NOT COMMIT'), ('language', 'pcre'), ('files', '^(.*)$'), - )))) + )))), )) git_path = git_dir(tempdir_factory) add_config_to_repo(git_path, config) @@ -101,7 +101,7 @@ def test_local_hooks_alt_config(tempdir_factory, mock_out_store_directory): ('entry', 'DO NOT COMMIT'), ('language', 'pcre'), ('files', '^(.*)$'), - )))) + )))), )) git_path = git_dir(tempdir_factory) alt_config_file = 'alternate_config.yaml' diff --git a/tests/schema_test.py b/tests/schema_test.py index 914e6097..c2ecf0fa 100644 --- a/tests/schema_test.py +++ b/tests/schema_test.py @@ -366,7 +366,7 @@ def test_load_from_filename_fails_load_strategy(tmpdir): _assert_exception_trace( excinfo.value.args[0], # ANY is json's error message - ('File {}'.format(f.strpath), mock.ANY) + ('File {}'.format(f.strpath), mock.ANY), ) diff --git a/tests/store_test.py b/tests/store_test.py index 1bbcf44a..eab4b009 100644 --- a/tests/store_test.py +++ b/tests/store_test.py @@ -34,7 +34,7 @@ def test_get_default_directory_defaults_to_home(): def test_uses_environment_variable_when_present(): with mock.patch.dict( - os.environ, {'PRE_COMMIT_HOME': '/tmp/pre_commit_home'} + os.environ, {'PRE_COMMIT_HOME': '/tmp/pre_commit_home'}, ): ret = _get_default_directory() assert ret == '/tmp/pre_commit_home' @@ -89,7 +89,7 @@ def test_clone(store, tempdir_factory, log_info_mock): ret = store.clone(path, sha) # Should have printed some stuff assert log_info_mock.call_args_list[0][0][0].startswith( - 'Initializing environment for ' + 'Initializing environment for ', ) # Should return a directory inside of the store @@ -138,7 +138,7 @@ def test_clone_when_repo_already_exists(store): with sqlite3.connect(store.db_path) as db: db.execute( 'INSERT INTO repos (repo, ref, path) ' - 'VALUES ("fake_repo", "fake_ref", "fake_path")' + 'VALUES ("fake_repo", "fake_ref", "fake_path")', ) assert store.clone('fake_repo', 'fake_ref') == 'fake_path'