Skip to content

Commit

Permalink
comments and older version of setuptools compatible with test
Browse files Browse the repository at this point in the history
  • Loading branch information
TheRealFalcon committed Jul 23, 2023
1 parent 4ae6814 commit 9111551
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 3 deletions.
3 changes: 3 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
from setuptools.command.egg_info import egg_info
from setuptools.command.install import install

# Python-path here is a little unpredictable as setup.py could be run
# from a directory other than the root of the repo, so ensure we can find
# our utils
sys.path.insert(0, os.path.dirname(os.path.realpath(__file__)))
# isort: off
from setup_utils import ( # noqa: E402
Expand Down
2 changes: 1 addition & 1 deletion tools/read-version
Original file line number Diff line number Diff line change
Expand Up @@ -145,4 +145,4 @@ if __name__ == "__main__":
arg_use_tags = "--tags" in sys.argv or bool(os.environ.get("CI_RV_TAGS"))
arg_output_json = "--json" in sys.argv
output = main(arg_use_tags, arg_output_json)
sys.stdout.write(output + "\n")
print(output)
11 changes: 9 additions & 2 deletions tools/test_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,14 @@

from setup_utils import version_to_pep440

validate_version = setuptools.dist.Distribution._validate_version # type: ignore # noqa: E501
try:
validate_version = setuptools.dist.Distribution._validate_version
setuptools.sic # pylint: disable=no-member,pointless-statement
except AttributeError:
pytest.skip(
"Unable to import necessary setuptools utilities. "
"Version is likely too old."
)

# Since read-version has a '-' and no .py extension, we have to do this
# to import it
Expand All @@ -29,7 +36,7 @@

def assert_valid_version(version):
response = validate_version(version)
if isinstance(response, setuptools.sic): # noqa: E1101
if isinstance(response, setuptools.sic): # pylint: disable=no-member
pytest.fail(f"{version} is not PEP 440 compliant")


Expand Down
1 change: 1 addition & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ deps =
pytest==3.3.2
pytest-cov==2.5.1
pytest-mock==1.7.1
setuptools==44.0.0
# Needed by pytest and default causes failures
attrs==17.4.0
responses==0.5.1
Expand Down

0 comments on commit 9111551

Please sign in to comment.