Use patlib.Path in tests and tools
This commit is contained in:
@@ -1,30 +1,16 @@
|
||||
from cibuildwheel.util import DependencyConstraints
|
||||
import os
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
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')
|
||||
project_root = Path(__file__).parents[1]
|
||||
resources_dir = 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('3.6'),
|
||||
os.path.join(resources_dir, 'constraints-python36.txt')
|
||||
)
|
||||
assert os.path.samefile(
|
||||
dependency_constraints.get_for_python_version('3.5'),
|
||||
os.path.join(resources_dir, 'constraints-python35.txt')
|
||||
)
|
||||
assert os.path.samefile(
|
||||
dependency_constraints.get_for_python_version('2.7'),
|
||||
os.path.join(resources_dir, 'constraints-python27.txt')
|
||||
)
|
||||
assert dependency_constraints.base_file_path.samefile(resources_dir / 'constraints.txt')
|
||||
assert dependency_constraints.get_for_python_version('3.8').samefile(resources_dir / 'constraints.txt')
|
||||
assert dependency_constraints.get_for_python_version('3.6').samefile(resources_dir / 'constraints-python36.txt')
|
||||
assert dependency_constraints.get_for_python_version('3.5').samefile(resources_dir / 'constraints-python35.txt')
|
||||
assert dependency_constraints.get_for_python_version('2.7').samefile(resources_dir / 'constraints-python27.txt')
|
||||
|
||||
Reference in New Issue
Block a user