Skip to content

Commit

Permalink
tools/gen-cpydiff.py: Don't rename foo to ufoo in diff output.
Browse files Browse the repository at this point in the history
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
  • Loading branch information
jimmo authored and dpgeorge committed Aug 13, 2021
1 parent c737cde commit ee549d7
Showing 1 changed file with 3 additions and 13 deletions.
16 changes: 3 additions & 13 deletions tools/gen-cpydiff.py
Expand Up @@ -50,7 +50,6 @@
INDEX = "index.rst"

HEADER = ".. This document was generated by tools/gen-cpydiff.py\n\n"
UIMPORTLIST = {"struct", "collections", "json"}
CLASSMAP = {"Core": "Core language", "Types": "Builtin types"}
INDEXPRIORITY = ["syntax", "core_language", "builtin_types", "modules"]
RSTCHARS = ["=", "-", "~", "`", ":"]
Expand Down Expand Up @@ -94,21 +93,12 @@ def readfiles():
return files


def uimports(code):
"""converts CPython module names into MicroPython equivalents"""
for uimport in UIMPORTLIST:
uimport = bytes(uimport, "utf8")
code = code.replace(uimport, b"u" + uimport)
return code


def run_tests(tests):
"""executes all tests"""
results = []
for test in tests:
with open(TESTPATH + test.name, "rb") as f:
input_cpy = f.read()
input_upy = uimports(input_cpy)
input_py = f.read()

process = subprocess.Popen(
CPYTHON3,
Expand All @@ -117,7 +107,7 @@ def run_tests(tests):
stdin=subprocess.PIPE,
stderr=subprocess.PIPE,
)
output_cpy = [com.decode("utf8") for com in process.communicate(input_cpy)]
output_cpy = [com.decode("utf8") for com in process.communicate(input_py)]

process = subprocess.Popen(
MICROPYTHON,
Expand All @@ -126,7 +116,7 @@ def run_tests(tests):
stdin=subprocess.PIPE,
stderr=subprocess.PIPE,
)
output_upy = [com.decode("utf8") for com in process.communicate(input_upy)]
output_upy = [com.decode("utf8") for com in process.communicate(input_py)]

if output_cpy[0] == output_upy[0] and output_cpy[1] == output_upy[1]:
status = "Supported"
Expand Down

0 comments on commit ee549d7

Please sign in to comment.