Exemplo n.º 1
0
def pytest_configure(config):
    coverage_stack = None

    plugin = None

    testmon_config = TestmonConfig()
    message, should_collect, should_select = testmon_config.header_collect_select(
        config, coverage_stack, cov_plugin=plugin)
    config.testmon_config = (message, should_collect, should_select)
    if should_select or should_collect:
        config.option.continue_on_collection_errors = True

        try:
            init_testmon_data(config)

            if should_select:
                config.pluginmanager.register(
                    TestmonSelect(config, config.testmon_data),
                    "TestmonSelect")

            if should_collect:
                config.pluginmanager.register(
                    TestmonCollect(
                        Testmon(
                            config.rootdir.strpath,
                            testmon_labels=testmon_options(config),
                            cov_plugin=plugin,
                        ),
                        config.testmon_data,
                    ),
                    "TestmonCollect",
                )
        except TestmonException as e:
            pytest.exit(str(e))
Exemplo n.º 2
0
 def __init__(self, config, testmon_data):
     self.testmon_data = testmon_data
     self.testmon = Testmon(config.project_dirs,
                            testmon_labels=testmon_options(config))
     self.collection_ignored = set()
     self.testmon_save = True
     self.config = config
Exemplo n.º 3
0
 def __init__(self, config, testmon_data):
     self.testmon_data = testmon_data
     self.testmon = Testmon(config.project_dirs,
                            testmon_labels=testmon_options(config))
     self.testmon_save = True
     self.config = config
     self.lastfailed = self.testmon_data.lastfailed
Exemplo n.º 4
0
def pytest_configure(config):
    coverage_stack = None

    testmon_config = TestmonConfig()
    message, should_collect, should_select = testmon_config.header_collect_select(
        config, coverage_stack
    )
    config.testmon_config = (message, should_collect, should_select)
    if should_select or should_collect:
        config.option.continue_on_collection_errors = True
        init_testmon_data(config)

        if should_select:
            config.pluginmanager.register(
                TestmonSelect(config, config.testmon_data), "TestmonSelect"
            )

        if should_collect:
            config.pluginmanager.register(
                TestmonCollect(
                    Testmon(
                        config.project_dirs, testmon_labels=testmon_options(config)
                    ),
                    config.testmon_data,
                ),
                "TestmonCollect",
            )
Exemplo n.º 5
0
    def __init__(self, config, testmon_data):
        self.testmon_data = testmon_data
        self.testmon = Testmon(config.project_dirs, testmon_labels=testmon_options(config))

        self.collection_ignored = set()
        self.testmon_save = True
        self.config = config
        self.reports = defaultdict(lambda: {})
        self.selected, self.deselected = [], set()
        self.file_data = self.testmon_data.file_data()
        self.f_to_ignore = self.testmon_data.stable_files
        if self.config.getoption('tlf'):
            self.f_to_ignore -= self.testmon_data.f_last_failed
Exemplo n.º 6
0
def register_plugins(config, should_select, should_collect, cov_plugin):
    if should_select:
        config.pluginmanager.register(
            TestmonSelect(config, config.testmon_data), "TestmonSelect")

    if should_collect:
        config.pluginmanager.register(
            TestmonCollect(
                Testmon(
                    config.rootdir.strpath,
                    testmon_labels=testmon_options(config),
                    cov_plugin=cov_plugin,
                ),
                config.testmon_data,
            ),
            "TestmonCollect",
        )
Exemplo n.º 7
0
from testmon.testmon_core import get_variant_inifile, Testmon


ancestor = get_common_ancestor(sys.argv[1:])
rootdir, inifile, inicfg = getcfg(
    [ancestor], ["pytest.ini", "tox.ini", "setup.cfg"])
if rootdir is None:
    for rootdir in ancestor.parts(reverse=True):
        if rootdir.join("setup.py").exists():
            break
    else:
        rootdir = ancestor

variant = get_variant_inifile(inifile)

testmon = Testmon([str(rootdir)], variant=variant )
testmon.read_fs()


node_files = testmon.file_data().keys()

changed_files = []
for node_file in node_files:
    if testmon.old_mtimes.get(node_file) != testmon.mtimes.get(node_file):
        changed_files.append(node_file)
print "Changed files:%s " % changed_files

print rootdir, inifile, inicfg