@@ -762,21 +762,13 @@ def test():
762762 result = testdir .runpytest (str (p ) + "::test" , "--doctest-modules" )
763763 result .stdout .fnmatch_lines (["*1 passed*" ])
764764
765- def test_cmdline_python_package_symlink (self , testdir , monkeypatch ):
765+ def test_cmdline_python_package_symlink (
766+ self , testdir , monkeypatch , symlink_or_skip
767+ ):
766768 """
767769 test --pyargs option with packages with path containing symlink can
768770 have conftest.py in their package (#2985)
769771 """
770- # dummy check that we can actually create symlinks: on Windows `os.symlink` is available,
771- # but normal users require special admin privileges to create symlinks.
772- if sys .platform == "win32" :
773- try :
774- os .symlink (
775- str (testdir .tmpdir .ensure ("tmpfile" )),
776- str (testdir .tmpdir .join ("tmpfile2" )),
777- )
778- except OSError as e :
779- pytest .skip (str (e .args [0 ]))
780772 monkeypatch .delenv ("PYTHONDONTWRITEBYTECODE" , raising = False )
781773
782774 dirname = "lib"
@@ -794,7 +786,7 @@ def test_cmdline_python_package_symlink(self, testdir, monkeypatch):
794786
795787 d_local = testdir .mkdir ("local" )
796788 symlink_location = os .path .join (str (d_local ), "lib" )
797- os . symlink (str (d ), symlink_location , target_is_directory = True )
789+ symlink_or_skip (str (d ), symlink_location , target_is_directory = True )
798790
799791 # The structure of the test directory is now:
800792 # .
0 commit comments