How to use get_repo_initialise method in stestr

Best Python code snippet using stestr_python

util.py

Source:util.py Github

copy

Full Screen

...34 repo_module = importlib.import_module('stestr.repository.' + repo_type)35 if not repo_url:36 repo_url = _get_default_repo_url(repo_type)37 return repo_module.RepositoryFactory().open(repo_url)38def get_repo_initialise(repo_type=None, repo_url=None):39 """Return a newly initialized repo object given the parameters40 :param str repo_type: DEPRECATED - The repo module to use for the returned41 repo42 :param str repo_url: An optional repo url, if one is not specified the43 default $CWD/.stestr will be used.44 """45 if repo_type is not None:46 msg = ("WARNING: Specifying repository type is deprecated and will be "47 "removed in future release.\n")48 warnings.warn(msg, DeprecationWarning, stacklevel=3)49 else:50 repo_type = 'file'51 repo_module = importlib.import_module('stestr.repository.' + repo_type)52 if not repo_url:...

Full Screen

Full Screen

init.py

Source:init.py Github

copy

Full Screen

...29 for failures.30 :rtype: int31 """32 try:33 util.get_repo_initialise(repo_url=repo_url)34 except OSError as e:35 if e.errno != errno.EEXIST:36 raise37 repo_path = repo_url or './stestr'38 stdout.write('The specified repository directory %s already exists. '39 'Please check if the repository already exists or '40 'select a different path\n' % repo_path)...

Full Screen

Full Screen

test_util.py

Source:test_util.py Github

copy

Full Screen

1# Licensed under the Apache License, Version 2.0 (the "License"); you may2# not use this file except in compliance with the License. You may obtain3# a copy of the License at4#5# http://www.apache.org/licenses/LICENSE-2.06#7# Unless required by applicable law or agreed to in writing, software8# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT9# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the10# License for the specific language governing permissions and limitations11# under the License.12import os13import shutil14import tempfile15from unittest import mock16from stestr.repository import util17from stestr.tests import base18class TestUtil(base.TestCase):19 def setUp(self):20 super().setUp()21 self.temp_dir = tempfile.mkdtemp()22 self.addCleanup(shutil.rmtree, self.temp_dir)23 cwd = os.getcwd()24 os.chdir(self.temp_dir)25 self.temp_dir = os.getcwd()26 self.addCleanup(os.chdir, cwd)27 def test_get_default_url_file(self):28 repo_url = util._get_default_repo_url('file')29 self.assertEqual(self.temp_dir, repo_url)30 def test_get_default_url_invalid_type(self):31 self.assertRaises(TypeError, util._get_default_repo_url,32 'invalid_type')33 @mock.patch('importlib.import_module', side_effect=ImportError)34 def test_non_sql_get_repo_init_no_deps_import_error(self, import_mock):35 self.assertRaises(ImportError, util.get_repo_initialise, 'file')36 @mock.patch('importlib.import_module', side_effect=ImportError)37 def test_non_sql_get_repo_open_no_deps_import_error(self, import_mock):...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run stestr automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful