Exemple #1
0
def setup_workdir_and_listfile():
    logging.getLogger().setLevel(logging.WARN)  # suppress log messages

    workdir = setup_workdir()
    listfile = dump_filelist(workdir)

    return (workdir, listfile)
Exemple #2
0
def setup(extra_args=[]):
    workdir = C.setup_workdir()
    tmpldir = os.path.join(C.TOPDIR, "templates")

    arguments = ["-w", workdir, "-P", tmpldir] + extra_args
    #logging.getLogger().setLevel(logging.WARN) # suppress log messages

    return (workdir, arguments)
Exemple #3
0
 def setUp(self):
     self.workdir = C.setup_workdir()
     path = dump_conf(self.workdir, YAML_CONFIG_CONTENT, ".yml")
     self.paths = [path]
     self.config = B.Bunch(
         defaults=B.Bunch(a="aaa", b="bbb"),
         profile0=B.Bunch(a="xxx", b="yyy"),
         array0=[1, 2, 3],
     )
Exemple #4
0
 def setUp(self):
     self.workdir = C.setup_workdir()
     path = dump_conf(self.workdir, INI_CONFIG_CONTENT)
     self.paths = [path]
     self.config = B.Bunch(
         a="aaa",
         b="bbb",
         profile0=B.Bunch(a="xxx", b="yyy", c=[1, 2, 3]),
     )
    def setUp(self):
        self.workdir = C.setup_workdir()

        self.file = os.path.join(self.workdir, "file.txt")
        open(self.file, "w").write("This is a file")

        self.dir = os.path.join(self.workdir, "dir")
        os.makedirs(self.dir)

        self.symlink = os.path.join(self.workdir, "test.symlink")
        os.symlink(self.file, self.symlink)
Exemple #6
0
    def setUp(self):
        self.linkto = None

        for p in ("/etc/hosts", "/etc/resolv.conf", "/etc/bashrc"):
            if os.path.exists(p):
                self.linkto = p
                break

        assert self.linkto is not None, \
            "No any paths for testing exist! Aborting..."

        self.workdir = setup_workdir()

        self.path = os.path.join(self.workdir, "test.symlink")
        os.symlink(self.linkto, self.path)
    def setUp(self):
        self.workdir = C.setup_workdir()

        self.file = os.path.join(self.workdir, "file.txt")
        open(self.file, "w").write("This is a file")

        self.file_mode = "0640"
        os.chmod(self.file, modestr_to_mode(self.file_mode))

        self.dir = os.path.join(self.workdir, "dir")
        os.makedirs(self.dir)

        self.dir_mode = "0750"
        os.chmod(self.dir, modestr_to_mode(self.dir_mode))

        self.symlink = os.path.join(self.workdir, "test.symlink")
        os.symlink(self.file, self.symlink)

        self.missinglink = os.path.join(self.workdir, "test.missinglink")
        os.symlink("/non-existent-file", self.missinglink)
Exemple #8
0
 def setUp(self):
     self.workdir = setup_workdir()
     (_, self.f) = tempfile.mkstemp(dir=self.workdir)
     open(self.f, "w").write(str(random.random()))
Exemple #9
0
 def setUp(self):
     self.workdir = setup_workdir()
Exemple #10
0
    def setUp(self):
        self.workdir = setup_workdir()
        self.template = os.path.join(self.workdir, "a.tmpl")

        open(self.template, "w").write("$a\n")
 def setUp(self):
     self.workdir = C.setup_workdir()
     self.path = os.path.join(self.workdir, "obj_not_exist")
 def setUp(self):
     self.workdir = setup_workdir()
     self.testfile1 = os.path.join(self.workdir, "test1.txt")
     open(self.testfile1, "w").write("test1\n")