Best Python code snippet using slash
test_main.py
Source:test_main.py
...44 return self._new_err.getvalue()45class Test(unittest.TestCase):46 def test_no_args(self):47 with self.assertRaises(SystemExit) as cp:48 main_entry_point()49 self.assertEqual(cp.exception.code, 2)50 def test_help(self):51 with self.assertRaises(SystemExit) as cp:52 main_entry_point(["-h"])53 self.assertEqual(cp.exception.code, 0)54 def test_path(self):55 os.chdir(Path(__file__).parent)56 main_entry_point(["path"])57class TempCwd:58 """Context manager that creates temp directory and makes it the current59 working directory until exit."""60 def __init__(self):61 self.prev_cwd: Optional[str] = None62 self.temp_dir: Optional[str] = None63 def __enter__(self):64 self.prev_cwd = os.getcwd()65 self.temp_dir = tempfile.mkdtemp()66 os.chdir(self.temp_dir)67 def __exit__(self, exc_type, exc_val, exc_tb):68 os.chdir(self.prev_cwd)69 shutil.rmtree(self.temp_dir)70class TestsInsideTempProjectDir(unittest.TestCase):71 def setUp(self):72 self._old_cwd = Path.cwd()73 # âself._td = TemporaryDirectory()74 self._temp_dir = tempfile.mkdtemp()75 self.svetDir = Path(self._temp_dir) / "svetdir"76 self.projectDir = Path(self._temp_dir) / "project"77 self.projectDir.mkdir()78 self.svetDir.mkdir()79 # creating two empty packages: pkg and pkg.sub80 self.project_pkg = self.projectDir / "pkg"81 self.project_pkg_sub = self.project_pkg / "sub"82 self.project_pkg_sub.mkdir(parents=True)83 (self.project_pkg_sub / "__init__.py").touch()84 (self.project_pkg / "__init__.py").touch()85 self.json_report_file: Optional[Path] = None86 os.chdir(self.projectDir)87 self.expectedVenvDir = self.svetDir / "project_venv"88 self.expectedVenvBinPosix = self.expectedVenvDir / "bin" / "python"89 self.expectedVenvBinWindows = self.expectedVenvDir / "Scripts" / "python.exe"90 os.environ["VIENDIR"] = str(self.svetDir.absolute())91 def tearDown(self):92 # moving out of project dir to stop "using" the _temp_dir93 os.chdir(self._old_cwd)94 # VIENDIR was assigned in setUp95 del os.environ["VIENDIR"]96 try:97 shutil.rmtree(self._temp_dir)98 except PermissionError as e:99 # PermissionError: [WinError 32] The process cannot access100 # the file because it is being used by another process:101 # C:\\Users\\RUNNER~1\\AppData\\Local\\Temp\\tmpzl8g6j0u\\project102 assert "WinError" in str(e)103 # It seems the reason for this exception was the CWD in _temp_dir.104 # But anyway I'll try to ignore it if it's possible105 def assertInVenv(self, inner: Path):106 inner_str = str(inner.absolute())107 outer_str = str(self.expectedVenvDir.absolute())108 # macOS weirdness109 inner_str = inner_str.replace("/private/var", "/var")110 outer_str = outer_str.replace("/private/var", "/var")111 if (os.path.commonpath([outer_str]) != os.path.commonpath(112 [outer_str, inner_str])):113 # if not (len(inner_str) > len(outer_str)114 # and inner_str.startswith(outer_str)):115 self.fail(f"{inner_str} is not in {outer_str}")116 def assertVenvBinExists(self):117 self.assertTrue(118 self.expectedVenvBinPosix.exists() or self.expectedVenvBinWindows.exists())119 def assertVenvBinNotExists(self):120 self.assertFalse(121 self.expectedVenvBinPosix.exists() or self.expectedVenvBinWindows.exists())122 def assertProjectDirIsNotCwd(self):123 basename = "marker"124 in_cwd = Path.cwd() / basename125 in_project = self.projectDir / basename126 self.assertFalse(in_cwd.exists())127 self.assertFalse(in_project.exists())128 in_cwd.touch()129 self.assertTrue(in_cwd.exists())130 self.assertFalse(in_project.exists())131 def assertVenvNotExists(self):132 self.assertFalse(self.expectedVenvDir.exists())133 self.assertVenvBinNotExists()134 def assertVenvExists(self):135 self.assertTrue(self.expectedVenvDir.exists())136 self.assertVenvBinExists()137 def assertIsErrorExit(self, exc: SystemExit):138 self.assertIsInstance(exc, SystemExit)139 self.assertTrue(exc.code is not None and exc.code != 0)140 def assertIsSuccessExit(self, exc: SystemExit):141 self.assertIsInstance(exc, SystemExit)142 self.assertTrue(exc.code is None or exc.code == 0)143 def write_reporting_program(self, py_file_path: Path) -> Path:144 self.json_report_file = py_file_path.parent / 'output.json'145 out_file_path_str = repr(str(self.json_report_file))146 code = "import pathlib, sys, json\n" \147 "d={'sys.path': sys.path, \n" \148 " 'sys.executable': sys.executable, \n" \149 " 'sys.argv': sys.argv\n" \150 "}\n" \151 "js=json.dumps(d)\n" \152 f"file=pathlib.Path({out_file_path_str})\n" \153 'file.write_text(js, encoding="utf-8")'154 py_file_path.write_text(code, encoding='utf-8')155 assert not self.json_report_file.exists()156 return self.json_report_file157 @property158 def report_exists(self) -> bool:159 return self.json_report_file is not None and \160 self.json_report_file.exists()161 @property162 def reported_syspath(self) -> List[str]:163 assert self.json_report_file is not None164 d = json.loads(self.json_report_file.read_text(encoding="utf-8"))165 return d["sys.path"]166 @property167 def reported_executable(self) -> Path:168 assert self.json_report_file is not None169 d = json.loads(self.json_report_file.read_text(encoding="utf-8"))170 return Path(d["sys.executable"])171 @property172 def reported_argv(self) -> List[str]:173 assert self.json_report_file is not None174 d = json.loads(self.json_report_file.read_text(encoding="utf-8"))175 return d["sys.argv"]176 ############################################################################177 def test_create_with_argument(self):178 # actually this is not a good test: we are not testing whether179 # argument is really used and not ignored180 self.assertVenvNotExists()181 main_entry_point(["create", sys.executable])182 self.assertVenvExists()183 def test_create_fails_with_unresolvable_argument(self):184 # actually this is not a good test: we are not testing whether185 # argument is really used and not ignored186 self.assertVenvNotExists()187 with self.assertRaises(CannotFindExecutableExit) as ce:188 main_entry_point(["create", "labuda-ladeda-hehe"])189 self.assertIsErrorExit(ce.exception)190 self.assertVenvNotExists()191 def test_create_without_argument(self):192 self.assertVenvNotExists()193 main_entry_point(["create"])194 self.assertVenvExists()195 def test_create_fails_if_twice(self):196 main_entry_point(["create"])197 with self.assertRaises(VenvExistsExit) as ce:198 main_entry_point(["create"])199 self.assertIsErrorExit(ce.exception)200 @unittest.skipUnless(is_posix, "not sure what to resolve in windows")201 def test_create_resolves_python3(self):202 self.assertVenvNotExists()203 main_entry_point(["create", "python3"])204 self.assertVenvExists()205 ############################################################################206 def test_create_then_delete(self):207 self.assertVenvNotExists()208 main_entry_point(["create"])209 self.assertVenvExists()210 main_entry_point(["delete"])211 self.assertVenvNotExists()212 def test_delete_fails_if_not_exists(self):213 self.assertVenvNotExists()214 with self.assertRaises(VenvDoesNotExistExit) as cm:215 main_entry_point(["delete"])216 self.assertIsErrorExit(cm.exception)217 ############################################################################218 def test_recreate_without_argument(self):219 self.assertVenvNotExists()220 main_entry_point(["recreate"])221 self.assertVenvExists()222 def test_recreate_with_argument(self):223 self.assertVenvNotExists()224 main_entry_point(["create", sys.executable])225 self.assertTrue(self.expectedVenvDir.exists())226 if self.expectedVenvBinWindows.exists():227 os.remove(self.expectedVenvBinWindows)228 elif self.expectedVenvBinPosix.exists():229 os.remove(self.expectedVenvBinPosix)230 else:231 raise AssertionError("executable not found")232 self.assertVenvBinNotExists()233 main_entry_point(["recreate", sys.executable])234 self.assertVenvBinExists()235 main_entry_point(["recreate", sys.executable])236 self.assertVenvBinExists()237 def test_recreate_fails_with_unresolvable_argument(self):238 # actually this is not a good test: we are not testing whether239 # argument is really used and not ignored240 self.assertVenvNotExists()241 with self.assertRaises(CannotFindExecutableExit) as ce:242 main_entry_point(["recreate", "labuda-ladeda-hehe"])243 self.assertIsErrorExit(ce.exception)244 self.assertVenvNotExists()245 @unittest.skipUnless(is_posix, "not sure what to resolve in windows")246 def test_recreate_resolves_python3(self):247 self.assertVenvNotExists()248 main_entry_point(["recreate", "python3"])249 self.assertVenvExists()250 ############################################################################251 @unittest.skipUnless(is_windows, "testing windows limitations")252 def test_run_missing_in_windows(self):253 with self.assertRaises(SystemExit) as cm:254 main_entry_point(["run", "python", "-c", "pass"])255 self.assertEqual(cm.exception.code, 2)256 @unittest.skipUnless(is_posix, "not POSIX")257 def test_run_needs_venv(self):258 with self.assertRaises(VenvDoesNotExistExit) as cm:259 main_entry_point(windows_too(["run", "python", "-c", "pass"]))260 self.assertIsErrorExit(cm.exception)261 @unittest.skipUnless(is_posix, "not POSIX")262 def test_run_exit_code_0(self):263 """Test that main_entry_point returns the same exit code,264 as the called command"""265 main_entry_point(["create"]) # need venv to run266 with self.assertRaises(ChildExit) as ce:267 main_entry_point(windows_too(["run", "python3", "-c", "exit(0)"]))268 self.assertEqual(ce.exception.code, 0)269 @unittest.skipUnless(is_posix, "not POSIX")270 def test_run_exit_code_1(self):271 """Test that main_entry_point returns the same exit code,272 as the called command"""273 main_entry_point(["create"]) # need venv to run274 with self.assertRaises(ChildExit) as ce:275 main_entry_point(windows_too(["run", "python3", "-c", "exit(1)"]))276 self.assertEqual(ce.exception.code, 1)277 @unittest.skipUnless(is_posix, "not POSIX")278 def test_run_exit_code_2(self):279 """Test that main_entry_point returns the same exit code,280 as the called command"""281 main_entry_point(["create"]) # need venv to run282 with self.assertRaises(ChildExit) as ce:283 main_entry_point(windows_too(["run", "python3", "-c", "exit(2)"]))284 self.assertEqual(ce.exception.code, 2)285 @unittest.skipUnless(is_posix, "not POSIX")286 def test_run_python_version(self):287 main_entry_point(["create"])288 with self.assertRaises(ChildExit):289 # just check the argparser handles --version properly290 # (was failing with nargs='*', ok with nargs=argparse.REMAINDER)291 main_entry_point(windows_too(["run", "python3", "--version"]))292 def _run_and_check(self, args: List[str], expected_exit_code=0):293 with self.assertRaises(ChildExit) as ce:294 main_entry_point(args)295 self.assertEqual(ce.exception.code, expected_exit_code)296 @unittest.skipUnless(is_posix, "not POSIX")297 def test_run_p(self):298 """Checking the -p changes both venv directory and the first item299 in PYTHONPATH"""300 main_entry_point(["create"])301 with TemporaryDirectory() as temp_cwd:302 # we will run it NOT from the project dir as CWD303 os.chdir(temp_cwd)304 # creating .py file to run305 code_py = Path(temp_cwd) / "code.py"306 self.write_reporting_program(code_py)307 # running the code that will create a json file308 self.assertProjectDirIsNotCwd()309 self._run_and_check(310 ["-p", str(self.projectDir.absolute()),311 "run", "python3", str(code_py)])312 self.assertInVenv(self.reported_executable)313 self.assertIn(str(self.projectDir.absolute()),314 self.reported_syspath)315 @unittest.skipUnless(is_posix, "not POSIX")316 def test_run_python_code(self):317 """Testing vien run python3 -c '...'"""318 main_entry_point(["create"])319 file_to_be_created = self.projectDir / "hello.txt"320 self.assertFalse(file_to_be_created.exists())321 # we'll ask the python residing inside the virtualenv to create a text322 # file and write the path to interpreter in it323 python_program = f"""324 import os, sys325 from pathlib import Path326 Path({repr(str(file_to_be_created))}).write_text(sys.executable)327 """328 lines = [line.strip() for line in python_program.splitlines()]329 python_program = "; ".join(line for line in lines if line)330 with self.assertRaises(SystemExit) as ce:331 main_entry_point(["run", "python3", "-c", python_program])332 self.assertIsSuccessExit(ce.exception)333 # check the file created (it means, the command was executed)334 self.assertTrue(file_to_be_created.exists())335 # the file should contain the path or the python interpreter that336 # executed it in virtualenv337 interpreter_path = Path(file_to_be_created.read_text())338 self.assertTrue("svetdir" in interpreter_path.parts)339 self.assertTrue("project_venv" in interpreter_path.parts)340 ## CALL ####################################################################341 def test_call_needs_venv(self):342 """File exists, but venv does not exist"""343 runme_py = self.projectDir / "runme.py"344 runme_py.touch()345 with self.assertRaises(VenvDoesNotExistExit) as ce:346 main_entry_point(["call", str(runme_py)])347 self.assertIsErrorExit(ce.exception)348 def test_call_nonexistent_file(self):349 main_entry_point(["create"])350 with self.assertRaises(PyFileNotFoundExit) as ce:351 main_entry_point(["call", "nonexistent.py"])352 self.assertIsErrorExit(ce.exception)353 def _call_for_exit_code(self, exit_code: int):354 (self.projectDir / "main.py").write_text(f"exit({exit_code})")355 main_entry_point(["create"])356 with self.assertRaises(SystemExit) as ce:357 main_entry_point(["call", "main.py"])358 self.assertEqual(ce.exception.code, exit_code)359 def test_call_42(self):360 """Calling a temporary .py script that must return 42.361 Testing whether it runs and whether we get correct exit code."""362 self._call_for_exit_code(42)363 def test_call_23(self):364 """Calling a temporary .py script that must return 23.365 Testing whether it runs and whether we get correct exit code."""366 self._call_for_exit_code(23)367 def test_call_file_as_module(self):368 main_entry_point(["create"])369 # creating pkg/sub/module.py370 file_py = self.project_pkg_sub / "module.py"371 self.write_reporting_program(file_py)372 self.assertFalse(self.report_exists)373 # running from random CWD374 with TempCwd():375 self.assertProjectDirIsNotCwd()376 self._run_and_check(377 ["-p", str(self.projectDir.absolute()),378 "call", "-m", str(file_py.absolute())])379 self.assertTrue(self.report_exists)380 self.assertInVenv(self.reported_executable)381 self.assertIn(str(self.projectDir.absolute()),382 self.reported_syspath)383 def test_call_file_as_file(self):384 main_entry_point(["create"])385 # creating pkg/sub/module.py386 file_py = self.project_pkg_sub / "module.py"387 self.write_reporting_program(file_py)388 self.assertFalse(self.report_exists)389 # running from random CWD390 with TempCwd():391 self.assertProjectDirIsNotCwd()392 self._run_and_check(393 ["-p", str(self.projectDir.absolute()),394 "call", str(file_py.absolute())]) # no -m395 self.assertTrue(self.report_exists)396 self.assertInVenv(self.reported_executable)397 self.assertIn(str(self.projectDir.absolute()),398 self.reported_syspath)399 def test_call_parameters(self):400 """Testing that call really passes parameters to child."""401 main_entry_point(["create"])402 self.write_reporting_program(self.projectDir/"file.py")403 self.assertFalse(self.report_exists)404 self._run_and_check(["call", "file.py", "hello", "program"])405 self.assertTrue(self.report_exists)406 self.assertEqual(self.reported_argv[-2], "hello")407 self.assertEqual(self.reported_argv[-1], "program")408 # main_entry_point(["create"])409 # (self.projectDir / "main.py").write_text(410 # f"import sys; exit(len(sys.argv))")411 #412 # with self.assertRaises(ChildExit) as ce:413 # main_entry_point(["call", "main.py"])414 # self.assertEqual(ce.exception.code, 1) # received len(argv)415 #416 # with self.assertRaises(ChildExit) as ce:417 # main_entry_point(["call", "main.py", "aaa", "bbb", "ccc"])418 # self.assertEqual(ce.exception.code, 4) # received len(argv)419 def test_call_project_dir_venv(self):420 """Tests that the -p parameter actually changes the project directory,421 so the correct virtual environment is found."""422 main_entry_point(["create"])423 pkg_dir = self.projectDir / "subpkg"424 pkg_dir.mkdir()425 (pkg_dir / "__init__.py").touch()426 run_py = (pkg_dir / "run.py")427 run_py.write_text("exit(5)")428 run_py_str = str(run_py.absolute())429 with TemporaryDirectory() as td:430 try:431 os.chdir(td)432 # NORMAL format433 # this call specifies project dir relative to run.py.434 # It runs the file successfully435 with self.assertRaises(ChildExit) as ce:436 main_entry_point(["-p", "..", "call", run_py_str])437 self.assertEqual(ce.exception.code, 5)438 # this call specifies project dir relative to run.py.439 # It runs the file successfully440 with self.assertRaises(ChildExit) as ce:441 main_entry_point(442 ["--project-dir", "..", "call", run_py_str])443 self.assertEqual(ce.exception.code, 5)444 # OUTDATED format445 # this call specifies project dir relative to run.py.446 # It runs the file successfully447 with self.assertRaises(ChildExit) as ce:448 main_entry_point(["call", "-p", "..", run_py_str])449 self.assertEqual(ce.exception.code, 5)450 # this call specifies project dir relative to run.py.451 # It runs the file successfully452 with self.assertRaises(ChildExit) as ce:453 main_entry_point(454 ["call", "--project-dir", "..", run_py_str])455 self.assertEqual(ce.exception.code, 5)456 # ERRORS457 # without -p we assume that the current dir is the project dir,458 # but the current is temp. So we must get an exception459 with self.assertRaises(VenvDoesNotExistExit):460 main_entry_point(["call", run_py_str])461 # this call specifies INCORRECT project dir relative to run.py462 with self.assertRaises(VenvDoesNotExistExit):463 main_entry_point(464 ["call", "--project-dir", "../..", run_py_str])465 finally:466 os.chdir(self._old_cwd) # to safely delete the temp dir467 def test_call_project_dir_relative_imports(self):468 """ Tests that modules are importable from the project dir469 set by -p parameter"""470 main_entry_point(["create"])471 pkg_dir = self.projectDir / "subpkg"472 pkg_dir.mkdir()473 (pkg_dir / "__init__.py").touch()474 (pkg_dir / "constant.py").write_text("FIFTY_FIVE=55")475 run_py = (pkg_dir / "run.py")476 # thanks to modified PYTHONPATH, the following must work477 run_py.write_text("import subpkg.constant\n"478 "exit(subpkg.constant.FIFTY_FIVE)")479 run_py_str = str(run_py.absolute())480 with TemporaryDirectory() as td:481 try:482 os.chdir(td)483 with self.assertRaises(ChildExit) as ce:484 main_entry_point(["-p", "..", "call", run_py_str])485 self.assertEqual(ce.exception.code, 55)486 finally:487 os.chdir(self._old_cwd) # to safely delete the temp dir488 ############################################################################489 @unittest.skipUnless(is_windows, "testing windows limitations")490 def test_shell_missing_in_windows(self):491 with self.assertRaises(SystemExit) as cm:492 main_entry_point(["run", "shell"])493 self.assertEqual(cm.exception.code, 2)494 @unittest.skipUnless(is_posix, "not POSIX")495 def test_shell_p(self):496 """Checking the -p changes both venv directory and the first item497 in PYTHONPATH"""498 main_entry_point(["create"])499 with TemporaryDirectory() as temp_cwd:500 # we will run it NOT from the project dir as CWD501 os.chdir(temp_cwd)502 # creating .py file to run503 code_py = Path(temp_cwd) / "code.py"504 output_file = self.write_reporting_program(code_py)505 # running the code that will create a json file506 self.assertProjectDirIsNotCwd()507 with self.assertRaises(ChildExit) as ce:508 main_entry_point(509 ["-p", str(self.projectDir.absolute()),510 "shell", "--input",511 f'python3 "{code_py}"'])512 self.assertEqual(ce.exception.code, 0)513 # loading json and checking the values514 d = json.loads(output_file.read_text())515 self.assertIn(str(self.projectDir.absolute()), d["sys.path"])516 self.assertInVenv(Path(d["sys.executable"]))517 @unittest.skipUnless(is_posix, "not POSIX")518 def test_shell_fails_if_not_exist(self):519 self.assertVenvNotExists()520 with self.assertRaises(VenvDoesNotExistExit) as cm:521 main_entry_point(["shell"])522 self.assertIsErrorExit(cm.exception)523 @unittest.skipUnless(is_posix, "not POSIX")524 def test_shell_ok(self):525 main_entry_point(["create"])526 with TemporaryDirectory() as td:527 dir_to_create = Path(td) / "to_be_or_not_to_be"528 self.assertFalse(dir_to_create.exists())529 dir_to_create_quoted = repr(str(dir_to_create))530 bash_input = f'mkdir {dir_to_create_quoted}\n'531 # I did not find an easy way to run an interactive sub-shell during532 # testing and then to kill it. Solutions that were based on533 # signal.SIGALRM or the subprocess.run(timeout), were harming the534 # MacOS terminal that started the test535 #536 # So we provide input and delay arguments to the sub-shell. It537 # makes the sub-shell peacefully close itself.538 #539 # It is not a clean test for "shell" though. The "shell" meant to540 # be run without parameters.541 start = timer()542 with TimeLimited(10): # safety net543 with self.assertRaises(ChildExit) as ce:544 main_entry_point(545 ["shell", "--input", bash_input, "--delay", "1"])546 self.assertFalse(ce.exception.code, 0)547 end = timer()548 self.assertGreater(end - start, 0.5)549 self.assertLess(end - start, 3)550 self.assertTrue(dir_to_create.exists())551 @unittest.skipUnless(is_posix, "not POSIX")552 def test_shell_exit_code_non_zero(self):553 main_entry_point(["create"])554 with TimeLimited(10): # safety net555 with self.assertRaises(ChildExit) as ce:556 main_entry_point(["shell", "--input", "exit 42"])557 self.assertEqual(ce.exception.code, 42)558 @unittest.skipUnless(is_posix, "not POSIX")559 def test_shell_exit_code_zero(self):560 main_entry_point(["create"])561 with TimeLimited(10): # safety net562 with self.assertRaises(ChildExit) as ce:563 main_entry_point(["shell", "--input", "exit"])564 self.assertFalse(ce.exception.code, 0)565 @unittest.skipUnless(is_posix, "not POSIX")566 def test_shell_but_no_venv(self):567 with TimeLimited(10): # safety net568 with self.assertRaises(VenvDoesNotExistExit) as cm:569 main_entry_point(["shell"])570if __name__ == "__main__":571 suite = unittest.TestSuite()572 suite.addTest(TestsInsideTempProjectDir("test_shell_p"))...
deployed_code_package_info.py
Source:deployed_code_package_info.py
1# coding=utf-82# --------------------------------------------------------------------------3# Copyright (c) Microsoft Corporation. All rights reserved.4# Licensed under the MIT License. See License.txt in the project root for5# license information.6#7# Code generated by Microsoft (R) AutoRest Code Generator.8# Changes may cause incorrect behavior and will be lost if the code is9# regenerated.10# --------------------------------------------------------------------------11from msrest.serialization import Model12class DeployedCodePackageInfo(Model):13 """Information about code package deployed on a Service Fabric node.14 :param name: The name of the code package.15 :type name: str16 :param version: The version of the code package specified in service17 manifest.18 :type version: str19 :param service_manifest_name: The name of service manifest that specified20 this code package.21 :type service_manifest_name: str22 :param service_package_activation_id:23 :type service_package_activation_id: str24 :param host_type: Possible values include: 'Invalid', 'ExeHost',25 'ContainerHost'26 :type host_type: str27 :param host_isolation_mode: Possible values include: 'None', 'Process',28 'HyperV'29 :type host_isolation_mode: str30 :param status: Possible values include: 'Invalid', 'Downloading',31 'Activating', 'Active', 'Upgrading', 'Deactivating'32 :type status: str33 :param run_frequency_interval: The interval at which code package is run.34 This is used for periodic code package.35 :type run_frequency_interval: str36 :param setup_entry_point:37 :type setup_entry_point: :class:`CodePackageEntryPoint38 <azure.servicefabric.models.CodePackageEntryPoint>`39 :param main_entry_point:40 :type main_entry_point: :class:`CodePackageEntryPoint41 <azure.servicefabric.models.CodePackageEntryPoint>`42 """ 43 _attribute_map = {44 'name': {'key': 'Name', 'type': 'str'},45 'version': {'key': 'Version', 'type': 'str'},46 'service_manifest_name': {'key': 'ServiceManifestName', 'type': 'str'},47 'service_package_activation_id': {'key': 'ServicePackageActivationId', 'type': 'str'},48 'host_type': {'key': 'HostType', 'type': 'str'},49 'host_isolation_mode': {'key': 'HostIsolationMode', 'type': 'str'},50 'status': {'key': 'Status', 'type': 'str'},51 'run_frequency_interval': {'key': 'RunFrequencyInterval', 'type': 'str'},52 'setup_entry_point': {'key': 'SetupEntryPoint', 'type': 'CodePackageEntryPoint'},53 'main_entry_point': {'key': 'MainEntryPoint', 'type': 'CodePackageEntryPoint'},54 }55 def __init__(self, name=None, version=None, service_manifest_name=None, service_package_activation_id=None, host_type=None, host_isolation_mode=None, status=None, run_frequency_interval=None, setup_entry_point=None, main_entry_point=None):56 self.name = name57 self.version = version58 self.service_manifest_name = service_manifest_name59 self.service_package_activation_id = service_package_activation_id60 self.host_type = host_type61 self.host_isolation_mode = host_isolation_mode62 self.status = status63 self.run_frequency_interval = run_frequency_interval64 self.setup_entry_point = setup_entry_point...
init.py
Source:init.py
...39 stream=sys.stderr,40 level=level,41 format="%(asctime)s -- %(message)s"42 )43def main_entry_point():44 args = parser.parse_args()45 _configure_logging(args)46 sys.exit(main(args))47if __name__ == "__main__":...
run.py
Source:run.py
...25 level=logging.DEBUG,26 format="%(asctime)s -- %(message)s"27 )28#### For use with entry_points/console_scripts29def main_entry_point():30 args = parser.parse_args()31 if args.verbose:32 _configure_logging()33 sys.exit(main(args))34if __name__ == '__main__':...
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!!