Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Run nose using : nosetests --verbosity=2 --with-ignore-docstrings
- # Run pytest using : py.test -vvv
- # Run the script using : python <scriptname> /path/to/pytest/log/file/from/travis /path/to/nose/log/file/from/travis
- # Example of nose and pytest logs from travis:
- # - Nose - https://travis-ci.org/AbdealiJK/pywikibot-core/builds/131404927
- # - PyTest - https://travis-ci.org/AbdealiJK/pywikibot-core/builds/131373171
- import re
- import sys
- assert len(sys.argv) == 3, 'PyTest log and Nose log required'
- pylogfile, noselogfile = sys.argv[1:]
- with open(pylogfile) as f:
- pylog = f.read()
- with open(noselogfile) as f:
- noselog = f.read()
- NOSE_RE = re.compile(r'(?P<funcname>test.*) \((?P<pkgname>.*)\) \.\.\.')
- PYTEST_RE = re.compile(r'(?P<filename>tests/.*)\.py::(?P<clsname>.*)::(?P<funcname>[^ ]*) ')
- pytests = []
- for match in re.finditer(PYTEST_RE, pylog):
- match = match.groupdict()
- filename = match['filename']
- clsname = match['clsname']
- funcname = match['funcname']
- testname = filename + ":" + clsname + "." + funcname
- pytests.append(testname.strip())
- nosetests = []
- for match in re.finditer(NOSE_RE, noselog):
- match = match.groupdict()
- filename1, filename2, clsname = match['pkgname'].split('.')
- funcname = match['funcname']
- filename = filename1 + '/' + filename2
- testname = filename + ":" + clsname + "." + funcname
- nosetests.append(testname.strip())
- from pprint import pprint
- print('In pytest, but not in nose:',
- len(pytests), '-', len(nosetests),
- '=', len(set(pytests) - set(nosetests)))
- pprint(set(pytests) - set(nosetests))
- print('In nose, but not in pytest:',
- len(nosetests), '-', len(pytests),
- '=', len(set(nosetests) - set(pytests)))
- pprint(set(nosetests) - set(pytests))
- # pprint(pytests)
- # print(len(pytests))
Add Comment
Please, Sign In to add comment