Skip to content

Commit 84ab8be

Browse files
authored
Renamed three files from example_processes (#573)
* Renamed three files from example_processes Three python files did not have a '.py' extension. These are always used as python scripts and it makes sense for them to have a python extension. Signed-off-by: Khush-dev <[email protected]> * Edited all references to the files that were renamed in previous commit Modified renamed files to follow code style adopted for python scripts Signed-off-by: Khush-dev <[email protected]>
1 parent 765d581 commit 84ab8be

15 files changed

+60
-61
lines changed

launch_testing/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -224,8 +224,8 @@ Usage:
224224
launch_test test/launch_testing/examples/good_proc_launch_test.py
225225
```
226226

227-
This test checks a process called good_proc (source found in the [example_processes folder](example_processes)).
228-
good_proc is a simple python process that prints "Loop 1, Loop2, etc. every second until it's terminated with ctrl+c.
227+
This test checks a process called good_proc.py (source found in the [example_processes folder](example_processes)).
228+
good_proc.py is a simple python process that prints "Loop 1, Loop2, etc. every second until it's terminated with ctrl+c.
229229
The test will launch the process, wait for a few loops to complete by monitoring stdout, then terminate the process
230230
and run some post-shutdown checks.
231231

launch_testing/example_processes/exit_code_proc renamed to launch_testing/example_processes/exit_code_proc.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,17 @@
1515
# limitations under the License.
1616

1717
import sys
18-
import time
1918

2019

2120
# This process pretends to do some simple setup, then pretends to do some simple work,
2221
# then shuts itself down automatically
23-
if __name__ == "__main__":
22+
if __name__ == '__main__':
2423

25-
if "--silent" in sys.argv[1:]:
24+
if '--silent' in sys.argv[1:]:
2625
sys.exit(1)
2726

2827
if '--exception' in sys.argv[1:]:
29-
raise Exception("Process had a pretend error")
28+
raise Exception('Process had a pretend error')
3029

31-
print("Exiting with a code")
32-
sys.exit(1)
30+
print('Exiting with a code')
31+
sys.exit(1)

launch_testing/example_processes/good_proc renamed to launch_testing/example_processes/good_proc.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,22 +20,22 @@
2020

2121
# This is a simple program that generates some stdout, waits for ctrl+c, and exits with
2222
# an exit code of zero
23-
if __name__ == "__main__":
23+
if __name__ == '__main__':
2424

2525
if sys.argv[1:]:
26-
print("Called with arguments {}".format(sys.argv[1:]))
26+
print('Called with arguments {}'.format(sys.argv[1:]))
2727

28-
print("Starting Up")
28+
print('Starting Up')
2929

3030
loops = 0
3131
try:
3232
while True:
33-
print("Loop {}".format(loops))
33+
print('Loop {}'.format(loops))
3434
loops += 1
3535
time.sleep(1.0)
3636
except KeyboardInterrupt:
3737
pass
3838

39-
print("Shutting Down")
39+
print('Shutting Down')
4040

4141
sys.exit(0)

launch_testing/example_processes/terminating_proc renamed to launch_testing/example_processes/terminating_proc.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,25 +20,25 @@
2020

2121
# This process pretends to do some simple setup, then pretends to do some simple work,
2222
# then shuts itself down automatically
23-
if __name__ == "__main__":
23+
if __name__ == '__main__':
2424

25-
print("Starting Up")
25+
print('Starting Up')
2626
time.sleep(1.0)
27-
print("Ready")
27+
print('Ready')
2828

2929
if sys.argv[1:]:
30-
print("Called with arguments {}".format(sys.argv[1:]))
30+
print('Called with arguments {}'.format(sys.argv[1:]))
3131

3232
if '--exception' in sys.argv[1:]:
33-
raise Exception("Process had a pretend error")
33+
raise Exception('Process had a pretend error')
3434

3535
try:
36-
print("Emulating Work")
36+
print('Emulating Work')
3737
time.sleep(1.0)
38-
print("Done")
38+
print('Done')
3939
except KeyboardInterrupt:
4040
pass
4141

42-
print("Shutting Down")
42+
print('Shutting Down')
4343

4444
sys.exit(0)

launch_testing/test/launch_testing/examples/args_launch_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def generate_test_description():
3737
os.path.join(
3838
ament_index_python.get_package_prefix('launch_testing'),
3939
'lib/launch_testing',
40-
'terminating_proc',
40+
'terminating_proc.py',
4141
),
4242

4343
# Arguments

launch_testing/test/launch_testing/examples/context_launch_test.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,11 @@ def get_test_process_action():
3232
TEST_PROC_PATH = os.path.join(
3333
ament_index_python.get_package_prefix('launch_testing'),
3434
'lib/launch_testing',
35-
'good_proc'
35+
'good_proc.py'
3636
)
3737
return launch.actions.ExecuteProcess(
3838
cmd=[sys.executable, TEST_PROC_PATH],
39-
name='good_proc',
39+
name='good_proc.py',
4040
# This is necessary to get unbuffered output from the process under test
4141
additional_env={'PYTHONUNBUFFERED': '1'},
4242
)
@@ -96,9 +96,9 @@ def test_int_val(self, int_val):
9696
def test_all_context_objects(self, int_val, dut):
9797
# Multiple arguments are supported
9898
self.assertEqual(int_val, 10)
99-
self.assertIn('good_proc', dut.process_details['name'])
99+
self.assertIn('good_proc.py', dut.process_details['name'])
100100

101101
def test_all_context_objects_different_order(self, dut, int_val):
102102
# Put the arguments in a different order from the above test
103103
self.assertEqual(int_val, 10)
104-
self.assertIn('good_proc', dut.process_details['name'])
104+
self.assertIn('good_proc.py', dut.process_details['name'])

launch_testing/test/launch_testing/examples/good_proc_launch_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def generate_test_description():
3333
TEST_PROC_PATH = os.path.join(
3434
ament_index_python.get_package_prefix('launch_testing'),
3535
'lib/launch_testing',
36-
'good_proc'
36+
'good_proc.py'
3737
)
3838

3939
# This is necessary to get unbuffered output from the process under test

launch_testing/test/launch_testing/examples/parameters_launch_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def generate_test_description(arg_param):
3737
os.path.join(
3838
ament_index_python.get_package_prefix('launch_testing'),
3939
'lib/launch_testing',
40-
'terminating_proc',
40+
'terminating_proc.py',
4141
),
4242
# Use the parameter passed to generate_test_description as an argument
4343
# to the terminating_proc

launch_testing/test/launch_testing/examples/ready_action_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def generate_test_description():
3333
TEST_PROC_PATH = os.path.join(
3434
ament_index_python.get_package_prefix('launch_testing'),
3535
'lib/launch_testing',
36-
'good_proc'
36+
'good_proc.py'
3737
)
3838

3939
# This is necessary to get unbuffered output from the process under test

launch_testing/test/launch_testing/examples/terminating_proc_launch_test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,11 @@ def get_test_process_action(*, args=[]):
3434
test_proc_path = os.path.join(
3535
ament_index_python.get_package_prefix('launch_testing'),
3636
'lib/launch_testing',
37-
'terminating_proc'
37+
'terminating_proc.py'
3838
)
3939
return launch.actions.ExecuteProcess(
4040
cmd=[sys.executable, test_proc_path, *args],
41-
name='terminating_proc',
41+
name='terminating_proc.py',
4242
# This is necessary to get unbuffered output from the process under test
4343
additional_env={'PYTHONUNBUFFERED': '1'},
4444
output='screen'

0 commit comments

Comments
 (0)