1
0
Fork 0
mirror of synced 2024-12-21 21:51:08 -05:00

Enforce platform-specific CPython version requirements for Windows in tox

This also changes the black and isort tests to use CPython 3.9
because Cygwin currently doesn't have CPython 3.10 available.
This commit is contained in:
Kurt McKee 2022-05-05 07:51:05 -05:00
parent ea98e5eafc
commit 1ff796a9dc
3 changed files with 13 additions and 36 deletions

View file

@ -3,21 +3,6 @@ import sys
import pytest
# Python 2.7 on Windows does not have an `os.symlink()` function.
# PyPy on Windows raises NotImplementedError when `os.symlink()` is called.
# Older Python 3 versions on Windows require admin rights to create symlinks.
#
# In addition, functions like `os.path.realpath()` on Windows Pythons < 3.8
# do not resolve symlinks and directory junctions correctly,
# and `shutil.rmtree()` will fail to delete directory junctions.
#
# For these reasons, if the tests are running on Windows with Python < 3.8
# or with PyPy, the entire link test suite must be skipped.
#
if sys.platform[:5] == "win32" and (sys.version_info < (3, 8) or "pypy" in sys.version.lower()):
reason = "It is impossible to perform link tests on this platform"
pytestmark = pytest.mark.skip(reason=reason)
def test_clean_default(root, home, dotfiles, run_dotbot):
"""Verify clean uses default unless overridden."""

View file

@ -3,21 +3,6 @@ import sys
import pytest
# Python 2.7 on Windows does not have an `os.symlink()` function.
# PyPy on Windows raises NotImplementedError when `os.symlink()` is called.
# Older Python 3 versions on Windows require admin rights to create symlinks.
#
# In addition, functions like `os.path.realpath()` on Windows Pythons < 3.8
# do not resolve symlinks and directory junctions correctly,
# and `shutil.rmtree()` will fail to delete directory junctions.
#
# For these reasons, if the tests are running on Windows with Python < 3.8
# or with PyPy, the entire link test suite must be skipped.
#
if sys.platform[:5] == "win32" and (sys.version_info < (3, 8) or "pypy" in sys.version.lower()):
reason = "It is impossible to perform link tests on this platform"
pytestmark = pytest.mark.skip(reason=reason)
def test_link_canonicalization(home, dotfiles, run_dotbot):
"""Verify links to symlinked destinations are canonical.

19
tox.ini
View file

@ -1,13 +1,20 @@
[tox]
; On Windows, only CPython >= 3.8 is supported.
; All older versions, and PyPy, lack full symlink support.
envlist =
py{27, 35, 36, 37, 38, 39, 310}
pypy{2, 3}
py310-black
py310-isort
py{38, 39, 310}-all_platforms
py{27, 35, 36, 37}-most_platforms
pypy{2, 3}-most_platforms
py39-black
py39-isort
skip_missing_interpreters = true
[testenv]
platform =
all_platforms: cygwin|darwin|linux|win32
most_platforms: cygwin|darwin|linux
deps =
pytest
pytest-randomly
@ -18,7 +25,7 @@ commands =
pytest tests/
[testenv:py310-black]
[testenv:py39-black]
skip_install = true
skip_build = true
deps =
@ -28,7 +35,7 @@ commands =
black --check dotbot/ tests/
[testenv:py310-isort]
[testenv:py39-isort]
skip_install = true
skip_build = true
deps =