def get_marker_transaction(test): marker = test.get_closest_marker('django_db') if marker: validate_django_db(marker) return marker.kwargs['transaction'] return None
def get_marker_transaction(test): marker = test.get_closest_marker("django_db") if marker: validate_django_db(marker) return marker.kwargs["transaction"] return None
def get_marker_transaction(test): marker = test.get_marker('django_db') if marker: validate_django_db(marker) # As of pytest 3.6.1 or maybe 3.6 'transaction' is not longer a property of # the MarkInfo at this execution point anyway, so if we are in that context # then fallback to checking the kwargs for the presence of a transaction test case. return getattr(marker, 'transaction', 'transaction' in marker.kwargs) return None
def get_marker_transaction(test): try: marker = test.get_closest_marker('django_db') except AttributeError: # pytest < 3.6.0 marker = test.get_marker('django_db') if marker: validate_django_db(marker) try: return marker.kwargs.get('transaction') except AttributeError: # pytest-django < 3.3.0 return marker.transaction return None