Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_symlink_package(self):
if os.name == 'nt':
raise SkipTest("symlink")
Installer.from_ini_path(samples_dir / 'package1' / 'pyproject.toml', symlink=True).install()
assert_islink(self.tmpdir / 'site-packages' / 'package1',
to=samples_dir / 'package1' / 'package1')
assert_isfile(self.tmpdir / 'scripts' / 'pkg_script')
with (self.tmpdir / 'scripts' / 'pkg_script').open() as f:
assert f.readline().strip() == "#!" + sys.executable
self._assert_direct_url(
samples_dir / 'package1', 'package1', '0.1', expected_editable=True
)
# Called by Installer._get_dirs() :
script2 = ("#!{python}\n"
"import json, sys\n"
"json.dump({{'purelib': {purelib!r}, 'scripts': {scripts!r} }}, "
"sys.stdout)"
).format(python=sys.executable,
purelib=str(self.tmpdir / 'site-packages2'),
scripts=str(self.tmpdir / 'scripts2'))
with MockCommand('mock_python', content=script1):
ins = Installer.from_ini_path(samples_dir / 'package1' / 'pyproject.toml', python='mock_python',
symlink=True)
with MockCommand('mock_python', content=script2):
ins.install()
assert_islink(self.tmpdir / 'site-packages2' / 'package1',
to=samples_dir / 'package1' / 'package1')
assert_isfile(self.tmpdir / 'scripts2' / 'pkg_script')
with (self.tmpdir / 'scripts2' / 'pkg_script').open() as f:
assert f.readline().strip() == "#!mock_python"