class TestGitWorkingCopy(unittest.TestCase, BaseTestWorkingCopy): def setUp(self): self.repository_path = os.path.join(example_repositories, "git") os.symlink("%s/git" % self.repository_path, "%s/.git" % self.repository_path) self.repos = GitRepository(self.repository_path) self.tmpdir = tempfile.mkdtemp() self.repos.checkout(self.tmpdir) self.wc = GitWorkingCopy(self.tmpdir) self.latest_version = "38598c93c7036a1c44bbb6075517243edfa88860" self.previous_version = "3491ce1d9a66abc9d49d5844ee05167c6a854ad9" def tearDown(self): os.unlink("%s/.git" % self.repository_path) shutil.rmtree(self.tmpdir) def test__script_content(self): self.assertEqual(self.wc.content(self.latest_version, 'wrong.py'), 'File content not found.') path_to_project = os.path.join(this_directory, os.pardir, "example_projects", "python") for filename in ['default.param', 'romans.param']: with open(os.path.join(path_to_project, filename), 'r') as f: lines = f.readlines() self.assertEqual( self.wc.content(self.latest_version, filename), ''.join(lines)[:-1])
def setUp(self): self.repository_path = os.path.join(example_repositories, "git") os.symlink("%s/git" % self.repository_path, "%s/.git" % self.repository_path) self.repos = GitRepository(self.repository_path) self.tmpdir = tempfile.mkdtemp() self.repos.checkout(self.tmpdir) self.wc = GitWorkingCopy(self.tmpdir) self.latest_version = "38598c93c7036a1c44bbb6075517243edfa88860" self.previous_version = "3491ce1d9a66abc9d49d5844ee05167c6a854ad9"
class TestGitWorkingCopy(unittest.TestCase, BaseTestWorkingCopy): def setUp(self): self.repository_path = os.path.join(example_repositories, "git") os.symlink("%s/git" % self.repository_path, "%s/.git" % self.repository_path) self.repos = GitRepository(self.repository_path) self.tmpdir = tempfile.mkdtemp() self.repos.checkout(self.tmpdir) self.wc = GitWorkingCopy(self.tmpdir) self.latest_version = "38598c93c7036a1c44bbb6075517243edfa88860" self.previous_version = "3491ce1d9a66abc9d49d5844ee05167c6a854ad9" def tearDown(self): os.unlink("%s/.git" % self.repository_path) shutil.rmtree(self.tmpdir)
class TestGitWorkingCopy(unittest.TestCase, BaseTestWorkingCopy): def setUp(self): self.repository_path = os.path.abspath("../example_repositories/git") os.symlink("%s/git" % self.repository_path, "%s/.git" % self.repository_path) self.repos = GitRepository(self.repository_path) self.tmpdir = tempfile.mkdtemp() self.repos.checkout(self.tmpdir) self.wc = GitWorkingCopy(self.tmpdir) self.latest_version = "38598c93c7036a1c44bbb6075517243edfa88860" self.previous_version = "3491ce1d9a66abc9d49d5844ee05167c6a854ad9" def tearDown(self): os.unlink("%s/.git" % self.repository_path) shutil.rmtree(self.tmpdir)
def setUp(self): self.repository_path = os.path.abspath("../example_repositories/git") os.symlink("%s/git" % self.repository_path, "%s/.git" % self.repository_path) self.repos = GitRepository(self.repository_path) self.tmpdir = tempfile.mkdtemp() self.repos.checkout(self.tmpdir) self.wc = GitWorkingCopy(self.tmpdir) self.latest_version = "38598c93c7036a1c44bbb6075517243edfa88860" self.previous_version = "3491ce1d9a66abc9d49d5844ee05167c6a854ad9"
class TestGitWorkingCopy(unittest.TestCase, BaseTestWorkingCopy): def setUp(self): self.repository_path = os.path.join(example_repositories, "git") os.symlink("%s/git" % self.repository_path, "%s/.git" % self.repository_path) self.repos = GitRepository(self.repository_path) self.tmpdir = tempfile.mkdtemp() self.repos.checkout(self.tmpdir) self.wc = GitWorkingCopy(self.tmpdir) self.latest_version = "38598c93c7036a1c44bbb6075517243edfa88860" self.previous_version = "3491ce1d9a66abc9d49d5844ee05167c6a854ad9" def tearDown(self): os.unlink("%s/.git" % self.repository_path) shutil.rmtree(self.tmpdir) def test__script_content(self): self.assertEqual(self.wc.content(self.latest_version, 'wrong.py'), 'File content not found.') path_to_project = os.path.join(this_directory, os.pardir, "example_projects", "python") for filename in ['default.param','romans.param']: with open(os.path.join(path_to_project, filename), 'r') as f: lines = f.readlines() self.assertEqual(self.wc.content(self.latest_version, filename), ''.join(lines))
def test__exists__with_nonexistent_repos__should_return_False(self): repos = GitRepository("/tmp/") self.assertFalse(repos.exists)
def _create_repository(self): return GitRepository(self.repository_path)
from __future__ import unicode_literals from builtins import range from sumatra.projects import Project from sumatra.records import Record from sumatra.recordstore import django_store from sumatra.programs import PythonExecutable from sumatra.launch import SerialLaunchMode from sumatra.datastore import FileSystemDataStore from sumatra.parameters import SimpleParameterSet from sumatra.versioncontrol._git import GitRepository import random serial = SerialLaunchMode() executable = PythonExecutable("/usr/bin/python", version="2.7") repos = GitRepository('.') datastore = FileSystemDataStore("/path/to/datastore") project = Project("test_project", default_executable=executable, default_repository=repos, default_launch_mode=serial, data_store=datastore, record_store=django_store.DjangoRecordStore()) parameters = SimpleParameterSet({'a': 2, 'b': 3}) for i in range(50): record = Record(executable=executable, repository=repos, main_file="main.py", version="99863a9dc5f", launch_mode=serial, datastore=datastore,