[issue4242] Classify language vs. impl-detail tests, step 1

Nick Coghlan report at bugs.python.org
Sat Nov 1 00:09:00 CET 2008


Nick Coghlan <ncoghlan at gmail.com> added the comment:

My idea above won't really support Armin's idea of being able to exclude
certain known-broken implementations. The check function would need to
be handled differently to support that use case:

# In test_support.py
vm = platform.python_implementation().lower()
reference_vm = "cpython"

def check_impl_detail(implemented=(reference_vm,), broken=()):
  # Skip known broken implementations
  if broken:
    broken = [vm.lower() for vm in broken]
    if vm in broken:
      return False
  # Only check named implementations
  if implemented:
    implemented = [vm.lower() for vm in implemented]
    return vm in implemented
  # No specific implementations named, so expect it to
  # work on implementations that are not known to be broken
  return True
  
def impl_detail(implemented=(reference_vm,), broken=(), msg=''):
  if check_impl_detail(implemented, broken):
    # Test the implementation detail
  else:
    # Skip this test (incude 'msg' in the skip message)

It would be pretty easy to build cpython_only, jython_only, pypy_only
etc checks and decorators on top of that kind of infrastructure.

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue4242>
_______________________________________


More information about the Python-bugs-list mailing list