Skip to content

Commit

Permalink
switched from colcon test to pytest
Browse files Browse the repository at this point in the history
  • Loading branch information
chiragbheemaiah committed Apr 22, 2024
1 parent 783dd97 commit 69dcb34
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 122 deletions.
16 changes: 16 additions & 0 deletions Turtlebot3_ws/src/infra/test/test_failure.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import pytest
import subprocess
import time

@pytest.fixture(scope="session")
def ros_launch(request):
process = subprocess.Popen(['ros2', 'launch', 'infra', 'initialization_failure.launch.py'], stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True)
yield process
process.terminate()
process.wait()

def test_check_output(ros_launch):
msg = 'Goal failed'
time.sleep(200) # Adjust the sleep time as needed
stdout, stderr = ros_launch.communicate()
assert msg in stdout, f"Expected '{msg}' not found in the output."
16 changes: 16 additions & 0 deletions Turtlebot3_ws/src/infra/test/test_success.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import pytest
import subprocess
import time

@pytest.fixture(scope="session")
def ros_launch(request):
process = subprocess.Popen(['ros2', 'launch', 'infra', 'initialization_success.launch.py'], stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True)
yield process
process.terminate()
process.wait()

def test_check_output(ros_launch):
msg = 'Goal succeeded'
time.sleep(200) # Adjust the sleep time as needed
stdout, stderr = ros_launch.communicate()
assert msg in stdout, f"Expected '{msg}' not found in the output."
61 changes: 0 additions & 61 deletions Turtlebot3_ws/src/infra/test/test_trial.py

This file was deleted.

61 changes: 0 additions & 61 deletions Turtlebot3_ws/src/infra/test/test_trial_2.py

This file was deleted.

0 comments on commit 69dcb34

Please sign in to comment.