Skip to content

Commit fcbc745

Browse files
authored
Merge pull request pre-commit#3597 from pre-commit/empty-setup-py
fix python local template when artifact dirs are present
2 parents 67e8faf + 51592ee commit fcbc745

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
from setuptools import setup
22

33

4-
setup(name='pre-commit-placeholder-package', version='0.0.0')
4+
setup(name='pre-commit-placeholder-package', version='0.0.0', py_modules=[])

tests/languages/python_test.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
from pre_commit.envcontext import envcontext
1111
from pre_commit.languages import python
1212
from pre_commit.prefix import Prefix
13+
from pre_commit.store import _make_local_repo
14+
from pre_commit.util import cmd_output_b
1315
from pre_commit.util import make_executable
1416
from pre_commit.util import win_exe
1517
from testing.auto_namedtuple import auto_namedtuple
@@ -351,3 +353,15 @@ def test_python_hook_weird_setup_cfg(tmp_path):
351353

352354
ret = run_language(tmp_path, python, 'socks', [os.devnull])
353355
assert ret == (0, f'[{os.devnull!r}]\nhello hello\n'.encode())
356+
357+
358+
def test_local_repo_with_other_artifacts(tmp_path):
359+
cmd_output_b('git', 'init', tmp_path)
360+
_make_local_repo(str(tmp_path))
361+
# pretend a rust install also ran here
362+
tmp_path.joinpath('target').mkdir()
363+
364+
ret, out = run_language(tmp_path, python, 'python --version')
365+
366+
assert ret == 0
367+
assert out.startswith(b'Python ')

0 commit comments

Comments
 (0)