diff --git a/tests/commands/install_uninstall_test.py b/tests/commands/install_uninstall_test.py index ad8d2456..d00d55d7 100644 --- a/tests/commands/install_uninstall_test.py +++ b/tests/commands/install_uninstall_test.py @@ -118,7 +118,7 @@ def test_uninstall(tempdir_factory): def _get_commit_output(tempdir_factory, touch_file='foo', **kwargs): - cmd_output('touch', touch_file) + open(touch_file, 'a').close() cmd_output('git', 'add', touch_file) return cmd_output_mocked_pre_commit_home( 'git', 'commit', '-am', 'Commit!', '--allow-empty', diff --git a/tests/conftest.py b/tests/conftest.py index 140463b1..9813e9ac 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -68,7 +68,7 @@ def _make_conflict(): def in_merge_conflict(tempdir_factory): path = make_consuming_repo(tempdir_factory, 'script_hooks_repo') with cwd(path): - cmd_output('touch', 'dummy') + open('dummy', 'a').close() cmd_output('git', 'add', 'dummy') cmd_output('git', 'commit', '-m', 'Add config.') diff --git a/tests/make_archives_test.py b/tests/make_archives_test.py index f3636b53..5aa303f7 100644 --- a/tests/make_archives_test.py +++ b/tests/make_archives_test.py @@ -20,13 +20,13 @@ def test_make_archive(tempdir_factory): git_path = git_dir(tempdir_factory) # Add a files to the git directory with cwd(git_path): - cmd_output('touch', 'foo') + open('foo', 'a').close() cmd_output('git', 'add', '.') cmd_output('git', 'commit', '-m', 'foo') # We'll use this sha head_sha = get_head_sha('.') # And check that this file doesn't exist - cmd_output('touch', 'bar') + open('bar', 'a').close() cmd_output('git', 'add', '.') cmd_output('git', 'commit', '-m', 'bar') diff --git a/tests/store_test.py b/tests/store_test.py index 26857965..1bbcf44a 100644 --- a/tests/store_test.py +++ b/tests/store_test.py @@ -46,7 +46,7 @@ def test_store_require_created(store): # Should create the store directory assert os.path.exists(store.directory) # Should create a README file indicating what the directory is about - with io.open(os.path.join(store.directory, 'README'), 'r') as readme_file: + with io.open(os.path.join(store.directory, 'README')) as readme_file: readme_contents = readme_file.read() for text_line in ( 'This directory is maintained by the pre-commit project.', @@ -73,7 +73,7 @@ def test_does_not_recreate_if_directory_already_exists(store): # Note: we're intentionally leaving out the README file. This is so we can # know that `Store` didn't call create os.mkdir(store.directory) - io.open(store.db_path, 'a+').close() + open(store.db_path, 'a').close() # Call require_created, this should not call create store.require_created() assert not os.path.exists(os.path.join(store.directory, 'README'))