Skip to content

Commit

Permalink
Fix external sphinx test
Browse files Browse the repository at this point in the history
Account for version translations
  • Loading branch information
analog-cbarber committed Apr 22, 2024
1 parent e6234a6 commit 05becc2
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion test/api/validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import configparser
import hashlib
import json
import logging
import os.path
import re
import shutil
Expand Down Expand Up @@ -315,6 +316,10 @@ def _validate_dependencies(self, dependencies: Sequence[str]) -> None:
output_depends = set(dependencies)
expected_depends: set[str] = set()

# Only used for version translation
cvt = Wheel2CondaConverter(self.tmp_dir, self.tmp_dir)
cvt.logger = logging.Logger(__name__, logging.CRITICAL)

wheel_md = self._wheel_md
if self._expected_python_version:
expected_depends.add(f"python {self._expected_python_version}")
Expand All @@ -329,6 +334,7 @@ def _validate_dependencies(self, dependencies: Sequence[str]) -> None:
continue
name = entry.name
version = entry.version
conda_version = cvt.translate_version_spec(version)
renamed = False
for pat, template in self._renamed_dependencies.items():
if m := re.fullmatch(name, pat):
Expand All @@ -338,7 +344,7 @@ def _validate_dependencies(self, dependencies: Sequence[str]) -> None:
if not renamed:
name = self._std_renames.get(name, name)
if name:
expected_depends.add(f"{name} {version}")
expected_depends.add(f"{name} {conda_version}")

expected_depends.update(self._extra_dependencies)

Expand Down

0 comments on commit 05becc2

Please sign in to comment.