How to use create_package method in localstack

Best Python code snippet using localstack_python

test_package_hierarchy.py

Source:test_package_hierarchy.py Github

copy

Full Screen

2from odoo.exceptions import ValidationError3class TestPackageHierarchy(common.BaseUDES):4 def test1_max_package_depth_violation(self):5 """Test Non-Branching Maximum Package Depth Top Insertion"""6 pack_child = self.create_package()7 pack_parent = self.create_package()8 pack_grandparent = self.create_package()9 pack_child.package_id = pack_parent.id10 with self.assertRaises(ValidationError) as e:11 pack_parent.package_id = pack_grandparent.id12 self.assertEqual(e.exception.name, 'Maximum package depth exceeded.')13 def test2_max_package_depth_violation_tail(self):14 """Test Non-Branching Maximum Package Depth Tail Insertion"""15 pack_child = self.create_package()16 pack_parent = self.create_package()17 pack_grandparent = self.create_package()18 pack_child.package_id = pack_parent.id19 with self.assertRaises(ValidationError) as e:20 pack_grandparent.package_id = pack_child.id21 self.assertEqual(e.exception.name, 'Maximum package depth exceeded.')22 def test3_max_package_depth_violation_middle(self):23 """Test Non-Branching Maximum Package Depth Middle Insertion"""24 wh = self.env.user.get_user_warehouse()25 wh.u_max_package_depth = 326 # Set up 3 level package27 pack_child_a = self.create_package()28 pack_child_b = self.create_package()29 pack_parent = self.create_package()30 pack_child_a.package_id = pack_child_b.id31 pack_child_b.package_id = pack_parent.id32 # Set up 2 level inner child33 pack_middle_child = self.create_package()34 pack_child_c = self.create_package()35 pack_child_c.package_id = pack_middle_child.id36 # Increase length of middle child to create 4 level package37 with self.assertRaises(ValidationError) as e:38 pack_middle_child.package_id = pack_child_b.id39 self.assertEqual(e.exception.name, 'Maximum package depth exceeded.')40 def test4_max_package_depth_violation_branch_top(self):41 """Test Branching Maximum Package Depth Top Insertion"""42 wh = self.env.user.get_user_warehouse()43 wh.u_max_package_depth = 444 # Set up 4 level package45 pack_child_1_a = self.create_package()46 pack_child_1_b = self.create_package()47 pack_child_1_c = self.create_package()48 pack_parent_1 = self.create_package()49 pack_child_1_a.package_id = pack_child_1_b.id50 pack_child_1_b.package_id = pack_child_1_c.id51 pack_child_1_c.package_id = pack_parent_1.id 52 # Set up grandparent package - 2 levels53 pack_parent_2 = self.create_package()54 pack_grandparent = self.create_package()55 pack_parent_2.package_id = pack_grandparent.id56 # Add a 4 level package to grandparent57 with self.assertRaises(ValidationError) as e:58 pack_parent_1.package_id = pack_grandparent.id59 self.assertEqual(e.exception.name, 'Maximum package depth exceeded.')60 def test5_max_package_depth_violation_branch_tail(self):61 """Test Branching Maximum Package Depth Tail Insertion"""62 wh = self.env.user.get_user_warehouse()63 wh.u_max_package_depth = 464 # Set up 3 level package65 pack_child_1_a = self.create_package()66 pack_child_1_b = self.create_package()67 pack_parent_1 = self.create_package()68 pack_child_1_a.package_id = pack_child_1_b.id69 pack_child_1_b.package_id = pack_parent_1.id70 # Set up 2 level package71 pack_parent_2 = self.create_package()72 # Set up grandparent package - 2 levels73 pack_grandparent = self.create_package()74 pack_parent_2.package_id = pack_grandparent.id75 self.assertEqual(pack_grandparent.u_package_depth, 2)76 # Add 4 level package to grandparent - 4 levels77 pack_parent_1.package_id = pack_grandparent.id78 self.assertEqual(pack_grandparent.u_package_depth, 4)79 # Create inner child80 pack_child_1_c = self.create_package()81 # Add a 5th level to grandparent as inner child82 with self.assertRaises(ValidationError) as e:83 pack_child_1_c.package_id = pack_child_1_a.id84 self.assertEqual(e.exception.name, 'Maximum package depth exceeded.')85 def test6_max_package_depth_violation_branch_middle(self):86 """Test Branching Maximum Package Depth Middle Insertion"""87 wh = self.env.user.get_user_warehouse()88 wh.u_max_package_depth = 489 # Set up 3 level package90 pack_child_1_a = self.create_package()91 pack_child_1_b = self.create_package()92 pack_parent_1 = self.create_package()93 pack_child_1_a.package_id = pack_child_1_b.id94 pack_child_1_b.package_id = pack_parent_1.id95 # Set up grandparent package - 3 levels96 pack_parent_2 = self.create_package()97 pack_child_2 = self.create_package()98 pack_child_2.package_id = pack_parent_2.id99 pack_grandparent = self.create_package()100 pack_parent_2.package_id = pack_grandparent.id101 self.assertEqual(pack_grandparent.u_package_depth, 3)102 # Add 3 level package to grandparent103 pack_parent_1.package_id = pack_grandparent.id104 self.assertEqual(pack_grandparent.u_package_depth, 4)105 # Set up 2 level inner child106 pack_middle_child_a = self.create_package()107 pack_middle_child_b = self.create_package()108 pack_middle_child_a.package_id = pack_middle_child_b.id109 self.assertEqual(pack_middle_child_b.u_package_depth, 2)110 # Increase length of shorter chain middle child to create 5 level package111 with self.assertRaises(ValidationError) as e:112 pack_middle_child_b.package_id = pack_child_2.id113 self.assertEqual(e.exception.name, 'Maximum package depth exceeded.')114 def test7_max_package_depth_violation_branch_middle(self):115 """Test Adding Child Package To Parent Already Possessing Multiple Children"""116 wh = self.env.user.get_user_warehouse()117 wh.u_max_package_depth = 4118 # Set up 3 level package119 pack_child_1_a = self.create_package()120 pack_child_1_b = self.create_package()121 pack_parent_1 = self.create_package()122 pack_child_1_a.package_id = pack_child_1_b.id123 pack_child_1_b.package_id = pack_parent_1.id124 self.assertEqual(pack_parent_1.u_package_depth, 3)125 # Set up 4 level package126 pack_child_2_a = self.create_package()127 pack_child_2_b = self.create_package()128 pack_child_2_c = self.create_package()129 pack_parent_2 = self.create_package()130 pack_child_2_a.package_id = pack_child_2_b.id131 pack_child_2_b.package_id = pack_child_2_c.id132 pack_child_2_c.package_id = pack_parent_2.id133 self.assertEqual(pack_parent_2.u_package_depth, 4)134 # Set up grandparent package - 2 level grandparent135 pack_parent_3 = self.create_package()136 pack_grandparent = self.create_package()137 pack_parent_3.package_id = pack_grandparent.id138 self.assertEqual(pack_grandparent.u_package_depth, 2)139 # Add 3 level package to grandparent - 4 level grandparent140 pack_parent_1.package_id = pack_grandparent.id141 self.assertEqual(pack_grandparent.u_package_depth, 4)142 # Add 4 level package to grandparent - 5 level grandparent143 with self.assertRaises(ValidationError) as e:144 pack_parent_2.package_id = pack_grandparent.id...

