Skip to content

Commit

Permalink
Fix some platform-specific path assumptions in tests (#960)
Browse files Browse the repository at this point in the history
  • Loading branch information
cottsay authored May 3, 2024
1 parent 058025b commit 9698c4a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion test/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def fake_rosdep_source(fake_sources_list_d, request):
'ROSDEP_SOURCE_PATH': os.environ.get('ROSDEP_SOURCE_PATH'),
}
request.addfinalizer(functools.partial(_restore_env_vars, restore_env_vars))
rosdep_source = path_to_url(fake_sources_list_d)
rosdep_source = fake_sources_list_d
os.environ['ROSDEP_SOURCE_PATH'] = rosdep_source
return rosdep_source

Expand Down
2 changes: 1 addition & 1 deletion test/test_rosdep_catkin_packages.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def create_package_xml(path, version='0.1.0'):
<maintainer email="[email protected]">Foo Bar</maintainer>
</package>
""".format(path.split('/')[-1], version)
""".format(os.path.basename(path), version)

with open(os.path.join(path, 'package.xml'), 'w+') as f:
f.write(template)
Expand Down
9 changes: 6 additions & 3 deletions test/test_rosdep_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@
import pytest
import yaml

from .conftest import path_to_url


rep122_install_command = """#!/bin/bash
set -o errexit
mkdir -p build
Expand Down Expand Up @@ -195,7 +198,7 @@ def test_SourceInstaller_resolve():
from rosdep2.platforms.source import SourceInstaller, InvalidData
test_dir = get_test_dir()

url = 'file://%s' % os.path.join(test_dir, 'rep112-example.rdmanifest')
url = path_to_url(os.path.join(test_dir, 'rep112-example.rdmanifest'))
md5sum_good = REP112_MD5SUM
md5sum_bad = 'fake'

Expand Down Expand Up @@ -256,7 +259,7 @@ def test_fetch_file():
expected = f.read()

from rosdep2.platforms.source import fetch_file
url = 'file://%s' % os.path.join(test_dir, 'rep112-example.rdmanifest')
url = path_to_url(os.path.join(test_dir, 'rep112-example.rdmanifest'))
contents, error = fetch_file(url, REP112_MD5SUM)
assert not error
assert contents == expected
Expand All @@ -276,7 +279,7 @@ def test_download_rdmanifest():
expected = yaml.safe_load(f)

from rosdep2.platforms.source import download_rdmanifest, DownloadFailed
url = 'file://%s' % os.path.join(test_dir, 'rep112-example.rdmanifest')
url = path_to_url(os.path.join(test_dir, 'rep112-example.rdmanifest'))
contents, download_url = download_rdmanifest(url, REP112_MD5SUM)
assert contents == expected
assert download_url == url
Expand Down

0 comments on commit 9698c4a

Please sign in to comment.