How to use register_tests method in Lemoncheesecake

Best Python code snippet using lemoncheesecake

test_natural.py

Source:test_natural.py Github

copy

Full Screen

...173 objs = list(serializers.deserialize(format, string_data))174 self.assertEqual(len(objs), 1)175 self.assertEqual(objs[0].object.pk, obj.pk)176# Dynamically register tests for each serializer177register_tests(NaturalKeySerializerTests, 'test_%s_natural_key_serializer', natural_key_serializer_test)178register_tests(NaturalKeySerializerTests, 'test_%s_serializer_natural_keys', natural_key_test)179register_tests(NaturalKeySerializerTests, 'test_%s_serializer_natural_pks_mti', natural_pk_mti_test)180register_tests(NaturalKeySerializerTests, 'test_%s_forward_references_fks', forward_ref_fk_test)181register_tests(NaturalKeySerializerTests, 'test_%s_forward_references_fk_errors', forward_ref_fk_with_error_test)182register_tests(NaturalKeySerializerTests, 'test_%s_forward_references_m2ms', forward_ref_m2m_test)183register_tests(NaturalKeySerializerTests, 'test_%s_forward_references_m2m_errors', forward_ref_m2m_with_error_test)...

Full Screen

Full Screen

aunit_extras_tools.py

Source:aunit_extras_tools.py Github

copy

Full Screen

1#2import re3import gps_utils4from os.path import *5import GPS6def ada2filename(name):7 return name.lower().replace(".", "-")8REGISTRATIONS_TEMPLATE = """ Register_Routine (Test, %(name)s'Unrestricted_Access, "%(name)s");"""9REGISTER_TESTS_TEMPLATE = """-- begin read only10separate (%(package_name)s)11overriding procedure Register_Tests (Test : in out Test_Case) is12 use AUnit.Test_Cases.Registration;13begin14%(registrations)s15end Register_Tests;16-- end read only"""17matcher = re.compile("(" +18 "procedure\s+(\w+)\s*\(\s*\w+\s*:\s*in\s*out\s*AUnit.Test_Cases.Test_Case'Class\)\s*is" +19 "|" + "package\s*body\s*(\S+)\s*is" +20 "|" + "(overriding\s+|)procedure\s+Register_Tests\s*\(\S+\s*:\s*in\s+out\s+Test_Case\)\s*is\s+separate\s*;" +21 ")", re.I)22def on_file_saved(hook_name, f):23 path = f.name()24 folder = dirname(path)25 testRoutines = []26 UnitName = None27 shall_generate = False28 if (splitext(path)[1] != ".adb") and ("test" not in path):29 return30 with open(path) as inf:31 for line in inf:32 matches = matcher.match(line.strip())33 if matches:34 if matches.group(2):35 testRoutines.append(matches.group(2))36 elif matches.group(3):37 UnitName = matches.group(3)38 elif matches.group(4):39 shall_generate = True40 if shall_generate and UnitName and testRoutines:41 register_name = UnitName + ".Register_Tests"42 registrations = []43 for name in testRoutines:44 registrations.append(REGISTRATIONS_TEMPLATE % {"name": name})45 out_path = join(folder, ada2filename(register_name)) + ".adb"46 with open(out_path, "w") as outf:47 outf.write(REGISTER_TESTS_TEMPLATE % {"package_name": UnitName,48 "registrations": "\n".join(registrations)})...

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