Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions launch/launch/actions/execute_process.py
Original file line number Diff line number Diff line change
Expand Up @@ -404,8 +404,8 @@ def parse(

if 'additional_env' not in ignore:
# Conditions won't be allowed in the `env` tag.
# If that feature is needed, `set_enviroment_variable` and
# `unset_enviroment_variable` actions should be used.
# If that feature is needed, `set_environment_variable` and
# `unset_environment_variable` actions should be used.
env = entity.get_attr('env', data_type=List[Entity], optional=True)
if env is not None:
kwargs['additional_env'] = {
Expand Down
4 changes: 2 additions & 2 deletions launch/launch/launch_introspector.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@
from .utilities import normalize_to_list_of_substitutions


def indent(lines: List[Text], indention: Text = ' ') -> List[Text]:
def indent(lines: List[Text], indentation: Text = ' ') -> List[Text]:
"""Indent a list of strings and return them."""
return ['{}{}'.format(indention, line) for line in lines]
return ['{}{}'.format(indentation, line) for line in lines]


def tree_like_indent(lines: List[Text]) -> List[Text]:
Expand Down
2 changes: 1 addition & 1 deletion launch/launch/substitutions/environment_variable.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def __init__(

@classmethod
def parse(cls, data: Sequence[SomeSubstitutionsType]):
"""Parse `EnviromentVariable` substitution."""
"""Parse `EnvironmentVariable` substitution."""
if len(data) < 1 or len(data) > 2:
raise TypeError('env substitution expects 1 or 2 arguments')
kwargs = {'name': data[0]}
Expand Down
2 changes: 1 addition & 1 deletion launch/launch/utilities/type_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ def get_typed_value(


# Unfortunately, mypy is unable to correctly infer that `is_substitution` can
# only return True when the passed tpe is either a substitution or a mixed
# only return True when the passed type is either a substitution or a mixed
# list of strings and substitutions. Indeed, there is no way that I could find
# using overloads to describe "anything else than the above two types".
def is_substitution(x):
Expand Down
17 changes: 14 additions & 3 deletions launch_pytest/launch_pytest/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import functools
import inspect

from _pytest.fixtures import getfixturemarker
from _pytest.outcomes import fail
from _pytest.outcomes import skip

Expand Down Expand Up @@ -169,6 +170,16 @@ def get_launch_test_fixturename(item):
return None if fixture is None else fixture.__name__


def get_launch_test_fixture_scope(fixture):
"""Return launch fixture scope for multiple pytest fixture representations."""
fixture_marker = getfixturemarker(fixture)
if fixture_marker is None:
raise AttributeError(
f'Unable to retrieve fixture scope from fixture {fixture!r}.'
)
return fixture_marker.scope


def is_valid_test_item(obj):
"""Return true if obj is a valid launch test item."""
return (
Expand Down Expand Up @@ -236,7 +247,7 @@ def pytest_pycollect_makeitem(collector, name, obj):
return [item]
fixture = get_launch_test_fixture(item)
fixturename = fixture.__name__
scope = fixture._pytestfixturefunction.scope
scope = get_launch_test_fixture_scope(fixture)
is_shutdown = has_shutdown_kwarg(item)
items = generate_test_items(
collector, name, obj, fixturename, is_shutdown=is_shutdown, needs_renaming=False)
Expand Down Expand Up @@ -264,7 +275,7 @@ def is_same_launch_test_fixture(left_item, right_item):
return False
if lfn is not rfn:
return False
if lfn._pytestfixturefunction.scope == 'function':
if get_launch_test_fixture_scope(lfn) == 'function':
return False
name = lfn.__name__

Expand Down Expand Up @@ -326,7 +337,7 @@ def pytest_pyfunc_call(pyfuncitem):
return
shutdown_test = is_shutdown_test(pyfuncitem)
fixture = get_launch_test_fixture(pyfuncitem)
scope = fixture._pytestfixturefunction.scope
scope = get_launch_test_fixture_scope(fixture)
event_loop = pyfuncitem.funcargs['event_loop']
ls = pyfuncitem.funcargs['launch_service']
auto_shutdown = fixture._launch_pytest_fixture_options['auto_shutdown']
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def assertInStdout(self, msg):

def get_nearby_lines(self):

# This works by concatinating a few of the process_io outputs that we received, then
# This works by concatenating a few of the process_io outputs that we received, then
# searching forward and backward for two return-lines in each direction, then returning
# just that portion to give context about where a failure happened

Expand Down
2 changes: 1 addition & 1 deletion launch_testing/launch_testing/markers.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def retry_on_failure(*, times, delay=None):
"""
Mark a test case to be retried up to `times` on AssertionError.

:param times: The number of times to rety the test.
:param times: The number of times to retry the test.
:param delay: The time to wait between retries, in seconds.
A value of None will result in zero delay.
"""
Expand Down
2 changes: 1 addition & 1 deletion launch_testing/launch_testing/test_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ def __init__(self,
"""
Create an LaunchTestRunner object.

:param callable gen_launch_description_fn: A function that returns a ros2 LaunchDesription
:param callable gen_launch_description_fn: A function that returns a ros2 LaunchDescription
for launching the processes under test. This function should take a callable as a
parameter which will be called when the processes under test are ready for the test to
start
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ def test_only_one_process_had_arguments(self):
matches = [t for t in text_lines if 'Called with arguments' in t]
print('Called with arguments: {}'.format(matches))

# Two process have args, because thats how process names are passed down
# Two process have args, because that's how process names are passed down
self.assertEqual(2, len(matches))

matches_extra = [t for t in matches if '--extra' in t]
Expand Down
4 changes: 2 additions & 2 deletions launch_testing/test/launch_testing/test_resolve_process.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def test_unlaunched_process_lookup(self):
process=lookup_obj
)

# We'll get a good error mesasge here because there were no substitutions in
# We'll get a good error message here because there were no substitutions in
# the execute process cmd - it's all text
self.assertIn('python -c', str(cm.exception))

Expand All @@ -69,7 +69,7 @@ def test_backward_compatible_unlaunched_process_lookup(self):
process=lookup_obj
)

# We'll get a good error mesasge here because there were no substitutions in
# We'll get a good error message here because there were no substitutions in
# the execute process cmd - it's all text
self.assertIn('python -c', str(cm.exception))

Expand Down