How to use prepare_cli_args method in Lemoncheesecake

Best Python code snippet using lemoncheesecake

test_filter.py

Source:test_filter.py Github

copy

Full Screen

...36def _test_step_filter(func, filtr, expected):37 report = run_func_in_test(func)38 steps = list(filter(filtr, report.all_steps()))39 assert [s.description for s in steps] == expected40def prepare_cli_args(args, func, **func_kwargs):41 cli_parser = argparse.ArgumentParser()42 func(cli_parser, **func_kwargs)43 return cli_parser.parse_args(args)44def test_filter_full_path_on_test():45 @lcc.suite("mysuite")46 class mysuite:47 @lcc.suite("subsuite")48 class subsuite:49 @lcc.test("test1")50 def baz(self):51 pass52 @lcc.test("test2")53 def test2(self):54 pass55 _test_test_filter(56 [mysuite],57 _TestFilter(paths=["mysuite.subsuite.baz"]),58 ["mysuite.subsuite.baz"]59 )60def test_filter_simple_func():61 @lcc.suite("mysuite")62 class mysuite:63 @lcc.suite("subsuite")64 class subsuite:65 @lcc.test("test1")66 def baz(self):67 pass68 @lcc.test("test2")69 def test2(self):70 pass71 _test_test_filter(72 [mysuite],73 lambda test: test.path == "mysuite.subsuite.baz",74 ["mysuite.subsuite.baz"]75 )76def test_filter_full_path_on_test_negative():77 @lcc.suite("mysuite")78 class mysuite:79 @lcc.suite("subsuite")80 class subsuite:81 @lcc.test("test1")82 def baz(self):83 pass84 @lcc.test("test2")85 def test2(self):86 pass87 _test_test_filter(88 [mysuite],89 _TestFilter(paths=["-mysuite.subsuite.baz"]),90 ["mysuite.subsuite.test2"]91 )92def test_filter_full_path_on_suite():93 @lcc.suite("mysuite")94 class mysuite:95 @lcc.suite("subsuite")96 class subsuite:97 @lcc.test("test1")98 def test1(self):99 pass100 @lcc.test("test2")101 def test2(self):102 pass103 _test_test_filter(104 [mysuite],105 _TestFilter(paths=["mysuite.subsuite"]),106 ["mysuite.subsuite.test1", "mysuite.subsuite.test2"]107 )108def test_filter_path_on_suite_negative():109 @lcc.suite("mysuite")110 class mysuite:111 @lcc.suite("subsuite")112 class subsuite:113 @lcc.test("test1")114 def baz(self):115 pass116 @lcc.test("test2")117 def test2(self):118 pass119 _test_test_filter(120 [mysuite],121 _TestFilter(paths=["-mysuite.subsuite.*"]),122 []123 )124def test_filter_path_complete_on_top_suite():125 @lcc.suite("mysuite")126 class mysuite:127 @lcc.suite("subsuite")128 class subsuite:129 @lcc.test("test1")130 def test1(self):131 pass132 @lcc.test("test2")133 def test2(self):134 pass135 _test_test_filter(136 [mysuite],137 _TestFilter(paths=["mysuite"]),138 ["mysuite.subsuite.test1", "mysuite.subsuite.test2"]139 )140def test_filter_path_wildcard_on_test():141 @lcc.suite("mysuite")142 class mysuite:143 @lcc.suite("subsuite")144 class subsuite:145 @lcc.test("test1")146 def baz(self):147 pass148 @lcc.test("test2")149 def test2(self):150 pass151 _test_test_filter(152 [mysuite],153 _TestFilter(paths=["mysuite.subsuite.ba*"]),154 ["mysuite.subsuite.baz"]155 )156def test_filter_path_wildcard_on_test_negative():157 @lcc.suite("mysuite")158 class mysuite:159 @lcc.suite("subsuite")160 class subsuite:161 @lcc.test("test1")162 def baz(self):163 pass164 @lcc.test("test2")165 def test2(self):166 pass167 _test_test_filter(168 [mysuite],169 _TestFilter(paths=["-mysuite.subsuite.ba*"]),170 ["mysuite.subsuite.test2"]171 )172def test_filter_path_wildcard_on_suite():173 @lcc.suite("mysuite")174 class mysuite:175 @lcc.suite("subsuite")176 class subsuite:177 @lcc.test("test1")178 def baz(self):179 pass180 @lcc.test("test2")181 def test2(self):182 pass183 _test_test_filter(184 [mysuite],185 _TestFilter(paths=["mysuite.sub*.baz"]),186 ["mysuite.subsuite.baz"]187 )188def test_filter_path_wildcard_on_suite_negative():189 @lcc.suite("mysuite")190 class mysuite:191 @lcc.suite("subsuite")192 class subsuite:193 @lcc.test("test1")194 def baz(self):195 pass196 @lcc.test("test2")197 def test2(self):198 pass199 _test_test_filter(200 [mysuite],201 _TestFilter(paths=["~mysuite.sub*.baz"]),202 ["mysuite.subsuite.test2"]203 )204def test_filter_description_on_test():205 @lcc.suite("mysuite")206 class mysuite:207 @lcc.suite("subsuite")208 class subsuite:209 @lcc.test("desc1")210 def baz(self):211 pass212 @lcc.test("desc2")213 def test2(self):214 pass215 _test_test_filter(216 [mysuite],217 _TestFilter(descriptions=[["desc2"]]),218 ["mysuite.subsuite.test2"]219 )220def test_filter_description_on_test_negative():221 @lcc.suite("mysuite")222 class mysuite:223 @lcc.suite("subsuite")224 class subsuite:225 @lcc.test("desc1")226 def baz(self):227 pass228 @lcc.test("desc2")229 def test2(self):230 pass231 _test_test_filter(232 [mysuite],233 _TestFilter(descriptions=[["~desc2"]]),234 ["mysuite.subsuite.baz"]235 )236def test_filter_description_on_suite():237 @lcc.suite("mysuite")238 class mysuite:239 @lcc.suite("desc1")240 class subsuite:241 @lcc.test("baz")242 def baz(self):243 pass244 @lcc.suite("desc2")245 class othersuite:246 @lcc.test("test2")247 def test2(self):248 pass249 _test_test_filter(250 [mysuite],251 _TestFilter(descriptions=[["desc2"]]),252 ["mysuite.othersuite.test2"]253 )254def test_filter_description_on_suite_negative():255 @lcc.suite("mysuite")256 class mysuite:257 @lcc.suite("desc1")258 class subsuite:259 @lcc.test("baz")260 def baz(self):261 pass262 @lcc.suite("desc2")263 class othersuite:264 @lcc.test("test2")265 def test2(self):266 pass267 _test_test_filter(268 [mysuite],269 _TestFilter(descriptions=[["-desc2"]]),270 ["mysuite.subsuite.baz"]271 )272def test_filter_tag_on_test():273 @lcc.suite("mysuite")274 class mysuite:275 @lcc.suite("subsuite")276 class subsuite:277 @lcc.test("test1")278 def baz(self):279 pass280 @lcc.tags("tag1")281 @lcc.test("test2")282 def test2(self):283 pass284 _test_test_filter(285 [mysuite],286 _TestFilter(tags=[["tag1"]]),287 ["mysuite.subsuite.test2"]288 )289def test_filter_tag_on_test_negative():290 @lcc.suite("mysuite")291 class mysuite:292 @lcc.suite("subsuite")293 class subsuite:294 @lcc.test("test1")295 def baz(self):296 pass297 @lcc.tags("tag1")298 @lcc.test("test2")299 def test2(self):300 pass301 _test_test_filter(302 [mysuite],303 _TestFilter(tags=[["-tag1"]]),304 ["mysuite.subsuite.baz"]305 )306def test_filter_tag_on_suite():307 @lcc.suite("mysuite")308 class mysuite:309 @lcc.tags("tag1")310 @lcc.suite("subsuite1")311 class subsuite1:312 @lcc.test("test1")313 def baz(self):314 pass315 @lcc.tags("tag2")316 @lcc.suite("subsuite2")317 class subsuite2:318 @lcc.test("test2")319 def test2(self):320 pass321 _test_test_filter(322 [mysuite],323 _TestFilter(tags=[["tag2"]]),324 ["mysuite.subsuite2.test2"]325 )326def test_filter_tag_on_suite_negative():327 @lcc.suite("mysuite")328 class mysuite:329 @lcc.tags("tag1")330 @lcc.suite("subsuite1")331 class subsuite1:332 @lcc.test("test1")333 def baz(self):334 pass335 @lcc.tags("tag2")336 @lcc.suite("subsuite2")337 class subsuite2:338 @lcc.test("test2")339 def test2(self):340 pass341 _test_test_filter(342 [mysuite],343 _TestFilter(tags=[["~tag2"]]),344 ["mysuite.subsuite1.baz"]345 )346def test_filter_property_on_test():347 @lcc.suite("mysuite")348 class mysuite:349 @lcc.suite("subsuite")350 class subsuite:351 @lcc.test("test1")352 def baz(self):353 pass354 @lcc.prop("myprop", "foo")355 @lcc.test("test2")356 def test2(self):357 pass358 _test_test_filter(359 [mysuite],360 _TestFilter(properties=[[("myprop", "foo")]]),361 ["mysuite.subsuite.test2"]362 )363def test_filter_property_on_test_negative():364 @lcc.suite("mysuite")365 class mysuite:366 @lcc.suite("subsuite")367 class subsuite:368 @lcc.prop("myprop", "bar")369 @lcc.test("test1")370 def baz(self):371 pass372 @lcc.prop("myprop", "foo")373 @lcc.test("test2")374 def test2(self):375 pass376 _test_test_filter(377 [mysuite],378 _TestFilter(properties=[[("myprop", "-foo")]]),379 ["mysuite.subsuite.baz"]380 )381def test_filter_property_on_suite():382 @lcc.suite("mysuite")383 class mysuite:384 @lcc.prop("myprop", "foo")385 @lcc.suite("subsuite1")386 class subsuite1:387 @lcc.test("test1")388 def baz(self):389 pass390 @lcc.prop("myprop", "bar")391 @lcc.suite("subsuite2")392 class subsuite2:393 @lcc.test("test2")394 def test2(self):395 pass396 _test_test_filter(397 [mysuite],398 _TestFilter(properties=[[("myprop", "bar")]]),399 ["mysuite.subsuite2.test2"]400 )401def test_filter_property_on_suite_negative():402 @lcc.suite("mysuite")403 class mysuite:404 @lcc.prop("myprop", "foo")405 @lcc.suite("subsuite1")406 class subsuite1:407 @lcc.test("test1")408 def baz(self):409 pass410 @lcc.prop("myprop", "bar")411 @lcc.suite("subsuite2")412 class subsuite2:413 @lcc.test("test2")414 def test2(self):415 pass416 _test_test_filter(417 [mysuite],418 _TestFilter(properties=[[("myprop", "~bar")]]),419 ["mysuite.subsuite1.baz"]420 )421def test_filter_link_on_test_without_name():422 @lcc.suite("mysuite")423 class mysuite:424 @lcc.suite("subsuite")425 class subsuite:426 @lcc.test("test1")427 def baz(self):428 pass429 @lcc.link("http://bug.trac.ker/1234")430 @lcc.test("test2")431 def test2(self):432 pass433 _test_test_filter(434 [mysuite],435 _TestFilter(links=[["http://bug.trac.ker/1234"]]),436 ["mysuite.subsuite.test2"]437 )438def test_filter_link_on_test_negative_with_name():439 @lcc.suite("mysuite")440 class mysuite:441 @lcc.suite("subsuite")442 class subsuite:443 @lcc.test("test1")444 def baz(self):445 pass446 @lcc.link("http://bug.trac.ker/1234", "#1234")447 @lcc.test("test2")448 def test2(self):449 pass450 _test_test_filter(451 [mysuite],452 _TestFilter(links=[["-#1234"]]),453 ["mysuite.subsuite.baz"]454 )455def test_filter_link_on_suite():456 @lcc.suite("mysuite")457 class mysuite:458 @lcc.link("http://bug.trac.ker/1234", "#1234")459 @lcc.suite("subsuite1")460 class subsuite1:461 @lcc.test("test1")462 def baz(self):463 pass464 @lcc.link("http://bug.trac.ker/1235", "#1235")465 @lcc.suite("subsuite2")466 class subsuite2:467 @lcc.test("test2")468 def test2(self):469 pass470 _test_test_filter(471 [mysuite],472 _TestFilter(links=[["#1235"]]),473 ["mysuite.subsuite2.test2"]474 )475def test_filter_link_on_suite_negative():476 @lcc.suite("mysuite")477 class mysuite:478 @lcc.link("http://bug.trac.ker/1234", "#1234")479 @lcc.suite("subsuite1")480 class subsuite1:481 @lcc.test("test1")482 def baz(self):483 pass484 @lcc.link("http://bug.trac.ker/1235", "#1235")485 @lcc.suite("subsuite2")486 class subsuite2:487 @lcc.test("test2")488 def test2(self):489 pass490 _test_test_filter(491 [mysuite],492 _TestFilter(links=[["~#1235"]]),493 ["mysuite.subsuite1.baz"]494 )495def test_filter_path_on_suite_and_tag_on_test():496 @lcc.suite("mysuite")497 class mysuite:498 @lcc.suite("subsuite")499 class subsuite:500 @lcc.test("test1")501 def baz(self):502 pass503 @lcc.tags("tag1")504 @lcc.test("test2")505 def test2(self):506 pass507 _test_test_filter(508 [mysuite],509 _TestFilter(paths=["mysuite.subsuite"], tags=[["tag1"]]),510 ["mysuite.subsuite.test2"]511 )512def test_filter_path_on_suite_and_negative_tag_on_test():513 @lcc.suite("mysuite")514 class mysuite:515 @lcc.suite("subsuite")516 class subsuite:517 @lcc.test("test1")518 def baz(self):519 pass520 @lcc.tags("tag1")521 @lcc.test("test2")522 def test2(self):523 pass524 _test_test_filter(525 [mysuite],526 _TestFilter(paths=["mysuite.subsuite"], tags=[["-tag1"]]),527 ["mysuite.subsuite.baz"]528 )529def test_filter_description_on_suite_and_link_on_test():530 @lcc.suite("mysuite")531 class mysuite:532 @lcc.suite("subsuite")533 class subsuite:534 @lcc.test("test1")535 def test1(self):536 pass537 @lcc.suite("Sub suite 2")538 class subsuite2:539 @lcc.link("http://my.bug.trac.ker/1234", "#1234")540 @lcc.test("test2")541 def test2(self):542 pass543 @lcc.test("test3")544 def test3(self):545 pass546 _test_test_filter(547 [mysuite],548 _TestFilter(descriptions=[["Sub suite 2"]], links=[["#1234"]]),549 ["mysuite.subsuite2.test2"]550 )551def test_filter_path_and_tag_on_suite():552 @lcc.suite("mysuite")553 class mysuite:554 @lcc.tags("foo")555 @lcc.suite("subsuite1")556 class subsuite1:557 @lcc.test("test1")558 def test1(self):559 pass560 @lcc.tags("foo")561 @lcc.suite("subsuite2")562 class subsuite2:563 @lcc.test("test2")564 def test2(self):565 pass566 _test_test_filter(567 [mysuite],568 _TestFilter(paths=["mysuite.subsuite1"], tags=[["foo"]]),569 ["mysuite.subsuite1.test1"]570 )571def test_filter_path_and_tag_on_test():572 @lcc.suite("mysuite")573 class mysuite:574 @lcc.suite("subsuite1")575 class subsuite1:576 @lcc.tags("foo")577 @lcc.test("test1")578 def test1(self):579 pass580 @lcc.suite("subsuite2")581 class subsuite2:582 @lcc.tags("foo")583 @lcc.test("test2")584 def test2(self):585 pass586 @lcc.test("test3")587 def test3(self):588 pass589 _test_test_filter(590 [mysuite],591 _TestFilter(paths=["mysuite.subsuite2.*"], tags=[["foo"]]),592 ["mysuite.subsuite2.test2"]593 )594def test_filter_path_and_negative_tag_on_test():595 @lcc.suite("mysuite")596 class mysuite:597 @lcc.suite("subsuite1")598 class subsuite1:599 @lcc.tags("foo")600 @lcc.test("test1")601 def test1(self):602 pass603 @lcc.suite("subsuite2")604 class subsuite2:605 @lcc.tags("foo")606 @lcc.test("test2")607 def test2(self):608 pass609 @lcc.test("test3")610 def test3(self):611 pass612 _test_test_filter(613 [mysuite],614 _TestFilter(paths=["mysuite.subsuite2.*"], tags=[["-foo"]]),615 ["mysuite.subsuite2.test3"]616 )617def test_filter_disabled():618 @lcc.suite("mysuite")619 class mysuite:620 @lcc.test("test1")621 def test1(self):622 pass623 @lcc.test("test2")624 @lcc.disabled()625 def test2(self):626 pass627 _test_test_filter(628 [mysuite],629 _TestFilter(disabled=True),630 ["mysuite.test2"]631 )632def test_filter_enabled():633 @lcc.suite("mysuite")634 class mysuite:635 @lcc.test("test1")636 def test1(self):637 pass638 @lcc.test("test2")639 @lcc.disabled()640 def test2(self):641 pass642 _test_test_filter(643 [mysuite],644 _TestFilter(enabled=True),645 ["mysuite.test1"]646 )647def test_empty_filter():648 filt = _TestFilter()649 assert not filt650def test_non_empty_filter():651 def do_test(attr, val):652 filtr = _TestFilter()653 assert hasattr(filtr, attr)654 setattr(filtr, attr, val)655 assert filtr656 do_test("paths", ["foo"])657 do_test("descriptions", [["foo"]])658 do_test("tags", [["foo"]])659 do_test("properties", [[("foo", "bar")]])660 do_test("links", ["foo"])661def test_filter_description_and():662 @lcc.suite("mysuite")663 class mysuite:664 @lcc.suite("subsuite")665 class subsuite:666 @lcc.test("test1")667 def baz(self):668 pass669 @lcc.test("test2")670 def test2(self):671 pass672 _test_test_filter(673 [mysuite],674 _TestFilter(descriptions=[["mysuite"], ["test1"]]),675 ["mysuite.subsuite.baz"]676 )677def test_filter_tags_and():678 @lcc.suite("mysuite")679 class mysuite:680 @lcc.suite("subsuite")681 class subsuite:682 @lcc.test("test1")683 @lcc.tags("foo", "bar")684 def baz(self):685 pass686 @lcc.test("test2")687 @lcc.tags("foo")688 def test2(self):689 pass690 _test_test_filter(691 [mysuite],692 _TestFilter(tags=[["foo"], ["bar"]]),693 ["mysuite.subsuite.baz"]694 )695def test_filter_properties_and():696 @lcc.suite("mysuite")697 class mysuite:698 @lcc.suite("subsuite")699 class subsuite:700 @lcc.test("test1")701 @lcc.prop("foo", "1")702 @lcc.prop("bar", "2")703 def baz(self):704 pass705 @lcc.test("test2")706 @lcc.prop("foo", "1")707 def test2(self):708 pass709 _test_test_filter(710 [mysuite],711 _TestFilter(properties=[[("foo", "1")], [("bar", "2")]]),712 ["mysuite.subsuite.baz"]713 )714def test_filter_links_and():715 @lcc.suite("mysuite")716 class mysuite:717 @lcc.suite("subsuite")718 class subsuite:719 @lcc.test("test1")720 @lcc.link("http://a.b.c/1234", "#1234")721 @lcc.link("http://a.b.c/1235")722 def baz(self):723 pass724 @lcc.test("test2")725 @lcc.link("http://a.b.c/1234", "#1234")726 def test2(self):727 pass728 _test_test_filter(729 [mysuite],730 _TestFilter(links=[["#1234"], ["*/1235"]]),731 ["mysuite.subsuite.baz"]732 )733def test_filter_and_or():734 @lcc.suite("mysuite")735 class mysuite:736 @lcc.suite("subsuite")737 class subsuite:738 @lcc.test("test1")739 @lcc.tags("foo", "bar")740 def baz(self):741 pass742 @lcc.test("test2")743 @lcc.tags("foo", "baz")744 def test2(self):745 pass746 _test_test_filter(747 [mysuite],748 _TestFilter(tags=[["foo"], ["bar", "baz"]]),749 ["mysuite.subsuite.baz", "mysuite.subsuite.test2"]750 )751def test_result_filter_on_path():752 @lcc.suite("suite")753 class suite(object):754 @lcc.test("test1")755 def test1(self):756 pass757 @lcc.test("test2")758 def test2(self):759 pass760 _test_result_filter(761 suite,762 ResultFilter(paths=["suite.test2"]),763 ["suite.test2"]764 )765def test_result_filter_on_passed():766 @lcc.suite("suite")767 class suite(object):768 @lcc.test("test1")769 def test1(self):770 lcc.log_error("error")771 @lcc.test("test2")772 def test2(self):773 pass774 _test_result_filter(775 suite,776 ResultFilter(statuses=["passed"]),777 ["suite.test2"]778 )779def test_result_filter_on_failed():780 @lcc.suite("suite")781 class suite(object):782 @lcc.test("test1")783 def test1(self):784 lcc.log_error("error")785 @lcc.test("test2")786 def test2(self):787 pass788 _test_result_filter(789 suite,790 ResultFilter(statuses=["failed"]),791 ["suite.test1"]792 )793def test_result_filter_with_setup_teardown_on_passed():794 @lcc.fixture(scope="session")795 def fixt():796 lcc.log_info("session setup")797 yield798 lcc.log_info("session teardown")799 @lcc.suite("suite")800 class suite(object):801 def setup_suite(self):802 lcc.log_info("setup suite")803 def teardown_suite(self):804 lcc.log_info("teadown suite")805 @lcc.test("test1")806 def test1(self, fixt):807 pass808 @lcc.test("test2")809 @lcc.disabled()810 def test2(self):811 pass812 _test_result_filter(813 suite,814 ResultFilter(statuses=["passed"]),815 (816 ReportLocation.in_test_session_setup(),817 ReportLocation.in_suite_setup("suite"),818 "suite.test1",819 ReportLocation.in_suite_teardown("suite"),820 ReportLocation.in_test_session_teardown()821 ),822 fixtures=(fixt,)823 )824def test_result_filter_with_setup_teardown_on_disabled():825 @lcc.fixture(scope="session")826 def fixt():827 lcc.log_info("session setup")828 yield829 lcc.log_info("session teardown")830 @lcc.suite("suite")831 class suite(object):832 def setup_suite(self):833 lcc.log_info("setup suite")834 def teardown_suite(self):835 lcc.log_info("teadown suite")836 @lcc.test("test1")837 def test1(self, fixt):838 pass839 @lcc.test("test2")840 @lcc.disabled()841 def test2(self):842 pass843 _test_result_filter(844 suite,845 ResultFilter(disabled=True),846 (847 "suite.test2",848 ),849 fixtures=(fixt,)850 )851def test_result_filter_with_setup_teardown_on_enabled():852 @lcc.fixture(scope="session")853 def fixt():854 lcc.log_info("session setup")855 yield856 lcc.log_info("session teardown")857 @lcc.suite("suite")858 class suite(object):859 def setup_suite(self):860 lcc.log_info("setup suite")861 def teardown_suite(self):862 lcc.log_info("teadown suite")863 @lcc.test("test1")864 def test1(self, fixt):865 pass866 @lcc.test("test2")867 @lcc.disabled()868 def test2(self):869 pass870 _test_result_filter(871 suite,872 ResultFilter(enabled=True),873 (874 ReportLocation.in_test_session_setup(),875 ReportLocation.in_suite_setup("suite"),876 "suite.test1",877 ReportLocation.in_suite_teardown("suite"),878 ReportLocation.in_test_session_teardown()879 ),880 fixtures=(fixt,)881 )882def test_result_filter_with_setup_teardown_on_tags():883 @lcc.fixture(scope="session")884 def fixt():885 lcc.log_info("session setup")886 yield887 lcc.log_info("session teardown")888 @lcc.suite("suite")889 @lcc.tags("mytag")890 class suite(object):891 def setup_suite(self):892 lcc.log_info("setup suite")893 def teardown_suite(self):894 lcc.log_info("teadown suite")895 @lcc.test("test1")896 def test1(self, fixt):897 pass898 @lcc.test("test2")899 @lcc.disabled()900 def test2(self):901 pass902 _test_result_filter(903 suite,904 ResultFilter(tags=[["mytag"]]),905 (906 ReportLocation.in_suite_setup("suite"),907 "suite.test1",908 "suite.test2",909 ReportLocation.in_suite_teardown("suite")910 ),911 fixtures=(fixt,)912 )913def test_result_filter_with_setup_teardown_on_failed_and_skipped():914 @lcc.fixture(scope="session")915 def fixt():916 lcc.log_info("session setup")917 yield918 lcc.log_info("session teardown")919 @lcc.suite("suite")920 class suite(object):921 def setup_suite(self):922 lcc.log_error("some error")923 def teardown_suite(self):924 lcc.log_info("teadown suite")925 @lcc.test("test1")926 def test1(self, fixt):927 pass928 @lcc.test("test2")929 @lcc.disabled()930 def test2(self):931 pass932 _test_result_filter(933 suite,934 ResultFilter(statuses=("failed", "skipped")),935 (936 ReportLocation.in_suite_setup("suite"),937 "suite.test1"938 ),939 fixtures=(fixt,)940 )941def test_result_filter_with_setup_teardown_on_grep():942 @lcc.fixture(scope="session")943 def fixt():944 lcc.log_info("foobar")945 yield946 lcc.log_info("foobar")947 @lcc.suite("suite")948 class suite(object):949 def setup_suite(self):950 lcc.log_info("foobar")951 def teardown_suite(self):952 lcc.log_info("foobar")953 @lcc.test("test1")954 def test1(self, fixt):955 lcc.log_info("foobar")956 _test_result_filter(957 suite,958 ResultFilter(grep=re.compile(r"foobar")),959 (960 ReportLocation.in_test_session_setup(),961 ReportLocation.in_suite_setup("suite"),962 "suite.test1",963 ReportLocation.in_suite_teardown("suite"),964 ReportLocation.in_test_session_teardown()965 ),966 fixtures=(fixt,)967 )968def test_result_filter_grep_no_result():969 @lcc.suite("suite")970 class suite(object):971 @lcc.test("test")972 def test(self):973 lcc.set_step("some step")974 lcc.log_info("something")975 lcc.log_check("check", True, "1")976 lcc.log_url("http://www.example.com")977 lcc.save_attachment_content("A" * 100, "file.txt")978 _test_result_filter(979 suite,980 ResultFilter(grep=re.compile(r"foobar")),981 expected=()982 )983def test_result_filter_grep_step():984 @lcc.suite("suite")985 class suite(object):986 @lcc.test("test")987 def test(self):988 lcc.set_step("foobar")989 lcc.log_info("something")990 _test_result_filter(991 suite,992 ResultFilter(grep=re.compile(r"foobar")),993 expected=("suite.test",)994 )995def test_result_filter_grep_log():996 @lcc.suite("suite")997 class suite(object):998 @lcc.test("test")999 def test(self):1000 lcc.log_info("foobar")1001 _test_result_filter(1002 suite,1003 ResultFilter(grep=re.compile(r"foobar")),1004 expected=("suite.test",)1005 )1006def test_result_filter_grep_check_description():1007 @lcc.suite("suite")1008 class suite(object):1009 @lcc.test("test")1010 def test(self):1011 lcc.log_check("foobar", True)1012 _test_result_filter(1013 suite,1014 ResultFilter(grep=re.compile(r"foobar")),1015 expected=("suite.test",)1016 )1017def test_result_filter_grep_check_details():1018 @lcc.suite("suite")1019 class suite(object):1020 @lcc.test("test")1021 def test(self):1022 lcc.log_check("something", True, "foobar")1023 _test_result_filter(1024 suite,1025 ResultFilter(grep=re.compile(r"foobar")),1026 expected=("suite.test",)1027 )1028def test_result_filter_grep_url():1029 @lcc.suite("suite")1030 class suite(object):1031 @lcc.test("test")1032 def test(self):1033 lcc.log_url("http://example.com/foobar")1034 _test_result_filter(1035 suite,1036 ResultFilter(grep=re.compile(r"foobar")),1037 expected=("suite.test",)1038 )1039def test_result_filter_grep_attachment_filename():1040 @lcc.suite("suite")1041 class suite(object):1042 @lcc.test("test")1043 def test(self):1044 lcc.save_attachment_content("hello world", "foobar.txt")1045 _test_result_filter(1046 suite,1047 ResultFilter(grep=re.compile(r"foobar")),1048 expected=("suite.test",)1049 )1050def test_result_filter_grep_attachment_description():1051 @lcc.suite("suite")1052 class suite(object):1053 @lcc.test("test")1054 def test(self):1055 lcc.save_attachment_content("hello world", "file.txt", "foobar")1056 _test_result_filter(1057 suite,1058 ResultFilter(grep=re.compile(r"foobar")),1059 expected=("suite.test",)1060 )1061def test_result_filter_grep_url_description():1062 @lcc.suite("suite")1063 class suite(object):1064 @lcc.test("test")1065 def test(self):1066 lcc.log_url("http://example.com", "foobar")1067 _test_result_filter(1068 suite,1069 ResultFilter(grep=re.compile(r"foobar")),1070 expected=("suite.test",)1071 )1072def test_step_filter_no_criteria():1073 def do():1074 lcc.set_step("mystep")1075 lcc.log_info("foobar")1076 _test_step_filter(do, StepFilter(), ["mystep"])1077def test_step_filter_passed_ok():1078 def do():1079 lcc.set_step("mystep")1080 lcc.log_info("foobar")1081 _test_step_filter(do, StepFilter(passed=True), ["mystep"])1082def test_step_filter_passed_ko_because_of_log_error():1083 def do():1084 lcc.set_step("mystep")1085 lcc.log_error("foobar")1086 _test_step_filter(do, StepFilter(passed=True), [])1087def test_step_filter_passed_ko_because_of_check_error():1088 def do():1089 lcc.set_step("mystep")1090 check_that("value", 1, equal_to(2))1091 _test_step_filter(do, StepFilter(passed=True), [])1092def test_step_filter_failed_ok():1093 def do():1094 lcc.set_step("mystep")1095 lcc.log_error("foobar")1096 _test_step_filter(do, StepFilter(failed=True), ["mystep"])1097def test_step_filter_failed_ko():1098 def do():1099 lcc.set_step("mystep")1100 lcc.log_info("foobar")1101 _test_step_filter(do, StepFilter(failed=True), [])1102def test_step_filter_grep_ok():1103 def do():1104 lcc.set_step("mystep")1105 lcc.log_error("foobar")1106 _test_step_filter(do, StepFilter(grep=re.compile("foo")), ["mystep"])1107def test_step_filter_grep_ko():1108 def do():1109 lcc.set_step("mystep")1110 lcc.log_info("foobar")1111 _test_step_filter(do, StepFilter(grep=re.compile("baz")), [])1112def test_step_filter_through_parent_ok():1113 @lcc.suite("suite")1114 class suite:1115 @lcc.test("test")1116 def test(self):1117 lcc.set_step("mystep")1118 lcc.log_info("foobar")1119 report = run_suite_class(suite)1120 steps = list(filter(StepFilter(paths=("suite.test",)), report.all_steps()))1121 assert [s.description for s in steps] == ["mystep"]1122def test_step_filter_in_suite_setup():1123 @lcc.suite("suite")1124 class suite:1125 def setup_suite(self):1126 lcc.set_step("setup_suite")1127 lcc.log_info("in setup_suite")1128 @lcc.test("test")1129 def test(self):1130 lcc.set_step("mystep")1131 lcc.log_info("foobar")1132 report = run_suite_class(suite)1133 steps = list(filter(StepFilter(grep=re.compile("in setup_suite")), report.all_steps()))1134 assert [s.description for s in steps] == ["setup_suite"]1135def test_step_filter_in_session_setup():1136 @lcc.fixture(scope="session")1137 def fixt():1138 lcc.set_step("setup_session")1139 lcc.log_info("in setup_session")1140 @lcc.suite("suite")1141 class suite:1142 @lcc.test("test")1143 def test(self, fixt):1144 lcc.set_step("mystep")1145 lcc.log_info("foobar")1146 report = run_suite_class(suite, fixtures=(fixt,))1147 steps = list(filter(StepFilter(grep=re.compile("in setup_session")), report.all_steps()))1148 assert [s.description for s in steps] == ["setup_session"]1149def test_step_filter_through_parent_ko():1150 @lcc.suite("suite")1151 class suite:1152 @lcc.test("test")1153 def test(self):1154 lcc.set_step("mystep")1155 lcc.log_info("foobar")1156 report = run_suite_class(suite)1157 steps = list(filter(StepFilter(paths=("unknown.test",)), report.all_steps()))1158 assert len(steps) == 01159def test_filter_suites_on_suite_setup():1160 @lcc.suite("suite")1161 class suite(object):1162 def setup_suite(self):1163 lcc.log_info("foobar")1164 @lcc.test("test")1165 def test(self):1166 pass1167 report = run_suite_class(suite)1168 suites = list(filter_suites(report.get_suites(), ResultFilter(grep=re.compile("foobar"))))1169 assert len(suites) == 11170def test_filter_suites_on_suite_teardown():1171 @lcc.suite("suite")1172 class suite(object):1173 def teardown_suite(self):1174 lcc.log_info("foobar")1175 @lcc.test("test")1176 def test(self):1177 pass1178 report = run_suite_class(suite)1179 suites = list(filter_suites(report.get_suites(), ResultFilter(grep=re.compile("foobar"))))1180 assert len(suites) == 11181def test_make_test_filter():1182 filtr = make_test_filter(prepare_cli_args([], add_test_filter_cli_args))1183 assert not filtr1184def test_make_test_filter_from_report(tmpdir):1185 @lcc.suite("mysuite")1186 class mysuite:1187 @lcc.test("mytest")1188 def mytest(self):1189 pass1190 suite = load_suite_from_class(mysuite)1191 run_suite(suite, backends=[JsonBackend()], tmpdir=tmpdir)1192 cli_args = prepare_cli_args(["--from-report", tmpdir.strpath], add_test_filter_cli_args)1193 filtr = make_test_filter(cli_args)1194 assert filtr(suite.get_tests()[0])1195def test_make_test_filter_from_report_implicit(tmpdir):1196 def do_test(args, expected):1197 filtr = make_test_filter(prepare_cli_args(args, add_test_filter_cli_args))1198 assert filtr._tests == expected1199 report = make_report(1200 suites=[1201 make_suite_result(1202 name="tests",1203 tests=(1204 make_test_result(name="passed", status="passed"),1205 make_test_result(name="failed", status="failed"),1206 make_test_result(name="skipped", status="skipped"),1207 make_test_result(1208 name="grepable", status="passed",1209 steps=[1210 make_step(logs=[Log(Log.LEVEL_INFO, "this is grepable", ts=0)])1211 ]1212 )1213 )1214 )1215 ]1216 )1217 backend = JsonBackend()1218 tmpdir.mkdir(DEFAULT_REPORT_DIR_NAME)1219 backend.save_report(tmpdir.join(DEFAULT_REPORT_DIR_NAME, "report.json").strpath, report)1220 with change_dir(tmpdir.strpath):1221 do_test(["--passed"], ["tests.passed", "tests.grepable"])1222 do_test(["--failed"], ["tests.failed"])1223 do_test(["--skipped"], ["tests.skipped"])1224 do_test(["--grep", "grepable"], ["tests.grepable"])1225 do_test(["--non-passed"], ["tests.failed", "tests.skipped"])1226def test_make_result_filter():1227 filtr = make_result_filter(prepare_cli_args([], add_result_filter_cli_args))1228 assert not filtr1229def test_add_result_filter_cli_args():1230 cli_args = prepare_cli_args([], add_result_filter_cli_args)1231 assert hasattr(cli_args, "passed")1232 assert hasattr(cli_args, "failed")1233 assert hasattr(cli_args, "skipped")1234 assert hasattr(cli_args, "enabled")1235 assert hasattr(cli_args, "disabled")1236 assert hasattr(cli_args, "non_passed")1237 assert hasattr(cli_args, "grep")1238def test_add_result_filter_cli_args_with_only_executed_tests():1239 cli_args = prepare_cli_args([], add_result_filter_cli_args, only_executed_tests=True)1240 assert hasattr(cli_args, "passed")1241 assert hasattr(cli_args, "failed")1242 assert not hasattr(cli_args, "skipped")1243 assert not hasattr(cli_args, "enabled")1244 assert not hasattr(cli_args, "disabled")1245 assert not hasattr(cli_args, "non_passed")1246 assert hasattr(cli_args, "grep")1247def test_add_step_filter_cli_args():1248 cli_args = prepare_cli_args([], add_step_filter_cli_args)1249 assert hasattr(cli_args, "passed")1250 assert hasattr(cli_args, "failed")1251 assert not hasattr(cli_args, "skipped")1252 assert not hasattr(cli_args, "enabled")1253 assert not hasattr(cli_args, "disabled")1254 assert not hasattr(cli_args, "non_passed")1255 assert hasattr(cli_args, "grep")1256def test_make_result_filter_with_only_executed_tests():1257 cli_args = prepare_cli_args([], add_result_filter_cli_args, only_executed_tests=True)1258 filtr = make_result_filter(cli_args, only_executed_tests=True)1259 assert filtr.statuses == {"passed", "failed"}1260def test_make_result_filter_with_only_executed_tests_and_passed():1261 cli_args = prepare_cli_args(["--passed"], add_result_filter_cli_args, only_executed_tests=True)1262 filtr = make_result_filter(cli_args, only_executed_tests=True)1263 assert filtr.statuses == {"passed"}1264def test_make_result_filter_non_passed():1265 cli_args = prepare_cli_args(["--non-passed"], add_result_filter_cli_args)1266 filtr = make_result_filter(cli_args)1267 assert filtr.statuses == {"skipped", "failed"}1268def test_make_result_filter_grep():1269 cli_args = prepare_cli_args(["--grep", "foobar"], add_result_filter_cli_args)1270 filtr = make_result_filter(cli_args)1271 assert filtr.grep1272def test_make_step_filter_passed():1273 cli_args = prepare_cli_args(["--passed"], add_step_filter_cli_args)1274 filtr = make_step_filter(cli_args)...

