Skip to content

Commit

Permalink
Merge pull request #146 from diazona/disable-pytest-distribution-pack…
Browse files Browse the repository at this point in the history
…age-test-py312/1/dev

Conditionally disable the pytest distribution package test
  • Loading branch information
diazona authored Dec 28, 2023
2 parents 43d9538 + c4bfd8d commit 44807ad
Showing 1 changed file with 27 additions and 1 deletion.
28 changes: 27 additions & 1 deletion tests/distribution/test_distribution_packages.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"""

import pytest
import sys

from typing import Iterator, List

Expand All @@ -47,11 +48,36 @@ def _xfail(*args):
return pytest.param(*args, marks=pytest.mark.xfail)


def _setuptools_scm_version_conflict() -> bool:
"""
Check whether the conditions exist to trigger the ``setuptools_scm`` version
conflict. If these conditions exist, certain tests should be skipped.
See `issue 145 <https://github.com/diazona/setuptools-pyproject-migration/issues/145>`_.
"""

if sys.version_info < (3, 12):
return False
from test_support import importlib_metadata
from packaging.version import Version

try:
setuptools_scm_version = Version(importlib_metadata.version("setuptools_scm"))
except importlib_metadata.PackageNotFoundError:
return False
return setuptools_scm_version < Version("6")


distributions: List = [
# e.g.
# GitHubDistribution(url, commit-ish)
# PyPiDistribution(name, version)
_xfail(PyPiDistribution("pytest", "7.3.0")),
pytest.param(
PyPiDistribution("pytest", "7.3.0"),
marks=[
pytest.mark.xfail,
pytest.mark.skipif(_setuptools_scm_version_conflict(), reason="Issue #145"),
],
),
_xfail(PyPiDistribution("pytest-localserver", "0.8.0")),
PyPiDistribution("aioax25", "0.0.11.post0", make_importable=True),
]
Expand Down

0 comments on commit 44807ad

Please sign in to comment.