diff options
author | Bram Moolenaar <Bram@vim.org> | 2020-10-27 19:59:10 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2020-10-27 19:59:10 +0100 |
commit | 68a48ee55e55c189b03a6718a0d06af1dfedcd16 (patch) | |
tree | e6c827074f9c1abbc6e15bc8e38e3b802609fc5b /src | |
parent | 977fd0b327ed46a71c80d2cd62cbe149d43b9a69 (diff) |
patch 8.2.1912: with Python 3.9 some tests failv8.2.1912
Problem: With Python 3.9 some tests fail.
Solution: Take into account the different error message. (James McCoy,
closes #7210)
Diffstat (limited to 'src')
-rw-r--r-- | src/testdir/test_python3.vim | 14 | ||||
-rw-r--r-- | src/version.c | 2 |
2 files changed, 15 insertions, 1 deletions
diff --git a/src/testdir/test_python3.vim b/src/testdir/test_python3.vim index 1bdb4c1719..f05fc07024 100644 --- a/src/testdir/test_python3.vim +++ b/src/testdir/test_python3.vim @@ -23,6 +23,7 @@ func Test_AAA_python3_setup() py33_type_error_pattern = re.compile('^__call__\(\) takes (\d+) positional argument but (\d+) were given$') py37_exception_repr = re.compile(r'([^\(\),])(\)+)$') + py39_type_error_pattern = re.compile('\w+\.([^(]+\(\) takes)') def emsg(ei): return ei[0].__name__ + ':' + repr(ei[1].args) @@ -56,6 +57,8 @@ func Test_AAA_python3_setup() oldmsg2 = '''"Can't convert 'int' object to str implicitly"''' if msg.find(newmsg2) > -1: msg = msg.replace(newmsg2, oldmsg2) + # Python 3.9 reports errors like "vim.command() takes ..." instead of "command() takes ..." + msg = py39_type_error_pattern.sub(r'\1', msg) elif sys.version_info >= (3, 5) and e.__class__ is ValueError and str(e) == 'embedded null byte': msg = repr((TypeError, TypeError('expected bytes with no null'))) else: @@ -3812,7 +3815,16 @@ func Test_python3_errors() vim.current.xxx = True:(<class 'AttributeError'>, AttributeError('xxx',)) END - call assert_equal(expected, getline(2, '$')) + let actual = getline(2, '$') + let n_expected = len(expected) + let n_actual = len(actual) + call assert_equal(n_expected, n_actual, 'number of lines to compare') + + " Compare line by line so the errors are easier to understand. Missing lines + " are compared with an empty string. + for i in range(n_expected > n_actual ? n_expected : n_actual) + call assert_equal(i >= n_expected ? '' : expected[i], i >= n_actual ? '' : actual[i]) + endfor close! endfunc diff --git a/src/version.c b/src/version.c index 21370004a4..adef583b91 100644 --- a/src/version.c +++ b/src/version.c @@ -751,6 +751,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 1912, +/**/ 1911, /**/ 1910, |