Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migration of integration tests to pytest #1274

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

URJala
Copy link
Collaborator

@URJala URJala commented Feb 14, 2025

The tests in robot_driver.py run, and initialisation is done entirely in conftest and test_common

Copy link

codecov bot commented Feb 14, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 6.25%. Comparing base (1b121b7) to head (7de2247).
Report is 400 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff            @@
##            main   #1274      +/-   ##
========================================
+ Coverage   3.59%   6.25%   +2.65%     
========================================
  Files         13      28      +15     
  Lines        947    2784    +1837     
  Branches     152     355     +203     
========================================
+ Hits          34     174     +140     
- Misses       843    2608    +1765     
+ Partials      70       2      -68     
Flag Coverage Δ
unittests 6.25% <ø> (+2.65%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@urfeex
Copy link
Member

urfeex commented Feb 17, 2025

@URJala is this ready to review?

@URJala
Copy link
Collaborator Author

URJala commented Feb 26, 2025

Yes, we talked about it maybe not being ideal to re-launch the driver between each test case, which is the only way I was able to make it work. You said you would take a look, and see if you could find anything that would keep the driver between test-cases. Otherwise feedback on the structure of the conftest and robot driver package is also welcome

@urfeex
Copy link
Member

urfeex commented Feb 26, 2025

How would I supposed to be running that? I am not that familiar with pytest / launch_pytest so I might just be stupid, but the standard colcon test seems not to work. Looking at launch_pytest I am not even sure whether a CMake integration is possible?

Edit:
Adding this to the CMakeLists.txt would work

    ament_add_pytest_test(robot_driver_test test/robot_driver.py
      TIMEOUT
        800
    )

However, for me the test is stuck on Initialising interfaces. It seems like the wait_dashboard_server and ursim are started after I abort the test using CTRL-C.

@URJala
Copy link
Collaborator Author

URJala commented Mar 4, 2025

I run it with pytest path/to/testfile.py (with options -s -v for more output, and --full-trace for a stack trace in case of errors). Yeah, whenever I have been running any tests locally, I launch ursim myself and remove the ursim and wait_dashboard_server from test_common. That has never worked locally for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants