From 586ecea6f219d70d4075434b84a3784ec7cc948d Mon Sep 17 00:00:00 2001
From: Bruno Oliveira <nicoddemus@gmail.com>
Date: Wed, 13 Dec 2017 20:06:49 -0200
Subject: [PATCH] Check if symlink does not privileges on Windows for
 test_cmdline_python_package_symlink

os.symlink might fail on Windows because users require a special policy
to create symlinks (argh).

This is not a problem on AppVeyor because it is logged in as an admin,
but would be surprising for Windows users running pytest's test
suite on their computer.
---
 testing/acceptance_test.py | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/testing/acceptance_test.py b/testing/acceptance_test.py
index 9da9091db..8f7de99f0 100644
--- a/testing/acceptance_test.py
+++ b/testing/acceptance_test.py
@@ -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")]