def test_getcfg_and_config(self, testdir, tmpdir, section, filename): sub = tmpdir.mkdir("sub") sub.chdir() tmpdir.join(filename).write(_pytest._code.Source(""" [{section}] name = value """.format(section=section))) rootdir, inifile, cfg = getcfg([sub]) assert cfg['name'] == "value" config = testdir.parseconfigure(sub) assert config.inicfg['name'] == 'value'
def test_getcfg_and_config(self, testdir, tmpdir): sub = tmpdir.mkdir("sub") sub.chdir() tmpdir.join("setup.cfg").write(py.code.Source(""" [pytest] name = value """)) rootdir, inifile, cfg = getcfg([sub], ["setup.cfg"]) assert cfg['name'] == "value" config = testdir.parseconfigure(sub) assert config.inicfg['name'] == 'value'
def test_getcfg_and_config(self, testdir, tmpdir): sub = tmpdir.mkdir("sub") sub.chdir() tmpdir.join("setup.cfg").write( py.code.Source(""" [pytest] name = value """)) rootdir, inifile, cfg = getcfg([sub], ["setup.cfg"]) assert cfg['name'] == "value" config = testdir.parseconfigure(sub) assert config.inicfg['name'] == 'value'
def test_getcfg_and_config(self, testdir, tmpdir, section, filename): sub = tmpdir.mkdir("sub") sub.chdir() tmpdir.join(filename).write( _pytest._code.Source(""" [{section}] name = value """.format(section=section))) rootdir, inifile, cfg = getcfg([sub]) assert cfg['name'] == "value" config = testdir.parseconfigure(sub) assert config.inicfg['name'] == 'value'
def test_getcfg_empty_path(self, tmpdir): getcfg([''], ['setup.cfg']) #happens on py.test ""
def test_getcfg_empty_path(self): """correctly handle zero length arguments (a la pytest '')""" getcfg([''])
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
def test_getcfg_empty_path(self, tmpdir): getcfg([""], ["setup.cfg"]) # happens on py.test ""