Skip to content

Commit

Permalink
Fix test rosbag2_py test compatibility with Python < 3.8 (ros2#987)
Browse files Browse the repository at this point in the history
RHEL is currently using a Python version older than 3.8, which is when
the `missing_ok` argument was added to Path.unlink. For better
compatibility, we can just catch and ignore the FileNotFoundError.

Signed-off-by: Scott K Logan <logans@cottsay.net>
  • Loading branch information
cottsay authored Apr 13, 2022
1 parent e561100 commit d5783f0
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion rosbag2_py/test/test_reindexer.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,7 @@ def test_reindexer_multiple_files():

assert(result_path.exists())

result_path.unlink(missing_ok=True)
try:
result_path.unlink()
except FileNotFoundError:
pass

0 comments on commit d5783f0

Please sign in to comment.