-
Notifications
You must be signed in to change notification settings - Fork 96
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
55 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -186,3 +186,51 @@ def test_bad_dependency(): | |
with AssertRaisesContext(SystemExit, str(code.GENERATOR_NO_ROSDEP_KEY_FOR_DISTRO)): | ||
with redirected_stdio(): | ||
gen.check_all_keys_are_valid("") | ||
|
||
|
||
def format_depends(depends, resolved_deps): | ||
formatted = [] | ||
for d in depends: | ||
formatted.append("{0}".format(d)) | ||
return formatted | ||
|
||
|
||
def format_description(value): | ||
return value | ||
|
||
|
||
class OneGenerator(PackageManagerGenerator): | ||
package_manager = "test" | ||
@staticmethod | ||
def get_subs_hook(subs, package, rosdistro, releaser_history=None): | ||
subs['Name'] = 'test_pkg improved' | ||
subs['specific_part'] = 'none' | ||
return subs | ||
|
||
|
||
def test_get_substitute(): | ||
pkg_name = 'test_pkg' | ||
pkg = get_package(pkg_name) | ||
pkg_dict = {pkg_name: pkg} | ||
|
||
gen = OneGenerator() | ||
gen.packages = pkg_dict | ||
gen.os_name = "ubuntu" | ||
gen.os_version = "xenial" | ||
gen.rosdistro = "kinetic" | ||
gen.install_prefix = gen.default_install_prefix | ||
gen.inc = "1" | ||
|
||
with redirected_stdio(): | ||
subs = gen.get_subs(pkg, gen.os_version, format_description, format_depends) | ||
|
||
assert 'test_pkg improved' == subs['Name'] | ||
assert '0.1.0' == subs['Version'] | ||
assert 'The test_pkg package' == subs['Description'] | ||
assert '1' == subs['Inc'] | ||
assert 'test-pkg' == subs['Package'] | ||
assert ['roscpp', 'rospy'] == subs['Depends'] | ||
assert gen.os_version == subs['Distribution'] | ||
assert "nobody1 <[email protected]>" == subs['Maintainer'] | ||
assert "nobody1 <[email protected]>, nobody2 <[email protected]>" == subs['Maintainers'] | ||
assert 'none' == subs['specific_part'] |