X Tutup
Skip to content

Commit a309a77

Browse files
committed
Python3: remove "return None" at end of main for uncompyle. Fix up verify for Python3. First automated Python 3.4 tests via "makecheck-3.4" in test directory.
1 parent 29f02ed commit a309a77

File tree

118 files changed

+129
-4430
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

118 files changed

+129
-4430
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ python:
66
- '2.7'
77

88
script:
9-
- python ./setup.py develop && COMPILE='--compile' make test
9+
- python ./setup.py develop && COMPILE='--compile' make check-2.7

Makefile

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,16 @@ PHONY=check clean pytest dist distclean lint flake8 test test-unit test-function
1717
all: check
1818

1919
#: Same as "check"
20-
test check: pytest check-short
20+
test check: pytest check-long
21+
22+
#: Run tests
23+
check-long: pytest
24+
$(MAKE) -C test check-2.7
2125

2226
#: Run tests
2327
check-short: pytest
24-
$(MAKE) -C test $@
28+
$(MAKE) -C test check-short-2.7
29+
2530

2631
#: check that disassembly exactly matches Python lib's dis
2732
check-disasm:

circle.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ dependencies:
99
- pip install -r test-requirements.txt
1010
test:
1111
override:
12-
- python ./setup.py develop && make check
12+
- python ./setup.py develop && make check-2.7

pytest/test_disasm.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ def get_srcdir():
1313

1414
@pytest.mark.parametrize(("test_tuple", "function_to_test"), [
1515
(
16-
('../test/bytecode_2.5/test_import.pyc', 'testdata/test_import_25.right',),
16+
('../test/bytecode_2.7/if.pyc', 'testdata/if-2.7.right',),
1717
disassemble_file
1818
),
1919
(
20-
('../test/bytecode_2.7/test1.pyc', 'testdata/test1.right',),
20+
('../test/bytecode_2.7/ifelse.pyc', 'testdata/ifelse-2.7.right',),
2121
disassemble_file
2222
),
2323
])

pytest/testdata/if-2.7.right

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Python 2.7
2+
# Embedded file name: ./source_3.4/branching/if.py
3+
4+
1 0 LOAD_NAME 'a'
5+
3 POP_JUMP_IF_FALSE '15'
6+
7+
2 6 LOAD_NAME 'c'
8+
9 STORE_NAME 'b'
9+
12 JUMP_FORWARD '15'
10+
15_0 COME_FROM '12'
11+
15 LOAD_CONST ''
12+
18 RETURN_VALUE ''
13+

pytest/testdata/ifelse-2.7.right

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Python 2.7
2+
# Embedded file name: ./source_3.4/branching/ifelse.py
3+
4+
1 0 LOAD_NAME 'a'
5+
3 POP_JUMP_IF_FALSE '15'
6+
7+
2 6 LOAD_NAME 'c'
8+
9 STORE_NAME 'b'
9+
12 JUMP_FORWARD '21'
10+
11+
4 15 LOAD_NAME 'e'
12+
18 STORE_NAME 'd'
13+
21_0 COME_FROM '12'
14+
21 LOAD_CONST ''
15+
24 RETURN_VALUE ''
16+

pytest/testdata/test1.right

Lines changed: 0 additions & 88 deletions
This file was deleted.

test/Makefile

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,20 @@ PHONY=check clean dist distclean test test-unit test-functional rmChangeLog clea
33
GIT2CL ?= git2cl
44
PYTHON ?= python
55

6+
PYTHON_VERSION = $(shell $(PYTHON) -V | cut -d ' ' -f 2 | cut -d'.' -f1,2)
7+
NATIVE_CHECK = check-$(PYTHON_VERSION)
8+
69
# Set COMPILE='--compile' to force compilation before check
710
COMPILE ?=
811

9-
#: Run all tests
10-
check: check-short check-2.7-ok
12+
#: Run working tests from Python 2.7
13+
check-2.7: check-short-2.7 check-bytecode check-2.7-ok
14+
15+
#: Run working tests from Python 3.4
16+
check-3.4: check-short-2.7 check-bytecode check-native-short
17+
18+
check:
19+
@echo "For now, use check-2.7 or check.3.4" && false
1120

1221
## FIXME: there is a bug in our code that I don't
1322
## find in uncompyle2 that causes this to fail.
@@ -24,9 +33,12 @@ check-disasm:
2433
check-bytecode:
2534
$(PYTHON) test_pythonlib.py --bytecode-2.5
2635

27-
#: Run quick tests
28-
check-short:
29-
$(PYTHON) test_pythonlib.py --base-2.7 --verify $(COMPILE)
36+
#: short tests for bytecodes only for this version of Python
37+
check-native-short:
38+
$(PYTHON) test_pythonlib.py --bytecode-$(PYTHON_VERSION) --verify $(COMPILE)
39+
40+
check-short-2.7:
41+
$(PYTHON) test_pythonlib.py --bytecode-2.7 --verify $(COMPILE)
3042

3143
#: Run longer Python 2.7's lib files known to be okay
3244
check-2.7-ok:
-844 Bytes
Binary file not shown.
-1.29 KB
Binary file not shown.

0 commit comments

Comments
 (0)
X Tutup