Best Python code snippet using autotest_python
clipper_test.cfg.py
Source:clipper_test.cfg.py
1import shlex2from shipyard import Action, CIPrettyLogAction, ctx3UNITTESTS = {4 "libclipper": "/clipper/bin/run_unittests.sh --libclipper",5 "management": "/clipper/bin/run_unittests.sh --management",6 "frontend": "/clipper/bin/run_unittests.sh --frontend",7 # JVM and R containers are not maintained.8 # "jvm": "/clipper/bin/run_unittests.sh --jvm-container",9 # "r_container": "/clipper/bin/run_unittests.sh --r-container",10 "rpc_container": "/clipper/bin/run_unittests.sh --rpc-container",11}12DOCKER_INTEGRATION_TESTS = {13 "admin_unit_test": "python /clipper/integration-tests/clipper_admin_tests.py",14 "many_apps_many_models": "python /clipper/integration-tests/many_apps_many_models.py",15 "pyspark": "python /clipper/integration-tests/deploy_pyspark_models.py",16 "pyspark_pipeline": "python /clipper/integration-tests/deploy_pyspark_pipeline_models.py",17 "pysparkml": "python /clipper/integration-tests/deploy_pyspark_sparkml_models.py",18 "tensorflow": "python /clipper/integration-tests/deploy_tensorflow_models.py",19 "mxnet": "python /clipper/integration-tests/deploy_mxnet_models.py",20 "pytorch": "python /clipper/integration-tests/deploy_pytorch_models.py",21 "keras": "python /clipper/integration-tests/deploy_keras_models.py",22 "multi_tenancy": "python /clipper/integration-tests/multi_tenancy_test.py",23 # "rclipper": "/clipper/integration-tests/r_integration_test/rclipper_test.sh",24 "docker_metric": "python /clipper/integration-tests/clipper_metric_docker.py",25 "fluentd": "python /clipper/integration-tests/clipper_fluentd_logging_docker.py"26}27NUM_RETRIES = 228NUM_RETRIES_BASH = "{1.." + str(NUM_RETRIES) + "}"29def generate_test_command(python_version, test_to_run):30 assert python_version in ["2.7", "3.6", "3.7"]31 if python_version == "2.7":32 image = "unittests"33 elif python_version == "3.6":34 image = "py36tests"35 else:36 image = "py37tests"37 # CLIPPER_TESTING_DOCKERHUB_PASSWORD should be already in the environment38 command = f"""39 python ./bin/retry_with_timeout.py --retry 1 --timeout 40m -- \40 docker run --rm --network=host -v /var/run/docker.sock:/var/run/docker.sock -v /tmp:/tmp \41 -e CLIPPER_REGISTRY={ctx['namespace']} \42 -e CLIPPER_TESTING_DOCKERHUB_PASSWORD=$CLIPPER_TESTING_DOCKERHUB_PASSWORD \43 {ctx['namespace']}/{image}:{ctx['sha_tag']} \44 \"{test_to_run}\" 45 """.strip(46 "\n"47 )48 return command49# Create make targets for both50for name, test_to_run in UNITTESTS.items():51 CIPrettyLogAction(52 name=f"unittest_py2_{name}",53 command=generate_test_command("2.7", test_to_run),54 tags="unittest_py2",55 )56 CIPrettyLogAction(57 name=f"unittest_py36_{name}",58 command=generate_test_command("3.6", test_to_run),59 tags="unittest_py36",60 )61 CIPrettyLogAction(62 name=f"unittest_py37_{name}",63 command=generate_test_command("3.6", test_to_run),64 tags="unittest_py37",65 )66for name, test_to_run in DOCKER_INTEGRATION_TESTS.items():67 CIPrettyLogAction(68 name=f"integration_py2_{name}",69 command=generate_test_command("2.7", test_to_run),70 tags="integration_py2",71 )72 CIPrettyLogAction(73 name=f"integration_py36_{name}",74 command=generate_test_command("3.6", test_to_run),75 tags="integration_py36",76 )77 CIPrettyLogAction(78 name=f"integration_py37_{name}",79 command=generate_test_command("3.7", test_to_run),80 tags="integration_py37",81 )82# Specify specific dependencies...
teststdlibunittests.py
Source:teststdlibunittests.py
...2526elapsed_time = stacklesslib.main.elapsed_time272829def run_unittests():30 from test import test_socket31 from test import test_urllib32 from test import test_urllib233 from test import test_xmlrpc3435 print "** run_unittests.test_socket"36 test_socket.test_main()37 print "** run_unittests.test_urllib"38 test_urllib.test_main()39 print "** run_unittests.test_urllib2"40 test_urllib2.test_main()41 print "** run_unittests.test_xmlrpc"42 test_xmlrpc.test_main()43 print "** run_unittests - done"
...
patch-run__unittests.py
Source:patch-run__unittests.py
1https://github.com/mesonbuild/meson/pull/43242--- run_unittests.py.orig 2019-10-06 17:01:35 UTC3+++ run_unittests.py4@@ -5680,7 +5703,7 @@ c = ['{0}']5 # Test that installed libraries works6 self.new_builddir()7 self.prefix = oldprefix8- meson_args = ['-Dc_link_args=-L{}'.format(libdir),9+ meson_args = ['-Dc_link_args=-L{} -Wl,-rpath,{}'.format(libdir, libdir),10 '--fatal-meson-warnings']11 testdir = os.path.join(self.unit_test_dir, '69 static link')...
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!!