How to use _get_default_repo_url method in stestr

Best Python code snippet using stestr_python

util.py

Source:util.py Github

copy

Full Screen

...11# under the License.12import importlib13import os14import warnings15def _get_default_repo_url(repo_type):16 if repo_type == 'file':17 repo_url = os.getcwd()18 else:19 raise TypeError('Unrecognized repository type %s' % repo_type)20 return repo_url21def get_repo_open(repo_type=None, repo_url=None):22 """Return an already initialized repo object given the parameters23 :param str repo_type: DEPRECATED - The repo module to use for the returned24 repo25 :param str repo_url: An optional repo url, if one is not specified the26 default $CWD/.stestr will be used.27 """28 if repo_type is not None:29 msg = ("WARNING: Specifying repository type is deprecated and will be "30 "removed in future release.\n")31 warnings.warn(msg, DeprecationWarning, stacklevel=3)32 else:33 repo_type = 'file'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:53 repo_url = _get_default_repo_url(repo_type)...

Full Screen

Full Screen

test_util.py

Source:test_util.py Github

copy

Full Screen

...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