Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI adjustments for conda-libmamba-solver as default #5059

Merged
merged 6 commits into from
Nov 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions news/5059-ci-conda-libmamba-solver
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
### Enhancements

* <news item>

### Bug fixes

* <news item>

### Deprecations

* <news item>

### Docs

* <news item>

### Other

* Mark Unicode tests as incompatible with `libmamba`. (#5059)
64 changes: 32 additions & 32 deletions tests/cli/test_main_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import os
import re
import sys
from pathlib import Path

import pytest

Expand Down Expand Up @@ -196,41 +197,40 @@ def test_build_multiple_recipes(testing_metadata, testing_workdir, testing_confi
main_build.execute(args)


def test_build_output_folder(testing_workdir, testing_metadata, capfd):
def test_build_output_folder(testing_workdir: str, testing_metadata):
api.output_yaml(testing_metadata, "meta.yaml")
with TemporaryDirectory() as tmp:
out = os.path.join(tmp, "out")
args = [
testing_workdir,
"--no-build-id",
"--croot",
tmp,
"--no-activate",
"--no-anaconda-upload",
"--output-folder",
out,
]
output = main_build.execute(args)[0]
assert os.path.isfile(
os.path.join(
out, testing_metadata.config.host_subdir, os.path.basename(output)
)
)

out = Path(testing_workdir, "out")
out.mkdir(parents=True)

def test_build_source(testing_workdir):
with TemporaryDirectory() as tmp:
args = [
os.path.join(metadata_dir, "_pyyaml_find_header"),
"--source",
"--no-build-id",
"--croot",
tmp,
"--no-activate",
"--no-anaconda-upload",
]
main_build.execute(args)
assert os.path.isfile(os.path.join(tmp, "work", "setup.py"))
args = [
testing_workdir,
"--no-build-id",
"--croot",
testing_workdir,
"--no-activate",
"--no-anaconda-upload",
"--output-folder",
str(out),
]
output = main_build.execute(args)[0]
assert (
out / testing_metadata.config.host_subdir / os.path.basename(output)
).is_file()


def test_build_source(testing_workdir: str):
args = [
os.path.join(metadata_dir, "_pyyaml_find_header"),
"--source",
"--no-build-id",
"--croot",
testing_workdir,
"--no-activate",
"--no-anaconda-upload",
]
main_build.execute(args)
assert Path(testing_workdir, "work", "setup.py").is_file()


@pytest.mark.serial
Expand Down
27 changes: 11 additions & 16 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

import pytest
from conda.common.compat import on_mac, on_win
from pytest import MonkeyPatch

import conda_build.config
from conda_build.config import (
Expand All @@ -32,31 +33,25 @@


@pytest.fixture(scope="function")
def testing_workdir(tmpdir, request):
def testing_workdir(monkeypatch: MonkeyPatch, tmp_path: Path) -> Iterator[str]:
"""Create a workdir in a safe temporary folder; cd into dir above before test, cd out after
:param tmpdir: py.test fixture, will be injected
:param request: py.test fixture-related, will be injected (see pytest docs)
"""
saved_path = Path.cwd()
monkeypatch.chdir(tmp_path)

saved_path = os.getcwd()

tmpdir.chdir()
# temporary folder for profiling output, if any
tmpdir.mkdir("prof")

def return_to_saved_path():
if os.path.isdir(os.path.join(saved_path, "prof")):
profdir = tmpdir.join("prof")
files = profdir.listdir("*.prof") if profdir.isdir() else []

for f in files:
copy_into(str(f), os.path.join(saved_path, "prof", f.basename))
os.chdir(saved_path)
prof = tmp_path / "prof"
prof.mkdir(parents=True)

request.addfinalizer(return_to_saved_path)
yield str(tmp_path)

return str(tmpdir)
# if the original CWD has a prof folder, copy any new prof files into it
if (saved_path / "prof").is_dir() and prof.is_dir():
for file in prof.glob("*.prof"):
copy_into(str(file), str(saved_path / "prof" / file.name))


@pytest.fixture(scope="function")
Expand Down
4 changes: 4 additions & 0 deletions tests/test_api_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
CondaError,
LinkError,
cc_conda_build,
context,
reset_context,
url_path,
)
Expand Down Expand Up @@ -123,6 +124,9 @@ def test_recipe_builds(
# ``source_setup_py_data_subdir`` reproduces the problem.
if recipe.name == "source_setup_py_data_subdir":
pytest.xfail("Issue related to #3754 on conda-build.")
elif recipe.name == "unicode_all_over" and context.solver == "libmamba":
pytest.xfail("Unicode package names not supported in libmamba.")
Copy link
Contributor

@dholth dholth Nov 17, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's too bad.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

libmamba doesn't support unicode package names IIUC, no need to test for it.


# These variables are defined solely for testing purposes,
# so they can be checked within build scripts
testing_config.activate = True
Expand Down
Loading