Best Python code snippet using lemoncheesecake
test_report_backend.py
Source:test_report_backend.py
...47 def test_load_report_xml(tmpdir, sample_report):48 _test_load_report(tmpdir, sample_report, save_xml)49 def test_save_report_xml(tmpdir, sample_report):50 _test_save_report(tmpdir, sample_report, XmlBackend(), load_xml)51 def test_load_reports_from_dir(tmpdir, sample_report):52 save_xml(sample_report, tmpdir.join("report.xml").strpath)53 save_json(sample_report, tmpdir.join("report.js").strpath)54 tmpdir.join("report.txt").write("foobar")55 reports = list(load_reports_from_dir(tmpdir.strpath))56 assert_report(reports[0], sample_report)57 assert_report(reports[1], sample_report)58 assert "json" in [r.backend.get_name() for r in reports]59 assert "xml" in [r.backend.get_name() for r in reports]60def _test_get_reporting_backend_names(specified, expected):61 assert get_reporting_backend_names(("console", "html", "json"), specified) == expected62def test_reporting_fixed_one():63 _test_get_reporting_backend_names(("console",), ("console",))64def test_reporting_fixed_two():65 _test_get_reporting_backend_names(("html", "json"), ("html", "json"))66def test_reporting_fixed_turn_on():67 _test_get_reporting_backend_names(("+junit",), ("console", "html", "json", "junit"))68def test_reporting_fixed_turn_off():69 _test_get_reporting_backend_names(("^console",), ("html", "json"))...
loader.py
Source:loader.py
...16 raise ReportLoadingError("Cannot load report from file '%s': %s" % (filename, excp))17 except ReportLoadingError:18 pass19 raise ReportLoadingError("Cannot find any suitable report backend to load report file '%s'" % filename)20def load_reports_from_dir(dirname, backends=None):21 # type: (str, Sequence[ReportingBackend]) -> Iterator[Report]22 for filename in [os.path.join(dirname, filename) for filename in os.listdir(dirname)]:23 if os.path.isfile(filename):24 try:25 yield load_report_from_file(filename, backends)26 except ReportLoadingError:27 pass28def load_report(path, backends=None):29 # type: (str, Sequence[ReportingBackend]) -> Report30 """31 Load report from a report directory or file.32 """33 if osp.isdir(path):34 try:35 return next(load_reports_from_dir(path, backends))36 except StopIteration:37 raise ReportLoadingError("Cannot find any report in directory '%s'" % path)38 else:...
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!!