Skip to content

Commit 6031957

Browse files
committed
tests: Automatically skip tests that require eval, exec or frozenset.
1 parent 24c513c commit 6031957

8 files changed

Lines changed: 47 additions & 1 deletion

File tree

tests/basics/builtin_eval.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# builtin eval
22

3+
try:
4+
eval
5+
except NameError:
6+
print("SKIP")
7+
raise SystemExit
8+
39
eval('1 + 2')
410
eval('1 + 2\n')
511
eval('1 + 2\n\n#comment\n')

tests/basics/builtin_eval_error.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# test if eval raises SyntaxError
22

3+
try:
4+
eval
5+
except NameError:
6+
print("SKIP")
7+
raise SystemExit
8+
39
try:
410
print(eval("[1,,]"))
511
except SyntaxError:

tests/basics/builtin_exec.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
# test builtin exec
2+
3+
try:
4+
exec
5+
except NameError:
6+
print("SKIP")
7+
raise SystemExit
8+
19
print(exec("def foo(): return 42"))
210
print(foo())
311

tests/basics/fun_calldblstar2.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# test passing a string object as the key for a keyword argument
22

3+
try:
4+
exec
5+
except NameError:
6+
print("SKIP")
7+
raise SystemExit
8+
39
# they key in this dict is a string object and is not interned
410
args = {'thisisaverylongargumentname': 123}
511

tests/basics/lexer.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# test the lexer
22

3+
try:
4+
eval
5+
exec
6+
except NameError:
7+
print("SKIP")
8+
raise SystemExit
9+
310
# __debug__ is a special symbol
411
print(type(__debug__))
512

tests/basics/python34.py

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

3+
try:
4+
exec
5+
except NameError:
6+
print("SKIP")
7+
raise SystemExit
8+
39
# from basics/fun_kwvarargs.py
410
# test evaluation order of arguments (in 3.4 it's backwards, 3.5 it's fixed)
511
def f4(*vargs, **kwargs):

tests/basics/syntaxerror.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# test syntax errors
22

3+
try:
4+
exec
5+
except NameError:
6+
print("SKIP")
7+
raise SystemExit
8+
39
def test_syntax(code):
410
try:
511
exec(code)

tests/micropython/heapalloc_iter.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
# test that iterating doesn't use the heap
22
try:
3+
frozenset
34
import array
4-
except ImportError:
5+
except (NameError, ImportError):
56
print("SKIP")
67
raise SystemExit
78

0 commit comments

Comments
 (0)