Skip to content

Commit 69b774f

Browse files
author
Michael Howitz
authored
Lint the tests. (#234)
Additionally update to current version of meta/config.
1 parent 8100312 commit 69b774f

20 files changed

+48
-43
lines changed

.github/workflows/tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
- ["3.8", "py38"]
2828
- ["3.9", "py39"]
2929
- ["3.10", "py310"]
30-
- ["3.11.0-beta.3", "py311"]
30+
- ["3.11.0-rc.2", "py311"]
3131
- ["3.9", "docs"]
3232
- ["3.9", "coverage"]
3333
- ["3.9", "py39-datetime"]

.meta.toml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# https://github.com/zopefoundation/meta/tree/master/config/pure-python
33
[meta]
44
template = "pure-python"
5-
commit-id = "b4cfc9ca6065ca82646fa69d04ee4c15c58035e1"
5+
commit-id = "b5df3766ff8923477f3d24729b19504f0c401a2e"
66

77
[python]
88
with-pypy = false
@@ -59,6 +59,12 @@ coverage-setenv = [
5959
[coverage]
6060
fail-under = 98.8
6161

62+
[isort]
63+
additional-sources = "{toxinidir}/tests"
64+
65+
[flake8]
66+
additional-sources = "tests"
67+
6268
[manifest]
6369
additional-rules = [
6470
"recursive-include docs *.ast",

tests/builtins/test_limits.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1+
import pytest
2+
13
from RestrictedPython.Limits import limited_list
24
from RestrictedPython.Limits import limited_range
35
from RestrictedPython.Limits import limited_tuple
46

5-
import pytest
6-
77

88
def test_limited_range_length_1():
99
result = limited_range(1)

tests/helper.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1+
import RestrictedPython.Guards
12
from RestrictedPython import compile_restricted_eval
23
from RestrictedPython import compile_restricted_exec
34

4-
import RestrictedPython.Guards
5-
65

76
def _compile(compile_func, source):
87
"""Compile some source with a compile func."""

tests/test_Guards.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import pytest
2+
13
from RestrictedPython import compile_restricted_exec
24
from RestrictedPython.Guards import guarded_unpack_sequence
35
from RestrictedPython.Guards import safe_builtins
@@ -6,8 +8,6 @@
68
from tests.helper import restricted_eval
79
from tests.helper import restricted_exec
810

9-
import pytest
10-
1111

1212
def _write_(x):
1313
return x

tests/test_NamedExpr.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@
33

44
from ast import NodeTransformer
55
from ast import parse
6+
from unittest import TestCase
7+
from unittest import skipUnless
8+
69
from RestrictedPython import compile_restricted
710
from RestrictedPython import safe_globals
811
from RestrictedPython._compat import IS_PY38_OR_GREATER
9-
from unittest import skipUnless
10-
from unittest import TestCase
1112

1213

1314
@skipUnless(IS_PY38_OR_GREATER, "Feature available for Python 3.8+")

tests/test_compile.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
1+
import platform
2+
import types
3+
4+
import pytest
5+
6+
from RestrictedPython import CompileResult
17
from RestrictedPython import compile_restricted
28
from RestrictedPython import compile_restricted_eval
39
from RestrictedPython import compile_restricted_exec
410
from RestrictedPython import compile_restricted_single
5-
from RestrictedPython import CompileResult
611
from RestrictedPython._compat import IS_PY38_OR_GREATER
712
from RestrictedPython._compat import IS_PY310_OR_GREATER
813
from tests.helper import restricted_eval
914

10-
import platform
11-
import pytest
12-
import types
13-
1415

1516
def test_compile__compile_restricted_invalid_code_input():
1617
with pytest.raises(TypeError):

tests/test_compile_restricted_function.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
from RestrictedPython import compile_restricted_function
1+
from types import FunctionType
2+
23
from RestrictedPython import PrintCollector
4+
from RestrictedPython import compile_restricted_function
35
from RestrictedPython import safe_builtins
46
from RestrictedPython._compat import IS_PY38_OR_GREATER
57
from RestrictedPython._compat import IS_PY310_OR_GREATER
6-
from types import FunctionType
78

89

910
def test_compile_restricted_function():

tests/test_eval.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
from RestrictedPython.Eval import RestrictionCapableEval
2-
31
import pytest
42

3+
from RestrictedPython.Eval import RestrictionCapableEval
4+
55

66
exp = """
77
{'a':[m.pop()]}['a'] \

tests/test_imports.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22
Tests about imports
33
"""
44

5+
import pytest
6+
57
from RestrictedPython import compile_restricted_exec
68
from RestrictedPython import safe_builtins
79
from tests.helper import restricted_exec
810

9-
import pytest
10-
1111

1212
OS_IMPORT_EXAMPLE = """
1313
import os

0 commit comments

Comments
 (0)