basic dump-api tool
This commit is contained in:
parent
f85f8cf675
commit
eedb9352e2
4 changed files with 8198 additions and 0 deletions
29
tests/test_api/test_api.py
Normal file
29
tests/test_api/test_api.py
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
import os.path
|
||||
import subprocess
|
||||
import unittest
|
||||
|
||||
|
||||
class TestAPICompat(unittest.TestCase):
|
||||
|
||||
# path to dump-api script
|
||||
SCRIPT = os.path.relpath(os.path.dirname(__file__) + '/../../devtools/check-api')
|
||||
|
||||
# base api data, as generated by dump-api
|
||||
BASE = os.path.relpath(os.path.dirname(__file__) + '/data/api.json')
|
||||
|
||||
def test_api_compat(self):
|
||||
cmd = [self.SCRIPT, self.BASE]
|
||||
proc = subprocess.Popen(cmd, stderr=subprocess.PIPE)
|
||||
(_, err) = proc.communicate()
|
||||
status = proc.wait()
|
||||
errors = 0
|
||||
for line in err.decode().splitlines():
|
||||
if line.startswith('ERROR'):
|
||||
print(line)
|
||||
errors += 1
|
||||
if errors or status != 0:
|
||||
print('Command failed: %s' % ' '.join(cmd))
|
||||
raise Exception('API verification failed')
|
||||
|
||||
|
||||
# the end
|
||||
Loading…
Add table
Add a link
Reference in a new issue