Best Python code snippet using lemoncheesecake
test_catalogs.py
Source:test_catalogs.py
...21 copy_po = (locale_dir / 'en' / 'LC_MESSAGES' / po)22 if not copy_po.parent.exists():23 copy_po.parent.makedirs()24 shutil.copy(root / po, copy_po)25def teardown_test():26 build_dir.rmtree(True)27@with_setup(setup_test, teardown_test)28@with_app(buildername='html', testroot='intl',29 confoverrides={'language': 'en', 'locale_dirs': [locale_dir]})30def test_compile_all_catalogs(app, status, warning):31 app.builder.compile_all_catalogs()32 catalog_dir = locale_dir / app.config.language / 'LC_MESSAGES'33 expect = set([34 x.replace('.po', '.mo')35 for x in find_files(catalog_dir, '.po')36 ])37 actual = set(find_files(catalog_dir, '.mo'))38 assert actual # not empty39 assert actual == expect...
__init__.py
Source:__init__.py
...23 setup_fixtures = self.find_fixtures(self.setup_test, request)24 teardown_fixtures = self.find_fixtures(self.teardown_test, request)25 self.setup_test(**setup_fixtures)26 yield27 self.teardown_test(**teardown_fixtures)28 def setup_test(self, **fixtures):29 pass30 def teardown_test(self, **fixtures):31 pass32 @classmethod33 def setup_test_class(cls, **fixtures):34 pass35 @classmethod36 def teardown_test_class(cls, **fixtures):37 pass38def extract_year(value):39 if isinstance(value, int):40 return value41 if isinstance(value, datetime):42 return value.year43 raise NotImplementedError44class Worker(object):...
README_fixture.py
Source:README_fixture.py
1# -*- coding: utf-8 -*-2"""3A Fixture class specifically for mocking requests for the README doctests.4requests.Session.request is mocked out and a request.Response returned5dependant on the given arguments to request.6"""7from requests import Response8from tests import RequestsFixtureMixin9import fixtures10class Fixture(RequestsFixtureMixin):11 """A class to hold the mock request object and not pollute globals."""12 def setUp(self, *args, **kwargs):13 super(Fixture, self).setUp()14 self.request.side_effect = fixtures.handle_request15# setup_test and teardown_test must live at the module level to be discovered.16_fixture = Fixture()17setup_test = _fixture.setUp...
README_fixt.py
Source:README_fixt.py
...16 your_url=server.application_url,17 path_to_html_file=path_to_html_file,18 )19setup_test.__test__ = False20def teardown_test(test):21 test.globs['server'].shutdown()...
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!!