Skip to content

Commit

Permalink
Ensure that different directories work
Browse files Browse the repository at this point in the history
  • Loading branch information
KyleFromNVIDIA committed Mar 26, 2024
1 parent 2df3de0 commit 6608caa
Showing 1 changed file with 32 additions and 9 deletions.
41 changes: 32 additions & 9 deletions tests/test_impls.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,22 +62,36 @@ def check_initial_contents(filename):

@pytest.mark.parametrize(
[
"pyproject_dir",
"dependencies_file",
"cuda_version",
"cuda_suffix",
"cuda_python_requirement",
"matrix",
"arch_requirement",
],
[
(("11", "5"), "-cu11", "cuda-python>=11.5,<11.6.dev0", "", "some-x86-package"),
(
".",
"dependencies.yaml",
("11", "5"),
"-cu11",
"cuda-python>=11.5,<11.6.dev0",
"",
"some-x86-package",
),
(
".",
"dependencies.yaml",
("11", "5"),
"-cu11",
"cuda-python>=11.5,<11.6.dev0",
"arch=aarch64",
"some-arm-package",
),
(
"python",
"../dependencies.yaml",
("12", "1"),
"-cu12",
"cuda-python>=12.1,<12.2.dev0",
Expand All @@ -87,7 +101,13 @@ def check_initial_contents(filename):
],
)
def test_edit_pyproject(
cuda_version, cuda_suffix, cuda_python_requirement, matrix, arch_requirement
pyproject_dir,
dependencies_file,
cuda_version,
cuda_suffix,
cuda_python_requirement,
matrix,
arch_requirement,
):
with tempfile.TemporaryDirectory() as d:
original_contents = """\
Expand All @@ -98,20 +118,23 @@ def test_edit_pyproject(
[build-system]
requires = []
"""
full_pyproject_dir = os.path.join(d, pyproject_dir)
if not os.path.exists(full_pyproject_dir):
os.mkdir(full_pyproject_dir)

with set_cwd(d):
with set_cwd(full_pyproject_dir):
with open("pyproject.toml", "w") as f:
f.write(original_contents)

with open("dependencies.yaml", "w") as f:
f.write("""\
with open(dependencies_file, "w") as f:
f.write(f"""\
files:
project:
output: pyproject
includes:
- project
- arch
pyproject_dir: .
pyproject_dir: {pyproject_dir}
matrix:
cuda: ["11.5", "12.1"]
arch: ["x86_64"]
Expand All @@ -121,14 +144,14 @@ def test_edit_pyproject(
output: pyproject
includes:
- build_system
pyproject_dir: .
pyproject_dir: {pyproject_dir}
extras:
table: build-system
other_project:
output: pyproject
includes:
- bad
pyproject_dir: python
pyproject_dir: python_bad
extras:
table: project
conda:
Expand Down Expand Up @@ -181,7 +204,7 @@ def test_edit_pyproject(
""")
config = Mock(
require_cuda=False,
dependencies_file="dependencies.yaml",
dependencies_file=dependencies_file,
matrix=matrix,
)

Expand Down

0 comments on commit 6608caa

Please sign in to comment.