def test_simple_noini(self, tmpdir): assert get_common_ancestor([tmpdir]) == tmpdir a = tmpdir.mkdir("a") assert get_common_ancestor([a, tmpdir]) == tmpdir assert get_common_ancestor([tmpdir, a]) == tmpdir with tmpdir.as_cwd(): assert get_common_ancestor([]) == tmpdir no_path = tmpdir.join('does-not-exist') assert get_common_ancestor([no_path]) == tmpdir assert get_common_ancestor([no_path.join('a')]) == tmpdir
def test_simple_noini(self, tmpdir): assert get_common_ancestor([tmpdir]) == tmpdir assert get_common_ancestor([tmpdir.mkdir("a"), tmpdir]) == tmpdir assert get_common_ancestor([tmpdir, tmpdir.join("a")]) == tmpdir with tmpdir.as_cwd(): assert get_common_ancestor([]) == tmpdir
from _pytest.config import get_common_ancestor, getcfg import sys 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