Skip to content
Myr

conftest.py

This file

Path

tests/conftest.py

31 lines · 794 bytes · Python

Last changed by

Merge pull request #2006 from MLH-Fellowship/1921-fix-symlinksDavid Lordbefore adoptione24db57

History of this file

Take it

The walk stopped after 200 commits: lines older than 090ff26 point at it.

Merge pull request #2006 from MLH-Fellowship/1921-fix-symlinksDavid Lordbefore adoptione24db57

lines 1–4why, one step back
1import os
2import shutil3import tempfile4

Merge pull request #1591 from andy-maier/andy/fix-unsupportedoperationDavid Lordbefore adoption090ff26

lines 5–12why, one step back
5import pytest
67from click.testing import CliRunner8910@pytest.fixture(scope="function")11def runner(request):12 return CliRunner()

Merge pull request #2006 from MLH-Fellowship/1921-fix-symlinksDavid Lordbefore adoptione24db57

lines 13–31why, one step back
13
1415def check_symlink_impl():16 """This function checks if using symlinks is allowed17 on the host machine"""18 tempdir = tempfile.mkdtemp(prefix="click-")19 test_pth = os.path.join(tempdir, "check_sym_impl")20 sym_pth = os.path.join(tempdir, "link")21 open(test_pth, "w").close()22 rv = True23 try:24 os.symlink(test_pth, sym_pth)25 except (NotImplementedError, OSError):26 # Creating symlinks on Windows require elevated access.27 # OSError is thrown if the function is called without it.28 rv = False29 finally:30 shutil.rmtree(tempdir, ignore_errors=True)31 return rv