MCPcopy
hub / github.com/pre-commit/pre-commit / test_language_versioned_python_hook

Function test_language_versioned_python_hook

tests/languages/python_test.py:285–304  ·  view source on GitHub ↗
(tmp_path)

Source from the content-addressed store, hash-verified

283
284
285def test_language_versioned_python_hook(tmp_path):
286 setup_py = '''\
287from setuptools import setup
288setup(
289 name='example',
290 py_modules=['mod'],
291 entry_points={'console_scripts': ['myexe=mod:main']},
292)
293'''
294 tmp_path.joinpath('setup.py').write_text(setup_py)
295 tmp_path.joinpath('mod.py').write_text('def main(): print("ohai")')
296
297 # we patch this to force virtualenv executing with `-p` since we can't
298 # reliably have multiple pythons available in CI
299 with mock.patch.object(
300 python,
301 '_sys_executable_matches',
302 return_value=False,
303 ):
304 assert run_language(tmp_path, python, 'myexe') == (0, b'ohai\n')
305
306
307def _make_hello_hello(tmp_path):

Callers

nothing calls this directly

Calls 1

run_languageFunction · 0.90

Tested by

no test coverage detected