Skip to content

Commit

Permalink
Fix test suite by injecting testing data
Browse files Browse the repository at this point in the history
Signed-off-by: Jose Luis Rivero <[email protected]>
  • Loading branch information
j-rivero committed Sep 26, 2024
1 parent c2da471 commit 6c1e3c0
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 7 deletions.
21 changes: 17 additions & 4 deletions check_releasepy.bash
Original file line number Diff line number Diff line change
@@ -1,9 +1,22 @@
#!/bin/bash -e

test_dir=$(mktemp -d)
mkdir -p ${test_dir}/{focal,jammy,ubuntu}/debian
export _RELEASEPY_TEST_RELEASE_REPO=${test_dir}
export _RELEASEPY_DEBUG=1
test_dir=$(mktemp -d)
export _RELEASEPY_TEST_RELEASE_REPO="${test_dir}/test-release"
mkdir -p ${_RELEASEPY_TEST_RELEASE_REPO}/{focal,jammy,ubuntu}/debian
export _RELEASEPY_TEST_SOURCE_REPO="${test_dir}/src"
mkdir -p ${_RELEASEPY_TEST_SOURCE_REPO}
# Fake packages.xml to make the vendor package script happy
cat > "${_RELEASEPY_TEST_SOURCE_REPO}/package.xml" <<-EOF
<?xml version="1.0"?>
<package format="2">
<name>gz-foo</name>
<version>0.0.0</version>
<description>test</description>
<maintainer email="[email protected]">Testing maintainer</maintainer>
<license>Foo License</license>
</package>
EOF

exec_releasepy_test()
{
Expand Down Expand Up @@ -167,4 +180,4 @@ ros_vendor_test=$(exec_releasepy_with_real_gz gz-fuel-tools 9)
expect_vendor_repo "${ros_vendor_test}" gazebo-release/gz_fuel_tools_vendor

ros_vendor_test=$(exec_releasepy_with_real_gz gz-cmake 2)
expect_no_vendor "${bump_linux_test}"
expect_no_vendor "${ros_vendor_test}"
14 changes: 11 additions & 3 deletions release.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,6 @@ def parse_args(argv):
action='store_true', default=False,
help='Only process the ROS vendor package (if any).')



args = parser.parse_args()

args.package_alias = args.package
Expand Down Expand Up @@ -589,9 +587,16 @@ def prepare_vendor_pr_temp_workspace(package_name, ws_dir) -> Tuple[str, str, st
def execute_update_vendor_package_tool(vendor_tool_path,
vendor_repo_path,
vendor_venv) -> None:
# The source repository when releasing matches the
src_repo = os.getcwd()
try:
src_repo = os.environ['_RELEASEPY_TEST_SOURCE_REPO']
except KeyError:
pass

run_cmd = [os.path.join(vendor_venv, 'bin', 'python3'),
f"{vendor_tool_path}/create_gz_vendor_pkg/create_vendor_package.py",
'package.xml',
f"{os.path.join(src_repo, 'package.xml')}",
'--output_dir', vendor_repo_path]
_, _err_run = check_call(run_cmd, IGNORE_DRY_RUN)
if _err_run:
Expand Down Expand Up @@ -636,6 +641,9 @@ def create_pr_for_vendor_package(args, repo_path, base_branch) -> str:
print(_err.decode())
sys.exit(1)

if DRY_RUN:
return ' (skipped the creation on --dry-run)'

return _out.decode()


Expand Down

0 comments on commit 6c1e3c0

Please sign in to comment.