Skip to content

Commit 8fffbaf

Browse files
authored
Merge pull request #2743 from jepler/python38
Fix testsuite for compatibility with Python 3.8
2 parents f47b964 + ffe73a4 commit 8fffbaf

18 files changed

+81
-22
lines changed

.github/workflows/build.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ jobs:
1616
env:
1717
GITHUB_CONTEXT: ${{ toJson(github) }}
1818
run: echo "$GITHUB_CONTEXT"
19-
- name: Set up Python 3.5
19+
- name: Set up Python 3.8
2020
uses: actions/setup-python@v1
2121
with:
22-
python-version: 3.5
22+
python-version: 3.8
2323
- name: Install deps
2424
run: |
2525
sudo apt-get install -y eatmydata
@@ -42,7 +42,7 @@ jobs:
4242
make -C ports/unix -j2
4343
make -C ports/unix coverage -j2
4444
- name: Test all
45-
run: MICROPY_CPYTHON3=python3.5 MICROPY_MICROPYTHON=../ports/unix/micropython_coverage ./run-tests -j1
45+
run: MICROPY_CPYTHON3=python3.8 MICROPY_MICROPYTHON=../ports/unix/micropython_coverage ./run-tests -j1
4646
working-directory: tests
4747
- name: Print failure info
4848
run: |
@@ -54,10 +54,10 @@ jobs:
5454
working-directory: tests
5555
if: failure()
5656
- name: Native Tests
57-
run: MICROPY_CPYTHON3=python3.5 MICROPY_MICROPYTHON=../ports/unix/micropython_coverage ./run-tests -j1 --emit native
57+
run: MICROPY_CPYTHON3=python3.8 MICROPY_MICROPYTHON=../ports/unix/micropython_coverage ./run-tests -j1 --emit native
5858
working-directory: tests
5959
- name: mpy Tests
60-
run: MICROPY_CPYTHON3=python3.5 MICROPY_MICROPYTHON=../ports/unix/micropython_coverage ./run-tests -j1 --via-mpy -d basics float
60+
run: MICROPY_CPYTHON3=python3.8 MICROPY_MICROPYTHON=../ports/unix/micropython_coverage ./run-tests -j1 --via-mpy -d basics float
6161
working-directory: tests
6262
- name: Docs
6363
run: sphinx-build -E -W -b html . _build/html
@@ -244,10 +244,10 @@ jobs:
244244
- "xinabox_cs11"
245245

246246
steps:
247-
- name: Set up Python 3.5
247+
- name: Set up Python 3.8
248248
uses: actions/setup-python@v1
249249
with:
250-
python-version: 3.5
250+
python-version: 3.8
251251
- name: Install deps
252252
run: |
253253
sudo apt-get install -y gettext
@@ -290,10 +290,10 @@ jobs:
290290
- "fomu"
291291

292292
steps:
293-
- name: Set up Python 3.5
293+
- name: Set up Python 3.8
294294
uses: actions/setup-python@v1
295295
with:
296-
python-version: 3.5
296+
python-version: 3.8
297297
- name: Install deps
298298
run: |
299299
sudo apt-get install -y gettext

.github/workflows/create_website_pr.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ jobs:
1212
env:
1313
GITHUB_CONTEXT: ${{ toJson(github) }}
1414
run: echo "$GITHUB_CONTEXT"
15-
- name: Set up Python 3.5
15+
- name: Set up Python 3.8
1616
uses: actions/setup-python@v1
1717
with:
18-
python-version: 3.5
18+
python-version: 3.8
1919
- name: Install deps
2020
run: |
2121
pip install requests sh click

tests/basics/dict1.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
try:
2828
{}[0]
2929
except KeyError as er:
30-
print('KeyError', er, repr(er), er.args)
30+
print('KeyError', er, er.args)
3131

3232
# unsupported unary op
3333
try:

tests/basics/exception1.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
print(repr(IndexError()))
22
print(str(IndexError()))
33

