コード例 #1
0
ファイル: test_repo.py プロジェクト: CokieForever/RepoLite
    def test_repoStart_onDetached(self):
        self.runRepo(["start", "topic"])

        for sProjectFolder in self.dProjectFolders:
            with changeWorkingDir(sProjectFolder):
                assert git.getCurrentBranch() == "topic"
                assert git.getGitMessages() == [INITIAL_COMMIT_MSG]
コード例 #2
0
ファイル: test_repo.py プロジェクト: CokieForever/RepoLite
 def test_repoSync_checkout(self):
     for sProjectFolder in self.dProjectFolders:
         with changeWorkingDir(sProjectFolder):
             lBranches = git.getAllBranches()
             assert len(lBranches) == 1
             assert re.match(r"\(HEAD detached at .*\)", lBranches[0], re.IGNORECASE) is not None
             assert git.getCurrentBranch() == ""
             assert git.getGitMessages() == [INITIAL_COMMIT_MSG]
コード例 #3
0
ファイル: test_repo.py プロジェクト: CokieForever/RepoLite
    def test_repoDownload_detach(self):
        iChangeNumber, _ = self.repoDownloadTestSetup()

        self.runRepo(["download", "-d", next(iter(self.dProjectFolders.values())), "%d/1" % iChangeNumber])

        for iIdx, sProjectFolder in enumerate(self.dProjectFolders):
            with changeWorkingDir(sProjectFolder):
                if iIdx == 0:
                    assert git.getCurrentBranch() == ""
                    assert os.path.isfile("test_1.txt")
                    assert not os.path.isfile("test_2.txt")
                    assert git.getGitMessages() == ["Test commit (1)", INITIAL_COMMIT_MSG]
                else:
                    assert git.getCurrentBranch() == "topic_2"
                    assert not os.path.isfile("test_1.txt")
                    assert os.path.isfile("test_2.txt")
                    assert git.getGitMessages() == ["Test commit (2)", INITIAL_COMMIT_MSG]
コード例 #4
0
ファイル: test_repo.py プロジェクト: CokieForever/RepoLite
 def repoDownloadTestAssertResult(self, iPatch):
     for iIdx, sProjectFolder in enumerate(self.dProjectFolders):
         with changeWorkingDir(sProjectFolder):
             assert git.getCurrentBranch() == "topic_2"
             assert os.path.isfile("test_2.txt")
             if iIdx == 0:
                 assert os.path.isfile("test_1.txt")
                 if iPatch == 1:
                     assert git.getGitMessages() == ["Test commit (2)", "Test commit (1)", INITIAL_COMMIT_MSG]
                 elif iPatch == 2:
                     assert git.getGitMessages() == ["Test commit (2)", "Amended test commit (1)",
                                                     INITIAL_COMMIT_MSG]
                 else:
                     pytest.fail("iPatch parameter must be 1 or 2, received %d" % iPatch)
             else:
                 assert not os.path.isfile("test_1.txt")
                 assert git.getGitMessages() == ["Test commit (2)", INITIAL_COMMIT_MSG]
コード例 #5
0
ファイル: test_repo.py プロジェクト: CokieForever/RepoLite
    def test_repoStart_onOtherTopic(self):
        self.runRepo(["start", "topic_1"])
        self.createCommit()
        self.runRepo(["start", "topic_2"])

        for sProjectFolder in self.dProjectFolders:
            with changeWorkingDir(sProjectFolder):
                assert git.getCurrentBranch() == "topic_2"
                assert git.getGitMessages() == ["Test commit (1)", INITIAL_COMMIT_MSG]
                assert os.path.isfile("test_1.txt")
コード例 #6
0
ファイル: test_repo.py プロジェクト: CokieForever/RepoLite
    def test_repoSync_detach(self):
        self.runRepo(["start", "topic"])
        self.createCommit()

        self.runRepo(["sync", "-d"])

        for sProjectFolder in self.dProjectFolders:
            with changeWorkingDir(sProjectFolder):
                assert git.getCurrentBranch() == ""
                assert git.getGitMessages() == [INITIAL_COMMIT_MSG]
                assert not os.path.isfile("test_1.txt")
コード例 #7
0
ファイル: test_repo.py プロジェクト: CokieForever/RepoLite
    def test_repoDownload_rebase_wrongProject(self):
        iChangeNumber, _ = self.repoDownloadTestSetup()

        oProcess = self.runRepo(["download", "foobar", "%d/1" % iChangeNumber], check=False)
        assert oProcess.returncode != 0

        for iIdx, sProjectFolder in enumerate(self.dProjectFolders):
            with changeWorkingDir(sProjectFolder):
                assert git.getCurrentBranch() == "topic_2"
                assert os.path.isfile("test_2.txt")
                assert not os.path.isfile("test_1.txt")
                assert git.getGitMessages() == ["Test commit (2)", INITIAL_COMMIT_MSG]
コード例 #8
0
ファイル: test_repo.py プロジェクト: CokieForever/RepoLite
    def test_repoEnd_whenActive(self):
        self.runRepo(["start", "topic"])
        self.createCommit()

        self.runRepo(["end", "topic"])

        for sProjectFolder in self.dProjectFolders:
            with changeWorkingDir(sProjectFolder):
                lBranches = git.getAllBranches()
                assert len(lBranches) == 1
                assert re.match(r"\(HEAD detached at .*\)", lBranches[0], re.IGNORECASE) is not None
                assert git.getCurrentBranch() == ""
                assert git.getGitMessages() == [INITIAL_COMMIT_MSG]
                assert not os.path.isfile("test_1.txt")
コード例 #9
0
ファイル: test_repo.py プロジェクト: CokieForever/RepoLite
    def test_repoRebase_simple(self):
        self.runRepo(["start", "topic_2"])
        self.runRepo(["start", "topic_1"])
        self.createCommit(sId="1")
        self.runRepo(["switch", "topic_2"])
        self.createCommit(sId="2")

        self.runRepo(["rebase", "topic_1"])

        for iIdx, sProjectFolder in enumerate(self.dProjectFolders):
            with changeWorkingDir(sProjectFolder):
                assert git.getCurrentBranch() == "topic_2"
                assert os.path.isfile("test_1.txt")
                assert os.path.isfile("test_2.txt")
                assert git.getGitMessages() == ["Test commit (2)", "Test commit (1)", INITIAL_COMMIT_MSG]
コード例 #10
0
ファイル: test_repo.py プロジェクト: CokieForever/RepoLite
    def test_repoRebase_complex(self):
        self.runRepo(["start", "topic_1"])
        self.createCommit(sId="1")
        self.runRepo(["start", "topic_2"])
        self.createCommit(sId="2")
        self.runRepo(["switch", "topic_1"])
        self.createCommit(sId="1", bAmend=True)
        self.runRepo(["switch", "topic_2"])

        self.runRepo(["rebase", "topic_1"])

        for iIdx, sProjectFolder in enumerate(self.dProjectFolders):
            with changeWorkingDir(sProjectFolder):
                assert git.getCurrentBranch() == "topic_2"
                sFileName = "test_1.txt"
                assert os.path.isfile(sFileName)
                with open(sFileName, "r") as oFile:
                    assert oFile.read() == "This is an amended test (1)."
                assert os.path.isfile("test_2.txt")
                assert git.getGitMessages() == ["Test commit (2)", "Amended test commit (1)", INITIAL_COMMIT_MSG]