Full Screen

Full Screen

cli.py

Source:cli.py Github

copy

Full Screen

...19from cryptography.hazmat.primitives import serialization, hashes20from cryptography.hazmat.primitives.serialization import pkcs12, Encoding21logger = logging.getLogger(__name__) 22 23def prepare_cli_args(args):24 cli_args = []25 command = args.command.lower()26 if (args.config_dir): cli_args.extend(['--config-dir',args.config_dir])27 if (args.work_dir): cli_args.extend(['--work-dir',args.work_dir])28 if (args.logs_dir): cli_args.extend(['--logs-dir',args.logs_dir])29 30 if (command == 'cert'): cli_args.extend(['certonly'])31 else: cli_args.extend([command])32 33 if (args.test): cli_args.extend(['--server','https://acme-staging.castle.cloud/acme/directory'])34 else: cli_args.extend(['--server','https://acme.castle.cloud/acme/directory'])35 36 if (args.non_interactive): cli_args.extend(['-n'])37 38 return cli_args39def prepare_config(cli_args): 40 plugins = plugins_disco.PluginsRegistry.find_all()41 cargs = cli.prepare_and_parse_args(plugins, cli_args)42 config = configuration.NamespaceConfig(cargs)43 zope.component.provideUtility(config, interfaces.IConfig)44 return config,plugins45def root_cert_advise():46 root_certs = get_root_ca_certs()47 castle_fingerprints = [48 '1845b9560b38a0ac11494f4cf2b2f372a1a398e11439066ca2734ecc86d67c0e',49 '92966a8d8fbc35cafa320fcf32f805dc7be483e95615df258b8d38eace0cfbb9',50 ]51 fingerprints = list(map(lambda a: a.fingerprint(hashes.SHA256()).hex(), root_certs))52 matches = sum(e in fingerprints for e in castle_fingerprints)53 if (matches == 0):54 text = 'You are requesting a S/MIME certificate to CASTLE ACME server. Remember to add the root certificate into your trust store for proper operation.'55 display_util.notification(text,pause=False)56def request_cert(args, config):57 root_cert_advise()58 key, csr = csr_util.prepare(args.email, config, key_path=args.key_path, usage=args.usage)59 ## Reparse for including --csr arguments60 cli_args = prepare_cli_args(args)61 if (args.dry_run): 62 cli_args.extend(['--dry-run'])63 for email in args.email:64 cli_args.extend(['-d',email])65 cli_args.extend(['--csr',csr.file])66 if (args.imap):67 cli_args.extend(['-a','castle-imap'])68 cli_args.extend(['--castle-imap-login',args.login])69 cli_args.extend(['--castle-imap-password',args.password])70 cli_args.extend(['--castle-imap-host',args.host])71 if (args.port):72 cli_args.extend(['--castle-imap-port',args.port])73 if (args.ssl):74 cli_args.extend(['--castle-imap-ssl'])75 if (args.smtp_method):76 cli_args.extend(['--castle-imap-smtp-method',args.smtp_method])77 if (args.smtp_login):78 cli_args.extend(['--castle-imap-smtp-login',args.smtp_login])79 if (args.smtp_password):80 cli_args.extend(['--castle-imap-smtp-password',args.smtp_password])81 cli_args.extend(['--castle-imap-smtp-host',args.smtp_host])82 if (args.smtp_port):83 cli_args.extend(['--castle-imap-smtp-port',args.smtp_port])84 elif (args.outlook):85 cli_args.extend(['-a','castle-mapi'])86 cli_args.extend(['--castle-mapi-account',args.outlook_account])87 else:88 cli_args.extend(['-a','castle-interactive'])89 cli_args.extend(['-i','castle-installer'])90 if (args.no_passphrase):91 cli_args.extend(['--castle-installer-no-passphrase'])92 elif (args.passphrase):93 cli_args.extend(['--castle-installer-passphrase',args.passphrase])94 cli_args.extend(['-m',args.contact])95 if (args.agree_tos): 96 cli_args.extend(['--agree-tos'])97 config,plugins = prepare_config(cli_args)98 99 config.cert_path = config.live_dir+'/cert.pem'100 config.chain_path = config.live_dir+'/ca.pem'101 config.fullchain_path = config.live_dir+'/chain.pem'102 103 config.key_path = key.file104 try:105 # installers are used in auth mode to determine domain names106 installer, auth = plug_sel.choose_configurator_plugins(config, plugins, "certonly")107 except errors.PluginSelectionError as e:108 logger.info("Could not choose appropriate plugin: %s", e)109 raise110 le_client = certbot_main._init_le_client(config, auth, installer)111 cert_path, chain_path, fullchain_path = certbot_main._csr_get_and_save_cert(config, le_client)112 config.cert_path = cert_path113 config.fullchain_path = fullchain_path114 config.chain_path = chain_path115 certbot_main._csr_report_new_cert(config, cert_path, chain_path, fullchain_path)116 if (not config.dry_run):117 certbot_main._install_cert(config, le_client, args.email)118 else:119 util.safely_remove(csr.file)120 121def try_open_p12(file,passphrase=None):122 with open(args.cert_path,'rb') as p12:123 (private_key, certificate, _) = pkcs12.load_key_and_certificates(p12.read(),passphrase)124 temp_cert = tempfile.NamedTemporaryFile(delete=False)125 temp_cert.write(certificate.public_bytes(Encoding.PEM))126 temp_cert.close()127 temp_pkey = tempfile.NamedTemporaryFile(delete=False)128 temp_pkey.write(private_key.private_bytes(encoding=Encoding.PEM,format=serialization.PrivateFormat.PKCS8,encryption_algorithm=serialization.NoEncryption()))129 temp_pkey.close()130 return temp_pkey.name,temp_cert.name131 return None,None132 133def revoke_cert(args, config):134 cli_args = prepare_cli_args(args)135 if (args.reason):136 cli_args.extend(['--reason',args.reason])137 cli_args.extend(['--no-delete-after-revoke'])138 key_path,cert_path = None,None139 try:140 key_path,cert_path = try_open_p12(args.cert_path)141 cli_args.extend(['--cert-path',cert_path])142 cli_args.extend(['--key-path',key_path])143 except ValueError as e: 144 if ('Invalid password' in str(e)):145 passphrase = None146 if (args.passphrase):147 passphrase = args.passphrase.encode('utf-8')148 else:149 text = 'Introduce the passphrase of the PKCS12 file.'150 display_util.notification(text,pause=False)151 pf = getpass.getpass('Enter passphrase: ')152 passphrase = pf.encode('utf-8')153 try:154 key_path,cert_path = try_open_p12(args.cert_path,passphrase=passphrase)155 cli_args.extend(['--cert-path',cert_path])156 cli_args.extend(['--key-path',key_path])157 except ValueError as e:158 if ('Invalid password' in str(e)):159 raise e160 elif ('Could not deserialize'): #pem161 if (args.cert_path):162 cli_args.extend(['--cert-path',args.cert_path])163 if (args.key_path):164 cli_args.extend(['--key-path',args.key_path])165 config,plugins = prepare_config(cli_args)166 certbot_main.revoke(config,plugins)167 if (key_path):168 os.unlink(key_path)169 if (cert_path):170 os.unlink(cert_path)171 172def main(args):173 ## Prepare storage system174 command = args.command.lower()175 log.pre_arg_parse_setup()176 cli_args = prepare_cli_args(args)177 config,_ = prepare_config(cli_args)178 misc.raise_for_non_administrative_windows_rights()179 try:180 log.post_arg_parse_setup(config)181 certbot_main.make_or_verify_needed_dirs(config)182 except errors.Error:183 raise184 report = reporter.Reporter(config)185 zope.component.provideUtility(report, interfaces.IReporter)186 util.atexit_register(report.print_messages)187 with certbot_main.make_displayer(config) as displayer:188 display_obj.set_display(displayer)189 if (command == 'cert'):190 request_cert(args, config)...

