Best Python code snippet using stestr_python
util.py
Source: util.py
...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)...
test_util.py
Source: test_util.py
...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):...
Check out the latest blogs from LambdaTest on this topic:
In recent times, many web applications have been ported to mobile platforms, and mobile applications are also created to support businesses. However, Android and iOS are the major platforms because many people use smartphones compared to desktops for accessing web applications.
The web paradigm has changed considerably over the last few years. Web 2.0, a term coined way back in 1999, was one of the pivotal moments in the history of the Internet. UGC (User Generated Content), ease of use, and interoperability for the end-users were the key pillars of Web 2.0. Consumers who were only consuming content up till now started creating different forms of content (e.g., text, audio, video, etc.).
Agile project management is a great alternative to traditional methods, to address the customer’s needs and the delivery of business value from the beginning of the project. This blog describes the main benefits of Agile for both the customer and the business.
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.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!