def test_merged_profiles_get_coveragepy_data(): from covimerage import MergedProfiles m = MergedProfiles([]) cov_data = m.get_coveragepy_data() assert isinstance(cov_data, coverage.CoverageData) assert repr( cov_data) == '<CoverageData lines={0} arcs=None tracers={0} runs=[0]>'
def test_merged_profiles_get_coveragepy_data(): from covimerage import MergedProfiles m = MergedProfiles([]) cov_data = m.get_coveragepy_data() try: from coverage.data import CoverageJsonData except ImportError: assert isinstance(cov_data, coverage.CoverageData) else: assert isinstance(cov_data, CoverageJsonData)
def test_mergedprofiles_caches_coveragepy_data(mocker): from covimerage import MergedProfiles, Profile m = MergedProfiles([]) spy = mocker.spy(m, '_get_coveragepy_data') m.get_coveragepy_data() assert spy.call_count == 1 m.get_coveragepy_data() assert spy.call_count == 1 m.profiles += [Profile('foo')] m.get_coveragepy_data() assert spy.call_count == 2 m.profiles = [Profile('bar')] m.get_coveragepy_data() assert spy.call_count == 3