Ejemplo n.º 1
0
    def setUp(self):
        # XXX split this out into the setup decorator?
        self.testdir = tempfile.mkdtemp()
        self.repodir = join(self.testdir, "repodir")
        Sandbox.create(self.repodir, True)

        self.revs = []

        sandbox = Sandbox(self.repodir, ctx="tip")
        self.path = dirname(__file__)
        self.filelist = ["file1", "file2", "file3"]
        self.nested_name = "nested/deep/dir/file"
        self.nested_file = "This is\n\na deeply nested file\n"
        self.files = [open(join(self.path, i)).read() for i in self.filelist]
        self.msg = "added some files"
        self.user = "******"

        self.date = str(datetime.date.today())

        sandbox.add_file_content("file1", self.files[0])
        sandbox.add_file_content("file2", self.files[0])
        sandbox.commit("added1", "user1 <*****@*****.**>")
        self.revs.append(Storage(self.repodir, ctx="tip").rev)

        sandbox.add_file_content("file1", self.files[1])
        sandbox.commit("added2", "user2 <*****@*****.**>")
        self.revs.append(Storage(self.repodir, ctx="tip").rev)

        sandbox.add_file_content("file2", self.files[1])
        sandbox.add_file_content("file3", self.files[0])
        sandbox.commit("added3", "user3 <*****@*****.**>")
        self.revs.append(Storage(self.repodir, ctx="tip").rev)

        sandbox.add_file_content(self.nested_name, self.nested_file)
        sandbox.commit("added4", "user3 <*****@*****.**>")
        self.revs.append(Storage(self.repodir, ctx="tip").rev)

        self.fulllist = self.filelist + [self.nested_name]

        self.repo = Storage(self.repodir, ctx="tip")
        self.rev = self.repo.rev

        clearZCML()
        xmlconfig(open(join(pmr2.mercurial.__path__[0], "utility.zcml")))

        # register custom utility that would have normally been done.
        sm = getSiteManager()
        sm.registerUtility(MercurialSettings(), IPMR2GlobalSettings)
        self.settings = zope.component.getUtility(IPMR2GlobalSettings)
        self.workspace = DummyWorkspace(self.repodir)

        util.extract_archive(self.testdir)
        self.pmr2hgtest = DummyWorkspace(join(self.testdir, "pmr2hgtest"))
        self.import1 = DummyWorkspace(join(self.testdir, "import1"))
        self.import2 = DummyWorkspace(join(self.testdir, "import2"))

        self.simple1 = DummyWorkspace(join(self.testdir, "simple1"))
        self.simple2 = DummyWorkspace(join(self.testdir, "simple2"))
        self.simple3 = DummyWorkspace(join(self.testdir, "simple3"))
Ejemplo n.º 2
0
    def setUpPloneSite(self, portal):
        import pmr2.mercurial.tests
        from pmr2.app.settings.interfaces import IPMR2GlobalSettings
        from pmr2.app.workspace.content import Workspace
        from pmr2.mercurial.tests import util

        settings = zope.component.getUtility(IPMR2GlobalSettings)

        p = settings.createDir(portal.workspace)
        sources = join(dirname(__file__), 'hgcellmldemo.tgz')
        util.extract_archive(p, sources)

        def mkhg_workspace(name):
            w = Workspace(name)
            w.storage = u'mercurial'
            portal.workspace[name] = w

        mkhg_workspace('hg_buckettap')
        mkhg_workspace('hg_btdemo')
Ejemplo n.º 3
0
    def setUp(self):
        # create real Hg repos, to be called only after workspace is
        # created and model root path is assigned
        super(MercurialDocTestCase, self).setUp()

        import pmr2.mercurial.tests
        from pmr2.app.workspace.content import Workspace
        from pmr2.mercurial.tests import util

        p = self.pmr2.createDir(self.portal.workspace)
        util.extract_archive(p)

        p2a_test = join(dirname(pmr2.testing.__file__), 'pmr2.app.testdata.tgz')
        util.extract_archive(p, p2a_test)

        self.pmr2hgtest_revs = util.ARCHIVE_REVS
        self.rdfmodel_revs = [
            'b94d1701154be42acf63ee6b4bd4a99d09ba043c',
            '2647d4389da6345c26d168bbb831f6512322d4f9',
            '006f11cd9211abd2a879df0f6c7f27b9844a8ff2',
        ]

        def mkhg_workspace(name):
            # XXX temporary method to work with existing tests until
            # this is replaced
            w = Workspace(name)
            w.storage = u'mercurial'
            w.title = u''
            w.description = u''
            self.portal.workspace[name] = w

        mkhg_workspace('import1')
        mkhg_workspace('import2')
        mkhg_workspace('pmr2hgtest')
        mkhg_workspace('rdfmodel')
        mkhg_workspace('simple1')
        mkhg_workspace('simple2')
        mkhg_workspace('simple3')
Ejemplo n.º 4
0
    def setUpPloneSite(self, portal):
        import pmr2.mercurial.tests
        from pmr2.app.workspace.content import Workspace
        from pmr2.mercurial.tests import util

        settings = zope.component.getUtility(IPMR2GlobalSettings)

        p = settings.createDir(portal.workspace)
        util.extract_archive(p)

        def mkhg_workspace(name):
            w = Workspace(name)
            w.storage = u'mercurial'
            w.title = u''
            w.description = u''
            portal.workspace[name] = w

        mkhg_workspace('import1')
        mkhg_workspace('import2')
        mkhg_workspace('pmr2hgtest')
        mkhg_workspace('simple1')
        mkhg_workspace('simple2')
        mkhg_workspace('simple3')