sapling/eden/scm/tests/test-check-win32-signature.py
Xavier Deguillard 467f4aef45 tests: mark python3 tests as passing
Summary:
Ran ./run-tests.py --json and used the following script:

  import json
  import subprocess

  with open("report.json", "r") as f:
      tests = json.load(f)
      for name, t in tests.items():
          if t["result"] == "success":
              print("%s successful" % name)
              subprocess.run("sed -i '/#require py2/d' %s" % name, shell=True)
              subprocess.run("sed -i '/require.*py2/d' %s" % name, shell=True)

Reviewed By: singhsrb

Differential Revision: D19664298

fbshipit-source-id: fa67c7c7abd110c9f0df9345daf09f2792aacd44
2020-01-31 10:13:45 -08:00

28 lines
835 B
Python

# Copyright 2019 Facebook, Inc.
#
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2 or any later version.
import os
import re
from hghave import require
def checkpath(path, dllnames):
content = open(path).read()
for name in dllnames:
for matched in sorted(set(re.findall(r"%s\.[^(.]*\(" % name, content))):
# remove tailing "("
funcname = matched[:-1]
for expected in ["%s.argtypes" % funcname, "%s.restype" % funcname]:
if expected not in content:
print("%s needs explicit argtypes and restype" % funcname)
break
checkpath(
"%s/../edenscm/mercurial/win32.py" % os.environ.get("RUNTESTDIR", "."),
["_kernel32", "_advapi32", "_user32", "_crypt32"],
)