コード例 #1
0
    def setup(self):
        self.temp_dir = mkdtemp(prefix='mubench-checkout-svn_')
        self.svn_url = Path(join(dirname(realpath(__file__)),
                                 "test_svn")).as_uri()
        self.checkouts_dir = join(self.temp_dir, "checkouts")

        self.uut = SVNProjectCheckout(self.svn_url, self.checkouts_dir,
                                      "-project-", "-version-", "1")
コード例 #2
0
    def test_multiple_versions(self):
        checkout_version2 = SVNProjectCheckout(self.uut.name, "other-version",
                                               self.svn_url, "1",
                                               self.checkouts_dir)

        self.uut.create(0)
        checkout_version2.create(0)

        assert checkout_version2.exists()
コード例 #3
0
 def get_checkout(self, base_path: str) -> ProjectCheckout:
     repository = self.__project.repository
     if repository.vcstype == "git":
         url = repository.url
         return GitProjectCheckout(url, base_path, self.__project.id, self.version_id, self.revision)
     elif repository.vcstype == "svn":
         url = repository.url
         return SVNProjectCheckout(url, base_path, self.__project.id, self.version_id, self.revision)
     elif repository.vcstype == "synthetic":
         return SyntheticProjectCheckout(base_path, self.__project.id, self.version_id)
     elif repository.vcstype == "zip":
         return ZipProjectCheckout(self.revision, self._yaml["md5"], base_path, self.__project.id, self.version_id)
     else:
         raise ValueError("unknown repository type: {}".format(repository.vcstype))
コード例 #4
0
class TestSVNProjectCheckout:
    # noinspection PyAttributeOutsideInit
    def setup(self):
        self.temp_dir = mkdtemp(prefix='mubench-checkout-svn_')
        self.svn_url = Path(join(dirname(realpath(__file__)),
                                 "test_svn")).as_uri()
        self.checkouts_dir = join(self.temp_dir, "checkouts")

        self.uut = SVNProjectCheckout(self.svn_url, self.checkouts_dir,
                                      "-project-", "-version-", "1")

    def teardown(self):
        remove_tree(self.temp_dir)

    def test_not_exists(self):
        assert not self.uut.exists()

    def test_create_checks_repo_out(self):
        self.uut.create()

        assert exists(
            join(self.checkouts_dir, "-project-", "-version-", "checkout"))

    def test_exists(self):
        self.uut.create()

        assert self.uut.exists()

    def test_not_exists_no_svn_checkout(self):
        os.makedirs(self.uut.checkout_dir)

        assert not self.uut.exists()

    def test_delete(self):
        self.uut.create()
        self.uut.delete()

        assert not exists(self.uut.checkout_dir)

    def test_multiple_versions(self):
        checkout_version2 = SVNProjectCheckout(self.svn_url,
                                               self.checkouts_dir,
                                               self.uut.name, "other-version",
                                               "1")

        self.uut.create()
        checkout_version2.create()

        assert checkout_version2.exists()

    def test_to_string(self):
        assert_equals("svn:{}@1".format(self.svn_url), str(self.uut))