Full Screen

Full Screen

__init__.py

Source:__init__.py Github

copy

Full Screen

...42 self.title = title43 self.description = description44 self.version = version45 self.args = []46 self.parser, self.parser_required, self.parser_optional = Commandr.prepare_cli_args()47 def to_dict(self):48 return dict(name=self.name, title=self.title, description=self.description, version=self.version, schema_version=self.schema_version(), args=[a.to_dict() for a in self.args])49 def save(self, path):50 save_cfg(path, self.to_dict())51 @staticmethod52 def load(path):53 cfg = load_cfg(path)54 c = Commandr(cfg["name"], title=cfg.get("title"), description=cfg.get("description"), version=cfg.get("version"))55 for arg in cfg["args"]:56 c.add_argument(arg["name"], arg["cli"], type=arg.get("type"), required=arg.get("required"), default=arg.get("default"), env=arg.get("env"), loadconfig=arg.get("loadconfig"), help=arg.get("help"), format=arg.get("format"))57 return c58 def add_argument(self, name, cli, type=None, required=False, default=None, env=None, loadconfig=None, help=None, format=None):59 if required and (default is not None):60 raise Exception(f"{name}: Required args cannot have default values!")61 if type == "datetime" and (format is None):62 raise Exception(f"{name}: Datetime fields must have format specified!")63 arg = CommandrArg(name, cli, type=type, required=required, default=default, env=env, loadconfig=loadconfig, help=help, format=format)64 self.args.append(arg)65 # add to argparse...66 cli = arg.cli.split("|")67 type = arg.type or'str'68 basictype = type_by_name(type)69 target = self.parser_required if arg.required else self.parser_optional70 if type == "switch":71 target.add_argument(*cli, dest=arg.name, help=arg.help, action='store_true')72 else:73 target.add_argument(*cli, dest=arg.name, help=arg.help, type=basictype)74 def schema_version(self):75 return "1.0"76 def parse(self, args=sys.argv[1:], verbose=False, include_source=False):77 args = self.parser.parse_args()78 args_dict = vars(args)79 out = {}80 configs = {}81 for arg in self.args:82 name = arg.name83 required = arg.required84 cli_val = args_dict.get(name)85 if arg.type == 'bool':86 cli_val = val_to_bool(cli_val)87 default_val = arg.default88 env_val = os.getenv(arg.env) if arg.env else None89 if arg.type in ["switch", "bool"] and arg.env:90 env_val = val_to_bool(env_val)91 if verbose:92 print(f"{name}:")93 print(f" CLI='{cli_val}' ENV='{env_val}' DEF='{default_val}' REQ={required} LCFG={arg.loadconfig}")94 source = None95 used_value = cli_val96 if (used_value is None) or ((arg.type == "switch") and arg.env and used_value == False):97 used_value = env_val98 if used_value is None:99 used_value = default_val100 if used_value is None:101 if arg.required:102 # raise Exception(f"{name} is required argument, but it is not provided!")103 self.parser.print_help(sys.stderr)104 sys.exit(1)105 source = None106 else:107 source = "DEF"108 else:109 source = "ENV"110 else:111 source = "CLI"112 if arg.type == "datetime" and used_value is not None:113 used_value = val_to_date(used_value, arg.format)114 if arg.loadconfig:115 # the value will be used as path to config file116 configs[name] = load_cfg(used_value)117 if verbose:118 print(f" source={source} value={used_value}")119 if include_source:120 out[name] = dict(source=source, value=used_value)121 else:122 out[name] = used_value123 self.validate(out)124 return out, configs125 126 def validate(self, out):127 #print("Validating parsed params:", out)128 for arg in self.args:129 name = arg.name130 val = out[name]131 #print(" Validating:", val, arg)132 @staticmethod133 def prepare_cli_args():134 parser = argparse.ArgumentParser()135 optional = parser._action_groups.pop()136 required = parser.add_argument_group('required arguments')137 parser._action_groups.append(optional)...

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