def get_optional_versions(): ''' Returns versions of optional modules. ''' result = [] name = 'pytz' url = 'https://pypi.python.org/pypi/pytz/' mod = get_version_module('pytz', name, url, True) if mod is not None: result.append(( name, url, mod.__version__, None, )) name = 'pyuca' url = 'https://github.com/jtauber/pyuca' mod = get_version_module('pyuca', name, url, True) if mod is not None: result.append(( name, url, 'N/A', None, )) name = 'python-bidi' url = 'https://github.com/MeirKriheli/python-bidi' mod = get_version_module('bidi', name, url, True) if mod is not None: result.append(( name, url, mod.VERSION, None, )) name = 'pyLibravatar' url = 'https://pypi.python.org/pypi/pyLibravatar' mod = get_version_module('libravatar', name, url, True) if mod is not None: result.append(( name, url, 'N/A', None, )) if HgRepository.is_supported(): result.append(( 'Mercurial', 'http://mercurial.selenic.com/', HgRepository.get_version(), '2.8', )) return result
def get_optional_versions(): ''' Returns versions of optional modules. ''' result = [] get_optional_module(result, 'pytz', 'pytz', 'https://pypi.python.org/pypi/pytz/') get_optional_module(result, 'pyuca', 'pyuca', 'https://github.com/jtauber/pyuca', None) get_optional_module(result, 'bidi', 'python-bidi', 'https://github.com/MeirKriheli/python-bidi', 'VERSION') get_optional_module(result, 'libravatar', 'pyLibravatar', 'https://pypi.python.org/pypi/pyLibravatar', None) get_optional_module(result, 'yaml', 'PyYAML', 'http://pyyaml.org/wiki/PyYAML') get_optional_module(result, 'tesserocr', 'tesserocr', 'https://github.com/sirfz/tesserocr') if HgRepository.is_supported(): result.append(( 'Mercurial', 'https://www.mercurial-scm.org/', HgRepository.get_version(), '2.8', )) if SubversionRepository.is_supported(): result.append(( 'git-svn', 'https://git-scm.com/docs/git-svn', SubversionRepository.get_version(), '1.6', )) if GitWithGerritRepository.is_supported(): result.append(( 'git-review', 'https://pypi.python.org/pypi/git-review', GitWithGerritRepository.get_version(), '1.0', )) if GithubRepository.is_supported(): result.append(( 'hub', 'https://hub.github.com/', GithubRepository.get_version(), '1.0', )) return result
def setUp(self): # Path where to clone remote repo for tests self.git_base_repo_path = os.path.join( settings.DATA_DIR, 'test-base-repo.git' ) # Repository on which tests will be performed self.git_repo_path = os.path.join( settings.DATA_DIR, 'test-repo.git' ) # Path where to clone remote repo for tests self.hg_base_repo_path = os.path.join( settings.DATA_DIR, 'test-base-repo.hg' ) # Repository on which tests will be performed self.hg_repo_path = os.path.join( settings.DATA_DIR, 'test-repo.hg' ) # Clone repo for testing if not os.path.exists(self.git_base_repo_path): GitRepository.clone( GIT_URL, self.git_base_repo_path, bare=True ) # Remove possibly existing directory if os.path.exists(self.git_repo_path): shutil.rmtree(self.git_repo_path) # Create repository copy for the test shutil.copytree(self.git_base_repo_path, self.git_repo_path) # Clone repo for testing if not os.path.exists(self.hg_base_repo_path): HgRepository.clone( HG_URL, self.hg_base_repo_path, bare=True ) # Remove possibly existing directory if os.path.exists(self.hg_repo_path): shutil.rmtree(self.hg_repo_path) # Create repository copy for the test shutil.copytree(self.hg_base_repo_path, self.hg_repo_path) # Remove possibly existing project directory test_repo_path = os.path.join(settings.DATA_DIR, 'vcs', 'test') if os.path.exists(test_repo_path): shutil.rmtree(test_repo_path)
def _create_subproject(self, file_format, mask, template='', new_base='', vcs='git', **kwargs): """ Creates real test subproject. """ project = self.create_project() if vcs == 'mercurial': branch = 'default' repo = self.hg_repo_path push = self.hg_repo_path if not HgRepository.is_supported(): raise SkipTest('Mercurial not available!') else: branch = 'master' repo = self.git_repo_path push = self.git_repo_path return SubProject.objects.create( name='Test', slug='test', project=project, repo=repo, push=push, branch=branch, filemask=mask, template=template, file_format=file_format, repoweb=REPOWEB_URL, save_history=True, new_base=new_base, vcs=vcs, **kwargs )
def setUp(self): super(MultiRepoTest, self).setUp() if self._vcs == 'git': repo = self.git_repo_path push = self.git_repo_path elif self._vcs == 'subversion': if not SubversionRepository.is_supported(): raise SkipTest('Subversion not available!') repo = 'file://' + self.svn_repo_path push = 'file://' + self.svn_repo_path else: if not HgRepository.is_supported(): raise SkipTest('Mercurial not available!') repo = self.hg_repo_path push = self.hg_repo_path self.subproject2 = SubProject.objects.create( name='Test 2', slug='test-2', project=self.project, repo=repo, push=push, vcs=self._vcs, filemask=self._filemask, template='', file_format='po', repoweb=REPOWEB_URL, new_base='', branch=self._branch, ) self.request = self.get_request('/')
def setUp(self): super(MultiRepoTest, self).setUp() if self._vcs == 'git': repo = self.git_repo_path push = self.git_repo_path elif self._vcs == 'subversion': if not SubversionRepository.is_supported(): raise SkipTest('Subversion not available!') repo = 'file://' + self.svn_repo_path push = 'file://' + self.svn_repo_path else: if not HgRepository.is_supported(): raise SkipTest('Mercurial not available!') repo = self.hg_repo_path push = self.hg_repo_path self.subproject2 = SubProject.objects.create( name='Test 2', slug='test-2', project=self.project, repo=repo, push=push, vcs=self._vcs, filemask='po/*.po', template='', file_format='po', repoweb=REPOWEB_URL, new_base='', ) self.request = self.get_request('/')
def setUp(self): # Path where to clone remote repo for tests self.git_base_repo_path = os.path.join(settings.DATA_DIR, 'test-base-repo.git') # Repository on which tests will be performed self.git_repo_path = os.path.join(settings.DATA_DIR, 'test-repo.git') # Path where to clone remote repo for tests self.hg_base_repo_path = os.path.join(settings.DATA_DIR, 'test-base-repo.hg') # Repository on which tests will be performed self.hg_repo_path = os.path.join(settings.DATA_DIR, 'test-repo.hg') # Clone repo for testing if not os.path.exists(self.git_base_repo_path): print('Cloning Git test repository to {0}...'.format( self.git_base_repo_path)) GitRepository.clone(GIT_URL, self.git_base_repo_path, bare=True) # Remove possibly existing directory if os.path.exists(self.git_repo_path): shutil.rmtree(self.git_repo_path) # Create repository copy for the test shutil.copytree(self.git_base_repo_path, self.git_repo_path) if HgRepository.is_supported(): # Clone repo for testing if not os.path.exists(self.hg_base_repo_path): print('Cloning Mercurial test repository to {0}...'.format( self.hg_base_repo_path)) HgRepository.clone(HG_URL, self.hg_base_repo_path, bare=True) # Remove possibly existing directory if os.path.exists(self.hg_repo_path): shutil.rmtree(self.hg_repo_path) # Create repository copy for the test shutil.copytree(self.hg_base_repo_path, self.hg_repo_path) # Remove possibly existing project directory test_repo_path = os.path.join(settings.DATA_DIR, 'vcs', 'test') if os.path.exists(test_repo_path): shutil.rmtree(test_repo_path) # Remove indexes clean_indexes()
def setUp(self): if 'test-repos' in settings.GIT_ROOT: test_dir = os.path.join(settings.GIT_ROOT, 'test') if os.path.exists(test_dir): shutil.rmtree(test_dir) # Path where to clone remote repo for tests self.git_base_repo_path = os.path.join(settings.GIT_ROOT, 'test-base-repo.git') # Repository on which tests will be performed self.git_repo_path = os.path.join(settings.GIT_ROOT, 'test-repo.git') # Path where to clone remote repo for tests self.hg_base_repo_path = os.path.join(settings.GIT_ROOT, 'test-base-repo.hg') # Repository on which tests will be performed self.hg_repo_path = os.path.join(settings.GIT_ROOT, 'test-repo.hg') # Clone repo for testing if not os.path.exists(self.git_base_repo_path): GitRepository.clone(GIT_URL, self.git_base_repo_path, bare=True) # Remove possibly existing directory if os.path.exists(self.git_repo_path): shutil.rmtree(self.git_repo_path) # Create repository copy for the test shutil.copytree(self.git_base_repo_path, self.git_repo_path) # Clone repo for testing if not os.path.exists(self.hg_base_repo_path): HgRepository.clone(HG_URL, self.hg_base_repo_path, bare=True) # Remove possibly existing directory if os.path.exists(self.hg_repo_path): shutil.rmtree(self.hg_repo_path) # Create repository copy for the test shutil.copytree(self.hg_base_repo_path, self.hg_repo_path) # Remove possibly existing project directory test_repo_path = os.path.join(settings.GIT_ROOT, 'test') if os.path.exists(test_repo_path): shutil.rmtree(test_repo_path)
def setUp(self): # Path where to clone remote repo for tests self.git_base_repo_path = os.path.join(settings.DATA_DIR, "test-base-repo.git") # Repository on which tests will be performed self.git_repo_path = os.path.join(settings.DATA_DIR, "test-repo.git") # Path where to clone remote repo for tests self.hg_base_repo_path = os.path.join(settings.DATA_DIR, "test-base-repo.hg") # Repository on which tests will be performed self.hg_repo_path = os.path.join(settings.DATA_DIR, "test-repo.hg") # Clone repo for testing if not os.path.exists(self.git_base_repo_path): print("Cloning Git test repository to {0}...".format(self.git_base_repo_path)) GitRepository.clone(GIT_URL, self.git_base_repo_path, bare=True) # Remove possibly existing directory if os.path.exists(self.git_repo_path): shutil.rmtree(self.git_repo_path) # Create repository copy for the test shutil.copytree(self.git_base_repo_path, self.git_repo_path) # Clone repo for testing if not os.path.exists(self.hg_base_repo_path): print("Cloning Mercurial test repository to {0}...".format(self.hg_base_repo_path)) HgRepository.clone(HG_URL, self.hg_base_repo_path, bare=True) # Remove possibly existing directory if os.path.exists(self.hg_repo_path): shutil.rmtree(self.hg_repo_path) # Create repository copy for the test shutil.copytree(self.hg_base_repo_path, self.hg_repo_path) # Remove possibly existing project directory test_repo_path = os.path.join(settings.DATA_DIR, "vcs", "test") if os.path.exists(test_repo_path): shutil.rmtree(test_repo_path) # Remove indexes clean_indexes()
def _create_subproject(self, file_format, mask, template='', new_base='', vcs='git', branch=None, **kwargs): """Create real test subproject.""" if file_format not in FILE_FORMATS: raise SkipTest( 'File format {0} is not supported!'.format(file_format)) if 'project' not in kwargs: kwargs['project'] = self.create_project() if vcs == 'mercurial': d_branch = 'default' repo = self.hg_repo_path push = self.hg_repo_path if not HgRepository.is_supported(): raise SkipTest('Mercurial not available!') elif vcs == 'subversion': d_branch = 'master' repo = 'file://' + self.svn_repo_path push = 'file://' + self.svn_repo_path if not SubversionRepository.is_supported(): raise SkipTest('Subversion not available!') else: d_branch = 'master' repo = self.git_repo_path push = self.git_repo_path if 'new_lang' not in kwargs: kwargs['new_lang'] = 'contact' if 'push_on_commit' not in kwargs: kwargs['push_on_commit'] = False if branch is None: branch = d_branch return SubProject.objects.create(name='Test', slug='test', repo=repo, push=push, branch=branch, filemask=mask, template=template, file_format=file_format, repoweb=REPOWEB_URL, save_history=True, new_base=new_base, vcs=vcs, **kwargs)
def get_optional_versions(): """ Returns versions of optional modules. """ result = [] name = "pyuca" url = "https://github.com/jtauber/pyuca" mod = get_version_module("pyuca", name, url, True) if mod is not None: result.append((name, url, "N/A", None)) name = "pyLibravatar" url = "https://pypi.python.org/pypi/pyLibravatar" mod = get_version_module("libravatar", name, url, True) if mod is not None: result.append((name, url, "N/A", None)) if HgRepository.is_supported(): result.append(("Mercurial", "http://mercurial.selenic.com/", HgRepository.get_version(), "2.8")) return result
def test_import_mercurial_mixed(self): """Test importing Mercurial project with mixed component/lang""" if not HgRepository.is_supported(): raise SkipTest('Mercurial not available!') self.create_project() self.assertRaises(CommandError, call_command, 'import_project', 'test', self.mercurial_repo_path, 'default', '*/**.po', vcs='mercurial')
def test_import_mercurial(self): """Test importing Mercurial project""" if not HgRepository.is_supported(): raise SkipTest('Mercurial not available!') project = self.create_project() call_command('import_project', 'test', self.mercurial_repo_path, 'default', '**/*.po', vcs='mercurial') # We should have loaded four subprojects self.assertEqual(project.subproject_set.count(), 3)
def test_import_mercurial(self): """Test importing Mercurial project""" if not HgRepository.is_supported(): raise SkipTest('Mercurial not available!') project = self.create_project() call_command( 'import_project', 'test', self.hg_repo_path, 'default', '**/*.po', vcs='mercurial' ) # We should have loaded four subprojects self.assertEqual(project.subproject_set.count(), 3)
def test_import_mercurial_mixed(self): """Test importing Mercurial project with mixed component/lang""" if not HgRepository.is_supported(): raise SkipTest('Mercurial not available!') self.create_project() self.assertRaises( CommandError, call_command, 'import_project', 'test', self.hg_repo_path, 'default', '*/**.po', vcs='mercurial' )
def _create_subproject(self, file_format, mask, template='', new_base='', vcs='git', branch=None, **kwargs): """ Creates real test subproject. """ if 'project' not in kwargs: kwargs['project'] = self.create_project() if vcs == 'mercurial': d_branch = 'default' repo = self.hg_repo_path push = self.hg_repo_path if not HgRepository.is_supported(): raise SkipTest('Mercurial not available!') elif vcs == 'subversion': d_branch = 'master' repo = 'file://' + self.svn_repo_path push = 'file://' + self.svn_repo_path if not SubversionRepository.is_supported(): raise SkipTest('Subversion not available!') else: d_branch = 'master' repo = self.git_repo_path push = self.git_repo_path if 'new_lang' not in kwargs: kwargs['new_lang'] = 'contact' if branch is None: branch = d_branch return SubProject.objects.create( name='Test', slug='test', repo=repo, push=push, branch=branch, filemask=mask, template=template, file_format=file_format, repoweb=REPOWEB_URL, save_history=True, new_base=new_base, vcs=vcs, **kwargs )
def _create_subproject(self, file_format, mask, template='', new_base='', vcs='git', **kwargs): """ Creates real test subproject. """ project = self.create_project() if vcs == 'mercurial': branch = 'default' repo = self.hg_repo_path push = self.hg_repo_path if not HgRepository.is_supported(): raise SkipTest('Mercurial not available!') else: branch = 'master' repo = self.git_repo_path push = self.git_repo_path if 'new_lang' not in kwargs: kwargs['new_lang'] = 'contact' return SubProject.objects.create(name='Test', slug='test', project=project, repo=repo, push=push, branch=branch, filemask=mask, template=template, file_format=file_format, repoweb=REPOWEB_URL, save_history=True, new_base=new_base, vcs=vcs, **kwargs)
def get_optional_versions(): """Return versions of optional modules.""" result = [] get_optional_module( result, 'pytz', 'pytz', 'https://pypi.python.org/pypi/pytz/' ) get_optional_module( result, 'pyuca', 'pyuca', 'https://github.com/jtauber/pyuca', None ) get_optional_module( result, 'bidi', 'python-bidi', 'https://github.com/MeirKriheli/python-bidi', 'VERSION' ) get_optional_module( result, 'libravatar', 'pyLibravatar', 'https://pypi.python.org/pypi/pyLibravatar', None ) get_optional_module( result, 'yaml', 'PyYAML', 'http://pyyaml.org/wiki/PyYAML' ) get_optional_module( result, 'tesserocr', 'tesserocr', 'https://github.com/sirfz/tesserocr' ) if HgRepository.is_supported(): result.append(( 'Mercurial', 'https://www.mercurial-scm.org/', HgRepository.get_version(), '2.8', )) if SubversionRepository.is_supported(): result.append(( 'git-svn', 'https://git-scm.com/docs/git-svn', SubversionRepository.get_version(), '1.6', )) if GitWithGerritRepository.is_supported(): result.append(( 'git-review', 'https://pypi.python.org/pypi/git-review', GitWithGerritRepository.get_version(), '1.0', )) if GithubRepository.is_supported(): result.append(( 'hub', 'https://hub.github.com/', GithubRepository.get_version(), '1.0', )) return result
def get_optional_versions(): ''' Returns versions of optional modules. ''' result = [] name = 'pytz' url = 'https://pypi.python.org/pypi/pytz/' mod = get_version_module('pytz', name, url, True) if mod is not None: result.append(( name, url, mod.__version__, None, )) name = 'pyuca' url = 'https://github.com/jtauber/pyuca' mod = get_version_module('pyuca', name, url, True) if mod is not None: result.append(( name, url, 'N/A', None, )) name = 'python-bidi' url = 'https://github.com/MeirKriheli/python-bidi' mod = get_version_module('bidi', name, url, True) if mod is not None: result.append(( name, url, mod.VERSION, None, )) name = 'pyLibravatar' url = 'https://pypi.python.org/pypi/pyLibravatar' mod = get_version_module('libravatar', name, url, True) if mod is not None: result.append(( name, url, 'N/A', None, )) name = 'PyYAML' url = 'http://pyyaml.org/wiki/PyYAML' mod = get_version_module('yaml', name, url, True) if mod is not None: result.append(( name, url, mod.__version__, None, )) if HgRepository.is_supported(): result.append(( 'Mercurial', 'https://www.mercurial-scm.org/', HgRepository.get_version(), '2.8', )) if SubversionRepository.is_supported(): result.append(( 'git-svn', 'https://git-scm.com/docs/git-svn', SubversionRepository.get_version(), '1.6', )) if GitWithGerritRepository.is_supported(): result.append(( 'git-review', 'https://pypi.python.org/pypi/git-review', GitWithGerritRepository.get_version(), '1.0', )) return result
def get_optional_versions(): ''' Returns versions of optional modules. ''' result = [] name = 'pytz' url = 'https://pypi.python.org/pypi/pytz/' mod = get_version_module('pytz', name, url, True) if mod is not None: result.append(( name, url, mod.__version__, None, )) name = 'pyuca' url = 'https://github.com/jtauber/pyuca' mod = get_version_module('pyuca', name, url, True) if mod is not None: result.append(( name, url, 'N/A', None, )) name = 'python-bidi' url = 'https://github.com/MeirKriheli/python-bidi' mod = get_version_module('bidi', name, url, True) if mod is not None: result.append(( name, url, mod.VERSION, None, )) name = 'pyLibravatar' url = 'https://pypi.python.org/pypi/pyLibravatar' mod = get_version_module('libravatar', name, url, True) if mod is not None: result.append(( name, url, 'N/A', None, )) name = 'PyYAML' url = 'http://pyyaml.org/wiki/PyYAML' mod = get_version_module('yaml', name, url, True) if mod is not None: result.append(( name, url, mod.__version__, None, )) if HgRepository.is_supported(): result.append(( 'Mercurial', 'https://www.mercurial-scm.org/', HgRepository.get_version(), '2.8', )) if SubversionRepository.is_supported(): result.append(( 'git-svn', 'https://git-scm.com/docs/git-svn', SubversionRepository.get_version(), '1.6', )) if GitWithGerritRepository.is_supported(): result.append(( 'git-review', 'https://pypi.python.org/pypi/git-review', GitWithGerritRepository.get_version(), '1.0', )) if GithubRepository.is_supported(): result.append(( 'hub', 'https://hub.github.com/', GithubRepository.get_version(), '1.0', )) return result