Skip to content

Commit

Permalink
Fix some concurrency issues in tests
Browse files Browse the repository at this point in the history
Signed-off-by: Marcel Bargull <marcel.bargull@udo.edu>
  • Loading branch information
mbargull committed Nov 19, 2023
1 parent 038b30d commit 9d2c297
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 15 deletions.
4 changes: 4 additions & 0 deletions tests/test-recipes/metadata/entry_points/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,7 @@ requirements:
- setuptools
run:
- python

# Ensure we get different build strings for concurrently tested packages.
extra:
dummy: '{{ pytest_name is defined }}'
23 changes: 12 additions & 11 deletions tests/test_api_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -1655,14 +1655,15 @@ def test_provides_features_metadata(testing_config):
assert index["provides_features"] == {"test2": "also_ok"}


# using different MACOSX_DEPLOYMENT_TARGET in parallel causes some SDK race condition
# https://github.com/conda/conda-build/issues/4708
@pytest.mark.serial
def test_overlinking_detection(testing_config, variants_conda_build_sysroot):
def test_overlinking_detection(testing_config, testing_workdir, variants_conda_build_sysroot):
testing_config.activate = True
testing_config.error_overlinking = True
testing_config.verify = False
recipe = os.path.join(metadata_dir, "_overlinking_detection")
recipe = os.path.join(testing_workdir, "recipe")
copy_into(
os.path.join(metadata_dir, "_overlinking_detection"),
recipe,
)
dest_sh = os.path.join(recipe, "build.sh")
dest_bat = os.path.join(recipe, "bld.bat")
copy_into(
Expand All @@ -1684,17 +1685,17 @@ def test_overlinking_detection(testing_config, variants_conda_build_sysroot):
rm_rf(dest_bat)


# using different MACOSX_DEPLOYMENT_TARGET in parallel causes some SDK race condition
# https://github.com/conda/conda-build/issues/4708
@pytest.mark.serial
@pytest.mark.flaky(reruns=5, reruns_delay=2)
def test_overlinking_detection_ignore_patterns(
testing_config, variants_conda_build_sysroot
testing_config, testing_workdir, variants_conda_build_sysroot
):
testing_config.activate = True
testing_config.error_overlinking = True
testing_config.verify = False
recipe = os.path.join(metadata_dir, "_overlinking_detection_ignore_patterns")
recipe = os.path.join(testing_workdir, "recipe")
copy_into(
os.path.join(metadata_dir, "_overlinking_detection_ignore_patterns"),
recipe,
)
dest_sh = os.path.join(recipe, "build.sh")
dest_bat = os.path.join(recipe, "bld.bat")
copy_into(
Expand Down
5 changes: 3 additions & 2 deletions tests/test_api_build_conda_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,11 @@ def test_conda_pkg_format(pkg_format, pkg_ext, testing_config, monkeypatch, capf
monkeypatch.setenv("CONDA_TEST_VAR", "conda_test")
monkeypatch.setenv("CONDA_TEST_VAR_2", "conda_test_2")

(output_file,) = api.get_output_file_paths(recipe, config=testing_config)
variants = {"pytest_name": [request.node.name]}
(output_file,) = api.get_output_file_paths(recipe, config=testing_config, variants=variants)
assert output_file.endswith(pkg_ext)

api.build(recipe, config=testing_config)
api.build(recipe, config=testing_config, variants=variants)
assert os.path.exists(output_file)

out, err = capfd.readouterr()
Expand Down
5 changes: 3 additions & 2 deletions tests/test_api_convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,9 +194,10 @@ def test_convert_platform_to_others(base_platform, package):
@pytest.mark.skipif(
on_win, reason="we create the pkg to be converted in *nix; don't run on win."
)
def test_convert_from_unix_to_win_creates_entry_points(testing_config):
def test_convert_from_unix_to_win_creates_entry_points(testing_config, request):
recipe_dir = os.path.join(metadata_dir, "entry_points")
fn = api.build(recipe_dir, config=testing_config)[0]
variants = {"pytest_name": [request.node.name]}
fn = api.build(recipe_dir, config=testing_config, variants=variants)[0]
for platform in ["win-64", "win-32"]:
api.convert(fn, platforms=[platform], force=True)
converted_fn = os.path.join(platform, os.path.basename(fn))
Expand Down

0 comments on commit 9d2c297

Please sign in to comment.