Skip to content

Commit

Permalink
Add unit test case and fix filename confusion
Browse files Browse the repository at this point in the history
  • Loading branch information
joerick committed Feb 2, 2020
1 parent b9607ff commit baa0897
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 30 deletions.
29 changes: 0 additions & 29 deletions cibuildwheel/resources/constraints-python2.txt

This file was deleted.

2 changes: 1 addition & 1 deletion cibuildwheel/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def get_for_python_version(self, version):
# try to find a version-specific dependency file e.g. if
# ./constraints.txt is the base, look for ./constraints-python27.txt
base, ext = os.path.splitext(self.base_file_path)
specific = base + '-{}{}'.format(version_parts[0], version_parts[1])
specific = base + '-python{}{}'.format(version_parts[0], version_parts[1])
specific_file_path = specific + ext
if os.path.exists(specific_file_path):
return specific_file_path
Expand Down
21 changes: 21 additions & 0 deletions unit_test/dependency_constraints_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
from cibuildwheel.util import DependencyConstraints
import os

def test_defaults():
dependency_constraints = DependencyConstraints.with_defaults()

project_root = os.path.dirname(os.path.dirname(__file__))
resources_dir = os.path.join(project_root, 'cibuildwheel', 'resources')

assert os.path.samefile(
dependency_constraints.base_file_path,
os.path.join(resources_dir, 'constraints.txt')
)
assert os.path.samefile(
dependency_constraints.get_for_python_version('3.8'),
os.path.join(resources_dir, 'constraints.txt')
)
assert os.path.samefile(
dependency_constraints.get_for_python_version('2.7'),
os.path.join(resources_dir, 'constraints-python27.txt')
)

0 comments on commit baa0897

Please sign in to comment.