2021-10-10 03:31:57 +02:00
|
|
|
import os
|
|
|
|
import tempfile
|
|
|
|
|
2014-10-16 20:40:34 +02:00
|
|
|
import pytest
|
|
|
|
|
2020-07-21 08:23:42 +02:00
|
|
|
from click.testing import CliRunner
|
|
|
|
|
2014-10-16 20:40:34 +02:00
|
|
|
|
2020-07-21 08:23:42 +02:00
|
|
|
@pytest.fixture(scope="function")
|
2014-10-16 20:40:34 +02:00
|
|
|
def runner(request):
|
|
|
|
return CliRunner()
|
2021-10-10 03:31:57 +02:00
|
|
|
|
|
|
|
|
2022-01-03 02:50:02 +01:00
|
|
|
def _check_symlinks_supported():
|
|
|
|
with tempfile.TemporaryDirectory(prefix="click-pytest-") as tempdir:
|
|
|
|
target = os.path.join(tempdir, "target")
|
|
|
|
open(target, "w").close()
|
|
|
|
link = os.path.join(tempdir, "link")
|
|
|
|
|
|
|
|
try:
|
|
|
|
os.symlink(target, link)
|
|
|
|
return True
|
|
|
|
except OSError:
|
|
|
|
return False
|
|
|
|
|
|
|
|
|
|
|
|
symlinks_supported = _check_symlinks_supported()
|