示例#1
0
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]>'
示例#2
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)
示例#3
0
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