Changeset f6fd413 in sasmodels


Ignore:
Timestamp:
Feb 7, 2018 10:41:04 AM (6 years ago)
Author:
Paul Kienzle <pkienzle@…>
Branches:
master, core_shell_microgels, magnetic_model, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
Children:
c11d09f
Parents:
b4272a2
Message:

pytest: is_generator is not part of public api, so reimplement it in conftest

File:
1 edited

Legend:

Unmodified
Added
Removed
  • conftest.py

    rb3af1c2 rf6fd413  
    1717 
    1818import os.path 
     19import inspect 
    1920 
    2021import pytest 
    2122from _pytest.unittest import TestCaseFunction 
    22 from _pytest.compat import is_generator 
    2323 
    2424def pytest_pycollect_makeitem(collector, name, obj): 
     
    5555            tests.append(test) 
    5656        return tests 
     57 
     58def is_generator(func): 
     59    """ 
     60    Returns True if function has yield. 
     61    """ 
     62    # Cribbed from _pytest.compat is_generator and iscoroutinefunction; these 
     63    # may not be available as part of pytest 4. 
     64    coroutine = (getattr(func, '_is_coroutine', False) or 
     65                 getattr(inspect, 'iscoroutinefunction', lambda f: False)(func)) 
     66    generator = inspect.isgeneratorfunction(func) 
     67    return generator and not coroutine 
    5768 
    5869def split_yielded_test(obj, number): 
Note: See TracChangeset for help on using the changeset viewer.