def test_blob_new(self): fwrite(pjoin(superp, "newblob"), "newblob!!!") # TODO g = Git(GitOpt(), cwd=superp) blobhash = g.blob_new("newblob") content = cmd0(origit, "cat-file", "-p", blobhash, cwd=superp) self.assertEqual("newblob!!!", content)
def setUp(self): self.maxDiff = None _clean_case() # .git can not be track in a git repo. # need to manually create it. fwrite(pjoin(this_base, "testdata", "super", ".git"), "gitdir: ../supergit")
def _fcontent(self, txt, *ps): self.assertTrue(os.path.isfile(pjoin(*ps)), pjoin(*ps) + " should exist") actual = fread(pjoin(*ps)) self.assertEqual(txt, actual, "check file content")
def _clean_case(): force_remove(pjoin(this_base, "testdata", "super", ".git")) cmdx(origit, "reset", "testdata", cwd=this_base) cmdx(origit, "checkout", "testdata", cwd=this_base) cmdx(origit, "clean", "-dxf", cwd=this_base)
from k3handy.cmd import cmd0 from k3handy.cmd import cmdf from k3handy.cmd import cmdx from k3handy.cmd import cmdout from k3handy import CalledProcessError from k3handy.path import pjoin dd = k3ut.dd this_base = os.path.dirname(__file__) origit = "git" superp = pjoin(this_base, "testdata", "super") supergitp = pjoin(this_base, "testdata", "supergit") wowgitp = pjoin(this_base, "testdata", "wowgit") branch_test_git_p = pjoin(this_base, "testdata", "branch_test_git") branch_test_worktree_p = pjoin(this_base, "testdata", "branch_test_worktree") class BaseTest(unittest.TestCase): def setUp(self): self.maxDiff = None _clean_case() # .git can not be track in a git repo. # need to manually create it. fwrite(pjoin(this_base, "testdata", "super", ".git"),