Full Screen

Full Screen

test_nalu_wind_nightly.py

Source:test_nalu_wind_nightly.py Github

copy

Full Screen

...4#5# This software is released under the BSD 3-clause license. See LICENSE file6# for more details.7def test_package_name(create_package):8 package = create_package("nalu-wind-nightly")9 assert package.name == "nalu-wind-nightly"10def test_nrel_build_names(create_package):11 package = create_package(12 """nalu-wind-nightly +fftw+tioga+hypre+openfast+cuda cuda_arch=70 %gcc@9.3.013 ^cuda@11.2.2 ^trilinos@develop+uvm"""14 )15 assert package.dashboard_build_name() == "-gcc@9.3.0-cuda@11.2.2^trilinos@develop+uvm"16 package = create_package(17 "nalu-wind-nightly +fftw+tioga+hypre+openfast %gcc@9.3.0 ^trilinos@develop"18 )19 assert package.dashboard_build_name() == "-gcc@9.3.0^trilinos@develop"20 package = create_package(21 "nalu-wind-nightly +fftw+tioga+hypre+openfast %intel@20.0.2 ^trilinos@develop"22 )23 assert package.dashboard_build_name() == "-intel@20.0.2^trilinos@develop"24 package = create_package(25 """nalu-wind-nightly +fftw+tioga+hypre+openfast+asan build_type=Debug26 %clang@10.0.0 ^trilinos@develop"""27 )28 assert package.dashboard_build_name() == "-clang@10.0.0^trilinos@develop"29def test_snl_build_names(create_package):30 package = create_package(31 """nalu-wind-nightly+snl +fftw+tioga+hypre+openfast %gcc@9.3.032 build_type=Release ^trilinos@develop"""33 )34 assert (35 package.dashboard_build_name()36 == "-gcc@9.3.0-Release+fftw+tioga+hypre+openfast^trilinos@develop"37 )38 package = create_package(39 "nalu-wind-nightly+snl %gcc@9.3.0 build_type=Release ^trilinos@develop"40 )41 assert package.dashboard_build_name() == "-gcc@9.3.0-Release^trilinos@develop"42 package = create_package("nalu-wind-nightly+snl %gcc@9.3.0 build_type=Debug ^trilinos@develop")43 assert package.dashboard_build_name() == "-gcc@9.3.0-Debug^trilinos@develop"44 package = create_package(45 """nalu-wind-nightly+snl +fftw+tioga+hypre+openfast+cuda cuda_arch=70 %gcc@9.3.046 build_type=Release ^cuda@11.2.2 ^trilinos@develop+uvm"""47 )48 assert (49 package.dashboard_build_name()50 == "-gcc@9.3.0-cuda@11.2.2-Release+fftw+tioga+hypre+openfast"51 "^trilinos@develop+uvm"52 )53 package = create_package(54 """nalu-wind-nightly+snl +cuda cuda_arch=70 %gcc@9.3.055 build_type=Release ^cuda@11.2.2 ^trilinos@develop+uvm"""56 )57 assert package.dashboard_build_name() == "-gcc@9.3.0-cuda@11.2.2-Release^trilinos@develop+uvm"58 package = create_package(59 """nalu-wind-nightly+snl +cuda cuda_arch=70 %gcc@9.3.060 build_type=Debug ^cuda@11.2.2 ^trilinos@develop+uvm"""61 )62 assert package.dashboard_build_name() == "-gcc@9.3.0-cuda@11.2.2-Debug^trilinos@develop+uvm"63 package = create_package(64 """nalu-wind-nightly+snl +fftw+tioga+hypre+openfast+cuda cuda_arch=70 %gcc@9.3.065 build_type=Release ^cuda@11.2.2 ^trilinos@develop~uvm"""66 )67 assert (68 package.dashboard_build_name()69 == "-gcc@9.3.0-cuda@11.2.2-Release+fftw+tioga+hypre+openfast"70 "^trilinos@develop~uvm"71 )72 package = create_package(73 """nalu-wind-nightly+snl +cuda cuda_arch=70 %gcc@9.3.074 build_type=Release ^cuda@11.2.2 ^trilinos@develop~uvm"""75 )76 assert package.dashboard_build_name() == "-gcc@9.3.0-cuda@11.2.2-Release^trilinos@develop~uvm"77 package = create_package(78 """nalu-wind-nightly+snl +cuda cuda_arch=70 %gcc@9.3.079 build_type=Debug ^cuda@11.2.2 ^trilinos@develop~uvm"""80 )81 assert package.dashboard_build_name() == "-gcc@9.3.0-cuda@11.2.2-Debug^trilinos@develop~uvm"82def test_dashboard_compilers_gcc_compiler(create_package):83 package = create_package("nalu-wind-nightly%gcc@9.3.0")84 assert package.dashboard_compilers() == "gcc@9.3.0"85def test_dashboard_compilers_intel_compiler(create_package):86 package = create_package("nalu-wind-nightly%intel@20.0.2")87 assert package.dashboard_compilers() == "intel@20.0.2"88def test_dashboard_compilers_gcc_compiler_with_cuda(create_package):89 package = create_package("nalu-wind-nightly%gcc@9.3.0^cuda@11.2.2")90 assert package.dashboard_compilers() == "gcc@9.3.0-cuda@11.2.2"91def test_dashboard_compilers_cuda_version_pulled_from_spec(create_package):92 package = create_package("nalu-wind-nightly%gcc@9.3.0^cuda@11.4.2")93 assert package.dashboard_compilers() == "gcc@9.3.0-cuda@11.4.2"94def test_dashboard_trilinos_develop(create_package):95 package = create_package("nalu-wind-nightly ^trilinos@develop")96 assert package.dashboard_trilinos() == "trilinos@develop"97def test_dashboard_trilinos_master(create_package):98 package = create_package("nalu-wind-nightly ^trilinos@master")99 assert package.dashboard_trilinos() == "trilinos@master"100def test_dashboard_trilinos_no_cuda_no_uvm_option(create_package):101 package = create_package("nalu-wind-nightly ^trilinos@develop~uvm")102 assert package.dashboard_trilinos() == "trilinos@develop"103def test_dashboard_trilinos_cuda_uvm(create_package):104 package = create_package("nalu-wind-nightly ^cuda@11.2.2 ^trilinos@develop+uvm")105 assert package.dashboard_trilinos() == "trilinos@develop+uvm"106def test_dashboard_trilinos_cuda_no_uvm(create_package):107 package = create_package("nalu-wind-nightly ^cuda@10.1.243 ^trilinos@develop~uvm")108 assert package.dashboard_trilinos() == "trilinos@develop~uvm"109def test_dashboard_variants_build_type_release(create_package):110 package = create_package("nalu-wind-nightly build_type=Release")111 assert package.dashboard_variants() == "Release"112def test_dashboard_variants_build_type_debug(create_package):113 package = create_package("nalu-wind-nightly build_type=Debug")114 assert package.dashboard_variants() == "Debug"115def test_dashboard_variants_contains_enabled(create_package):116 package = create_package("nalu-wind-nightly+hypre build_type=Release")117 assert package.dashboard_variants() == "Release+hypre"118def test_dashboard_variants_contains_multiple_enabled(create_package):119 package = create_package("nalu-wind-nightly+fftw+hypre+tioga+openfast build_type=Release")120 assert package.dashboard_variants() == "Release+fftw+hypre+tioga+openfast"121def test_dashboard_variants_doesnt_contain_non_whitelisted(create_package):122 package = create_package(123 """nalu-wind-nightly+fftw+hypre+tioga+openfast+snl+cuda124 cuda_arch=70 abs_tol=1e-15 build_type=Release"""125 )126 assert package.dashboard_variants() == "Release+fftw+hypre+tioga+openfast"127def test_dashboard_variants_doesnt_contain_disabled(create_package):128 package = create_package("nalu-wind-nightly+fftw~hypre+tioga~openfast build_type=Release")...

Full Screen

Full Screen

init_pkg.py

Source:init_pkg.py Github

copy

Full Screen

1import os2import json3package = json.loads('{"schema_version": 1,"name": "MathEx","description": "Extension to the RPL++ math library","dependencies": [],"entry": "MathEx.rpl","js_module": "","author": "NishiOwO","version": "1.4.0C"}')4print('rpkg: action create_package started')5print('rpkg: create_package: creating initial directory structure')6if os.path.exists(package['name']) and os.path.isdir(package['name']):7 print('rpkg: create_package: create_directory: check_if_directory_exists: directory already exists')8else:9 print('rpkg: create_package: create_directory: creating directory')10 os.mkdir(package['name'])11print('rpkg: create_package: create_module_json: creating module json')12with open(package['name'] + '/module.json', 'w') as f:13 f.write(json.dumps(package))14print('rpkg: create_package: create_module_json: done')15print('rpkg: create_package: done')16print('rpkg: all actions complete')...

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