Merge pull request #3031 from nicoddemus/symlink-privileges

Check if symlink does have privileges on Windows for test_cmdline_python_package_symlink
This commit is contained in:
Bruno Oliveira 2017-12-16 12:36:11 -02:00 committed by GitHub
commit 924b5e2e3d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 0 deletions

View File

@ -653,6 +653,13 @@ class TestInvocationVariants(object):
test --pyargs option with packages with path containing symlink can
have conftest.py in their package (#2985)
"""
# dummy check that we can actually create symlinks: on Windows `os.symlink` is available,
# but normal users require special admin privileges to create symlinks.
if sys.platform == 'win32':
try:
os.symlink(str(testdir.tmpdir.ensure('tmpfile')), str(testdir.tmpdir.join('tmpfile2')))
except OSError as e:
pytest.skip(six.text_type(e.args[0]))
monkeypatch.delenv('PYTHONDONTWRITEBYTECODE', raising=False)
search_path = ["lib", os.path.join("local", "lib")]