Skip to content

Commit

Permalink
CI adjustments for conda-libmamba-solver as default (#5059)
Browse files Browse the repository at this point in the history
Co-authored-by: Ken Odegard <kodegard@anaconda.com>
  • Loading branch information
jaimergp and kenodegard authored Nov 17, 2023
1 parent b2b7ab3 commit 05cc56a
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 48 deletions.
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.")

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

0 comments on commit 05cc56a

Please sign in to comment.