diff options
author | Mats Wichmann <mats@linux.com> | 2021-01-21 20:51:35 (GMT) |
---|---|---|
committer | Mats Wichmann <mats@linux.com> | 2021-01-22 19:08:01 (GMT) |
commit | bc339562305df8cff3bc2e6663a87d8cd343b665 (patch) | |
tree | 120d0b152e7af49c3a422e075e1d21499a16266f | |
parent | 64cab3512292da9b4470d212824e543a3c6b9c52 (diff) | |
download | SCons-bc339562305df8cff3bc2e6663a87d8cd343b665.zip SCons-bc339562305df8cff3bc2e6663a87d8cd343b665.tar.gz SCons-bc339562305df8cff3bc2e6663a87d8cd343b665.tar.bz2 |
Initial support in tests for Python 3.10
Expected bytecode and one changed expected exception message.
Change some more regexes to be specified as rawstrings in response
to DeprecationWarnings.
Signed-off-by: Mats Wichmann <mats@linux.com>
-rwxr-xr-x | CHANGES.txt | 8 | ||||
-rw-r--r-- | SCons/Action.py | 2 | ||||
-rw-r--r-- | SCons/ActionTests.py | 9 | ||||
-rw-r--r-- | SCons/SubstTests.py | 4 | ||||
-rw-r--r-- | SCons/Tool/docbook/__init__.py | 8 | ||||
-rw-r--r-- | SCons/Variables/__init__.py | 2 | ||||
-rw-r--r-- | test/Interactive/configure.py | 6 |
7 files changed, 27 insertions, 12 deletions
diff --git a/CHANGES.txt b/CHANGES.txt index c2faede..67a2bad 100755 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -8,9 +8,13 @@ NOTE: The 4.0.0 Release of SCons dropped Python 2.7 Support RELEASE VERSION/DATE TO BE FILLED IN LATER - From John Doe: + From John Doe: + - Whatever John Doe did. - - Whatever John Doe did. + From Mats Wichmann: + - Initial support in tests for Python 3.10 - expected bytecode and + one changed expected exception message. Change some more regexes + to be specified as rawstrings in response to DeprecationWarnings. RELEASE 4.1.0 - Tues, 19 Jan 2021 15:04:42 -0700 diff --git a/SCons/Action.py b/SCons/Action.py index d7f10df..97309e6 100644 --- a/SCons/Action.py +++ b/SCons/Action.py @@ -145,7 +145,7 @@ def rfile(n): def default_exitstatfunc(s): return s -strip_quotes = re.compile('^[\'"](.*)[\'"]$') +strip_quotes = re.compile(r'^[\'"](.*)[\'"]$') def _callable_contents(obj): diff --git a/SCons/ActionTests.py b/SCons/ActionTests.py index c03e87f..e665472 100644 --- a/SCons/ActionTests.py +++ b/SCons/ActionTests.py @@ -1516,6 +1516,7 @@ class CommandGeneratorActionTestCase(unittest.TestCase): (3, 7): bytearray(b'0, 0, 0, 0,(),(),(d\x00S\x00),(),()'), (3, 8): bytearray(b'0, 0, 0, 0,(),(),(d\x00S\x00),(),()'), (3, 9): bytearray(b'0, 0, 0, 0,(),(),(d\x00S\x00),(),()'), + (3, 10): bytearray(b'0, 0, 0, 0,(),(),(d\x00S\x00),(),()'), } meth_matches = [ @@ -1695,6 +1696,7 @@ class FunctionActionTestCase(unittest.TestCase): (3, 7): bytearray(b'0, 0, 0, 0,(),(),(d\x00S\x00),(),()'), (3, 8): bytearray(b'0, 0, 0, 0,(),(),(d\x00S\x00),(),()'), (3, 9): bytearray(b'0, 0, 0, 0,(),(),(d\x00S\x00),(),()'), + (3, 10): bytearray(b'0, 0, 0, 0,(),(),(d\x00S\x00),(),()'), } @@ -1704,6 +1706,7 @@ class FunctionActionTestCase(unittest.TestCase): (3, 7): bytearray(b'1, 1, 0, 0,(),(),(d\x00S\x00),(),()'), (3, 8): bytearray(b'1, 1, 0, 0,(),(),(d\x00S\x00),(),()'), (3, 9): bytearray(b'1, 1, 0, 0,(),(),(d\x00S\x00),(),()'), + (3, 10): bytearray(b'1, 1, 0, 0,(),(),(d\x00S\x00),(),()'), } def factory(act, **kw): @@ -1949,6 +1952,7 @@ class LazyActionTestCase(unittest.TestCase): (3, 7): bytearray(b'0, 0, 0, 0,(),(),(d\x00S\x00),(),()'), (3, 8): bytearray(b'0, 0, 0, 0,(),(),(d\x00S\x00),(),()'), (3, 9): bytearray(b'0, 0, 0, 0,(),(),(d\x00S\x00),(),()'), + (3, 10): bytearray(b'0, 0, 0, 0,(),(),(d\x00S\x00),(),()'), } meth_matches = [ @@ -2008,6 +2012,7 @@ class ActionCallerTestCase(unittest.TestCase): (3, 7): b'd\x00S\x00', (3, 8): b'd\x00S\x00', (3, 9): b'd\x00S\x00', + (3, 10): b'd\x00S\x00', } @@ -2209,6 +2214,7 @@ class ObjectContentsTestCase(unittest.TestCase): (3, 7): bytearray(b'3, 3, 0, 0,(),(),(|\x00S\x00),(),()'), (3, 8): bytearray(b'3, 3, 0, 0,(),(),(|\x00S\x00),(),()'), (3, 9): bytearray(b'3, 3, 0, 0,(),(),(|\x00S\x00),(),()'), + (3, 10): bytearray(b'3, 3, 0, 0,(N.),(),(|\x00S\x00),(),()'), } c = SCons.Action._function_contents(func1) @@ -2236,6 +2242,8 @@ class ObjectContentsTestCase(unittest.TestCase): b"{TestClass:__main__}[[[(<class \'object\'>, ()), [(<class \'__main__.TestClass\'>, (<class \'object\'>,))]]]]{{1, 1, 0, 0,(a,b),(a,b),(d\x01|\x00_\x00d\x02|\x00_\x01d\x00S\x00),(),(),2, 2, 0, 0,(),(),(d\x00S\x00),(),()}}{{{a=a,b=b}}}"), (3, 9): bytearray( b"{TestClass:__main__}[[[(<class \'object\'>, ()), [(<class \'__main__.TestClass\'>, (<class \'object\'>,))]]]]{{1, 1, 0, 0,(a,b),(a,b),(d\x01|\x00_\x00d\x02|\x00_\x01d\x00S\x00),(),(),2, 2, 0, 0,(),(),(d\x00S\x00),(),()}}{{{a=a,b=b}}}"), + (3, 10): bytearray( + b"{TestClass:__main__}[[[(<class \'object\'>, ()), [(<class \'__main__.TestClass\'>, (<class \'object\'>,))]]]]{{1, 1, 0, 0,(a,b),(a,b),(d\x01|\x00_\x00d\x02|\x00_\x01d\x00S\x00),(),(),2, 2, 0, 0,(),(),(d\x00S\x00),(),()}}{{{a=a,b=b}}}"), } assert c == expected[sys.version_info[:2]], "Got\n" + repr(c) + "\nExpected \n" + "\n" + repr( @@ -2254,6 +2262,7 @@ class ObjectContentsTestCase(unittest.TestCase): (3, 7): bytearray(b'0, 0, 0, 0,(Hello, World!),(print),(e\x00d\x00\x83\x01\x01\x00d\x01S\x00)'), (3, 8): bytearray(b'0, 0, 0, 0,(Hello, World!),(print),(e\x00d\x00\x83\x01\x01\x00d\x01S\x00)'), (3, 9): bytearray(b'0, 0, 0, 0,(Hello, World!),(print),(e\x00d\x00\x83\x01\x01\x00d\x01S\x00)'), + (3, 10): bytearray(b'0, 0, 0, 0,(Hello, World!),(print),(e\x00d\x00\x83\x01\x01\x00d\x01S\x00)'), } assert c == expected[sys.version_info[:2]], "Got\n" + repr(c) + "\nExpected \n" + "\n" + repr(expected[ diff --git a/SCons/SubstTests.py b/SCons/SubstTests.py index be62db0..bdeb01e 100644 --- a/SCons/SubstTests.py +++ b/SCons/SubstTests.py @@ -590,7 +590,9 @@ class scons_subst_TestCase(SubstTestCase): except SCons.Errors.UserError as e: expect = [ # Python 3.5 (and 3.x?) - "TypeError `func() missing 2 required positional arguments: 'b' and 'c'' trying to evaluate `${func(1)}'" + "TypeError `func() missing 2 required positional arguments: 'b' and 'c'' trying to evaluate `${func(1)}'", + # Python 3.10 + "TypeError `scons_subst_TestCase.test_subst_type_errors.<locals>.func() missing 2 required positional arguments: 'b' and 'c'' trying to evaluate `${func(1)}'", ] assert str(e) in expect, repr(str(e)) else: diff --git a/SCons/Tool/docbook/__init__.py b/SCons/Tool/docbook/__init__.py index 366dff4..450860d 100644 --- a/SCons/Tool/docbook/__init__.py +++ b/SCons/Tool/docbook/__init__.py @@ -62,8 +62,8 @@ except Exception: prefer_xsltproc = False # Regexs for parsing Docbook XML sources of MAN pages -re_manvolnum = re.compile("<manvolnum>([^<]*)</manvolnum>") -re_refname = re.compile("<refname>([^<]*)</refname>") +re_manvolnum = re.compile(r"<manvolnum>([^<]*)</manvolnum>") +re_refname = re.compile(r"<refname>([^<]*)</refname>") # # Helper functions @@ -203,8 +203,8 @@ def _detect(env): # # Scanners # -include_re = re.compile('fileref\\s*=\\s*["|\']([^\\n]*)["|\']') -sentity_re = re.compile('<!ENTITY\\s+%*\\s*[^\\s]+\\s+SYSTEM\\s+["|\']([^\\n]*)["|\']>') +include_re = re.compile(r'fileref\\s*=\\s*["|\']([^\\n]*)["|\']') +sentity_re = re.compile(r'<!ENTITY\\s+%*\\s*[^\\s]+\\s+SYSTEM\\s+["|\']([^\\n]*)["|\']>') def __xml_scan(node, env, path, arg): """ Simple XML file scanner, detecting local images and XIncludes as implicit dependencies. """ diff --git a/SCons/Variables/__init__.py b/SCons/Variables/__init__.py index 2c32310..4a30a91 100644 --- a/SCons/Variables/__init__.py +++ b/SCons/Variables/__init__.py @@ -111,7 +111,7 @@ class Variables: return [o.key for o in self.options] def Add(self, key, help="", default=None, validator=None, converter=None, **kw): - """Add an option. + r"""Add an option. Args: key: the name of the variable, or a list or tuple of arguments diff --git a/test/Interactive/configure.py b/test/Interactive/configure.py index dfe1c7f..ebb4262 100644 --- a/test/Interactive/configure.py +++ b/test/Interactive/configure.py @@ -53,9 +53,9 @@ import re # The order of this list is related to the order of the counts below expected_patterns = [ - re.compile("^scons>>> .*foo\.cpp.*$"), - re.compile("^scons>>> scons: `foo.obj' is up to date\.$"), - re.compile("^scons>>>\s*$"), + re.compile(r"^scons>>> .*foo\.cpp.*$"), + re.compile(r"^scons>>> scons: `foo.obj' is up to date\.$"), + re.compile(r"^scons>>>\s*$"), ] # The order of this list is related to the order of the regular expressions above |