File: 0015-Add-assert_-to-RosTest.patch

package info (click to toggle)
ros-ros-comm 1.17.4%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 10,400 kB
  • sloc: cpp: 42,116; python: 38,991; xml: 2,665; ansic: 2,384; sh: 274; makefile: 27
file content (24 lines) | stat: -rw-r--r-- 1,081 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
From: Jochen Sprickerhof <git@jochen.sprickerhof.de>
Date: Sat, 18 Nov 2023 21:04:02 +0100
Subject: Add assert_ to RosTest

This was removed in Python 3.12:

https://docs.python.org/3/whatsnew/3.12.html#unittest-testcase-removed-aliases
---
 tools/rostest/src/rostest/runner.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/rostest/src/rostest/runner.py b/tools/rostest/src/rostest/runner.py
index 8159faa..d853d17 100644
--- a/tools/rostest/src/rostest/runner.py
+++ b/tools/rostest/src/rostest/runner.py
@@ -231,7 +231,7 @@ def createUnitTest(pkg, test_file, reuse_master=False, clear=False, results_base
     # pass in config to class as a property so that test_parent can be initialized
     classdict = { 'setUp': setUp, 'tearDown': tearDown, 'config': config,
                   'test_parent': None, 'test_file': test_file,
-                  'reuse_master': reuse_master, 'clear': clear }
+                  'reuse_master': reuse_master, 'clear': clear, 'assert_': unittest.TestCase.assertTrue }
     
     # add in the tests
     testNames = []