From 8f114a330c958b5c34f76c52fc919c17af546dce Mon Sep 17 00:00:00 2001 From: Ken Odegard Date: Tue, 5 Dec 2023 15:26:20 -0600 Subject: [PATCH] Switch from SVN to Git for test_checkout_tool_as_dependency --- .../metadata/_checkout_tool_as_dependency/bld.bat | 10 +++++----- .../_checkout_tool_as_dependency/build.sh | 11 +++++------ .../_checkout_tool_as_dependency/meta.yaml | 15 +++++---------- tests/test_api_build.py | 10 +++------- 4 files changed, 18 insertions(+), 28 deletions(-) diff --git a/tests/test-recipes/metadata/_checkout_tool_as_dependency/bld.bat b/tests/test-recipes/metadata/_checkout_tool_as_dependency/bld.bat index f2bb5af0d0..3e223b4027 100644 --- a/tests/test-recipes/metadata/_checkout_tool_as_dependency/bld.bat +++ b/tests/test-recipes/metadata/_checkout_tool_as_dependency/bld.bat @@ -1,7 +1,7 @@ -svn upgrade -svn info +:: ensure checkout worked as expected +git status if errorlevel 1 exit 1 -for /f "delims=" %%i in ('svn info ^| findstr "Revision"') do set svnrev=%%i + +:: ensure the expected commit was checked out +for /f "delims=" %%i in ('git rev-parse HEAD') do if not "%%i"=="2a558a86bb77b1d21a0be77c3775464500e9dfe2" echo "exit 1" if errorlevel 1 exit 1 -echo %svnrev% -if not "%svnrev%"=="Revision: 1" exit 1 diff --git a/tests/test-recipes/metadata/_checkout_tool_as_dependency/build.sh b/tests/test-recipes/metadata/_checkout_tool_as_dependency/build.sh index b8394a5e61..ccdb1401ad 100644 --- a/tests/test-recipes/metadata/_checkout_tool_as_dependency/build.sh +++ b/tests/test-recipes/metadata/_checkout_tool_as_dependency/build.sh @@ -1,6 +1,5 @@ -# Ensure the checkout went well -# Think of the non-English speaking world -export LC_ALL=C -svn upgrade -svn info -[ "$(svn info | grep "Revision")" = "Revision: 1" ] +# ensure checkout worked as expected +git status || exit 1 + +# ensure the expected commit was checked out +[[ "$(git rev-parse HEAD)" == "2a558a86bb77b1d21a0be77c3775464500e9dfe2" ]] diff --git a/tests/test-recipes/metadata/_checkout_tool_as_dependency/meta.yaml b/tests/test-recipes/metadata/_checkout_tool_as_dependency/meta.yaml index ca712922d1..53c8453406 100644 --- a/tests/test-recipes/metadata/_checkout_tool_as_dependency/meta.yaml +++ b/tests/test-recipes/metadata/_checkout_tool_as_dependency/meta.yaml @@ -1,20 +1,15 @@ -{% set recipe_dir = RECIPE_DIR if unix else "/" ~ RECIPE_DIR.replace("\\", "/") %} - package: name: test-checkout-tool-as-dependency version: 1.0 source: - svn_url: https://github.com/conda/conda_build_test_recipe.git - svn_rev: 1 + git_url: https://github.com/conda/conda_build_test_recipe.git + git_rev: 1.0 requirements: build: - # To test the conda_build version - - svn - - vc 9 # [win and py2k] - - vc 14 # [win and py3k] - # This is here so that we get a smaller host prefix to speed up - # the excruciatingly slow calls to prefix_files (os.walk). + - git host: + # This is here so that we get a smaller host prefix to speed up + # the excruciatingly slow calls to prefix_files (os.walk). - bzip2 diff --git a/tests/test_api_build.py b/tests/test_api_build.py index ff3e431ff3..826d798b09 100644 --- a/tests/test_api_build.py +++ b/tests/test_api_build.py @@ -413,15 +413,11 @@ def dummy_executable(folder, exename): def test_checkout_tool_as_dependency(testing_workdir, testing_config, monkeypatch): - # "hide" svn by putting a known bad one on PATH - exename = dummy_executable(testing_workdir, "svn") + # "hide" git by putting a known bad one on PATH + exename = dummy_executable(testing_workdir, "git") monkeypatch.setenv("PATH", testing_workdir, prepend=os.pathsep) - FNULL = open(os.devnull, "w") with pytest.raises(subprocess.CalledProcessError): - check_call_env([exename, "--version"], stderr=FNULL) - FNULL.close() - env = os.environ.copy() - env["PATH"] = os.pathsep.join([testing_workdir, env["PATH"]]) + check_call_env([exename, "--version"], stderr=subprocess.DEVNULL) testing_config.activate = True api.build( os.path.join(metadata_dir, "_checkout_tool_as_dependency"),