4-
print(repr(IndexError("foo")))
54
print(str(IndexError("foo")))
65

76
a = IndexError(1, "test", [100, 200])

tests/basics/gen_yield_from.py.exp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
here1
2+
3
3+
here2
4+
[1, 2]
5+
here1
6+
None
7+
here2
8+
[1, 2]
9+
here1
10+
123
11+
here2
12+
[1, 2]
13+
444
14+
[0, 1, 2]
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
-1
2+
1
3+
StopIteration
4+
-1
5+
1
6+
2
7+
leaf caught GeneratorExit and swallowed it
8+
delegating caught GeneratorExit
9+
StopIteration
10+
-1
11+
1
12+
2
13+
leaf caught GeneratorExit and raised StopIteration instead
14+
delegating caught GeneratorExit
15+
StopIteration
16+
123
17+
RuntimeError
18+
0
19+
1
20+
close
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
1
2+
got ValueError from upstream!
3+
str1
4+
got TypeError from downstream!
5+
123
6+
got StopIteration from downstream!

tests/basics/generator_close.py.exp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
None
2+
StopIteration
3+
1
4+
None
5+
StopIteration
6+
[1, 2]
7+
None
8+
StopIteration
9+
None
10+
ValueError

tests/basics/generator_return.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ def gen():
77
try:
88
print(next(g))
99
except StopIteration as e:
10-
print(repr(e))
10+
print(type(e), e.args)

tests/basics/int_big_error.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@
1717
except TypeError:
1818
print("TypeError")
1919

20-
# overflow because rhs of >> is being converted to machine int
20+
# overflow because arg of bytearray is being converted to machine int
2121
try:
22-
1 >> i
22+
bytearray(i)
2323
except OverflowError:
2424
print('OverflowError')
2525

tests/basics/parser.py.exp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
SyntaxError
2+
SyntaxError
3+
SyntaxError

tests/basics/python34.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# tests that differ when running under Python 3.4 vs 3.5/3.6
1+
# tests that differ when running under Python 3.4 vs 3.5/3.6/3.7
22

33
try:
44
exec
@@ -36,3 +36,7 @@ def test_syntax(code):
3636
import sys
3737
print(sys.version[:3])
3838
print(sys.version_info[0], sys.version_info[1])
39+
40+
# from basics/exception1.py
41+
# in 3.7 no comma is printed if there is only 1 arg (in 3.4-3.6 one is printed)
42+
print(repr(IndexError("foo")))

tests/basics/python34.py.exp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,4 @@ SyntaxError
1111
SyntaxError
1212
3.4
1313
3 4
14+
IndexError('foo',)

tests/basics/set_pop.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@
1515
print(s.pop()) # last pop() should trigger the optimisation
1616
for i in range(N):
1717
s.add(i) # check that we can add the numbers back to the set
18-
print(list(s))
18+
print(sorted(s))

tests/basics/subclass_native3.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ class MyExc(Exception):
77
print(e.args)
88

99
try:
10-
raise MyExc("Some error")
10+
raise MyExc("Some error", 1)
1111
except MyExc as e:
1212
print("Caught exception:", repr(e))
1313

1414
try:
15-
raise MyExc("Some error2")
15+
raise MyExc("Some error2", 2)
1616
except Exception as e:
1717
print("Caught exception:", repr(e))
1818

tests/basics/try_as_var.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
try:
22
raise ValueError(534)
33
except ValueError as e:
4-
print(repr(e))
4+
print(type(e), e.args)
55

66
# Var bound in except block is automatically deleted
77
try:

tests/import/import_override.py.exp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
import import1b None 0
2+
456

tests/misc/sys_exc_info.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ def f():
99
print(sys.exc_info()[0:2])
1010

1111
try:
12-
1/0
12+
raise ValueError('value', 123)
1313
except:
1414
print(sys.exc_info()[0:2])
1515
f()

0 commit comments

Comments
 (0)