How to use setup_package method in tempest

Best Python code snippet using tempest_python

flag_handlers.py

Source:flag_handlers.py Github

copy

Full Screen

...25 # Test that both autotools and cmake work getting no build_system flags26 s1 = spack.spec.Spec('cmake-client')27 s1.concretize()28 pkg1 = spack.repo.get(s1)29 spack.build_environment.setup_package(pkg1, False)30 s2 = spack.spec.Spec('patchelf')31 s2.concretize()32 pkg2 = spack.repo.get(s2)33 spack.build_environment.setup_package(pkg2, False)34 # Use cppflags as a canary35 assert 'SPACK_CPPFLAGS' not in os.environ36 assert 'CPPFLAGS' not in os.environ37 def test_unbound_method(self, temp_env):38 # Other tests test flag_handlers set as bound methods and functions.39 # This tests an unbound method in python2 (no change in python3).40 s = spack.spec.Spec('mpileaks cppflags=-g')41 s.concretize()42 pkg = spack.repo.get(s)43 pkg.flag_handler = pkg.__class__.inject_flags44 spack.build_environment.setup_package(pkg, False)45 assert os.environ['SPACK_CPPFLAGS'] == '-g'46 assert 'CPPFLAGS' not in os.environ47 def test_inject_flags(self, temp_env):48 s = spack.spec.Spec('mpileaks cppflags=-g')49 s.concretize()50 pkg = spack.repo.get(s)51 pkg.flag_handler = inject_flags52 spack.build_environment.setup_package(pkg, False)53 assert os.environ['SPACK_CPPFLAGS'] == '-g'54 assert 'CPPFLAGS' not in os.environ55 def test_env_flags(self, temp_env):56 s = spack.spec.Spec('mpileaks cppflags=-g')57 s.concretize()58 pkg = spack.repo.get(s)59 pkg.flag_handler = env_flags60 spack.build_environment.setup_package(pkg, False)61 assert os.environ['CPPFLAGS'] == '-g'62 assert 'SPACK_CPPFLAGS' not in os.environ63 def test_build_system_flags_cmake(self, temp_env):64 s = spack.spec.Spec('cmake-client cppflags=-g')65 s.concretize()66 pkg = spack.repo.get(s)67 pkg.flag_handler = build_system_flags68 spack.build_environment.setup_package(pkg, False)69 assert 'SPACK_CPPFLAGS' not in os.environ70 assert 'CPPFLAGS' not in os.environ71 expected = set(['-DCMAKE_C_FLAGS=-g', '-DCMAKE_CXX_FLAGS=-g',72 '-DCMAKE_Fortran_FLAGS=-g'])73 assert set(pkg.cmake_flag_args) == expected74 def test_build_system_flags_autotools(self, temp_env):75 s = spack.spec.Spec('patchelf cppflags=-g')76 s.concretize()77 pkg = spack.repo.get(s)78 pkg.flag_handler = build_system_flags79 spack.build_environment.setup_package(pkg, False)80 assert 'SPACK_CPPFLAGS' not in os.environ81 assert 'CPPFLAGS' not in os.environ82 assert 'CPPFLAGS=-g' in pkg.configure_flag_args83 def test_build_system_flags_not_implemented(self, temp_env):84 s = spack.spec.Spec('mpileaks cppflags=-g')85 s.concretize()86 pkg = spack.repo.get(s)87 pkg.flag_handler = build_system_flags88 # Test the command line flags method raises a NotImplementedError89 try:90 spack.build_environment.setup_package(pkg, False)91 assert False92 except NotImplementedError:93 assert True94 def test_add_build_system_flags_autotools(self, temp_env):95 s = spack.spec.Spec('patchelf cppflags=-g')96 s.concretize()97 pkg = spack.repo.get(s)98 pkg.flag_handler = add_o3_to_build_system_cflags99 spack.build_environment.setup_package(pkg, False)100 assert '-g' in os.environ['SPACK_CPPFLAGS']101 assert 'CPPFLAGS' not in os.environ102 assert pkg.configure_flag_args == ['CFLAGS=-O3']103 def test_add_build_system_flags_cmake(self, temp_env):104 s = spack.spec.Spec('cmake-client cppflags=-g')105 s.concretize()106 pkg = spack.repo.get(s)107 pkg.flag_handler = add_o3_to_build_system_cflags108 spack.build_environment.setup_package(pkg, False)109 assert '-g' in os.environ['SPACK_CPPFLAGS']110 assert 'CPPFLAGS' not in os.environ111 assert pkg.cmake_flag_args == ['-DCMAKE_C_FLAGS=-O3']112 def test_ld_flags_cmake(self, temp_env):113 s = spack.spec.Spec('cmake-client ldflags=-mthreads')114 s.concretize()115 pkg = spack.repo.get(s)116 pkg.flag_handler = build_system_flags117 spack.build_environment.setup_package(pkg, False)118 assert 'SPACK_LDFLAGS' not in os.environ119 assert 'LDFLAGS' not in os.environ120 expected = set(['-DCMAKE_EXE_LINKER_FLAGS=-mthreads',121 '-DCMAKE_MODULE_LINKER_FLAGS=-mthreads',122 '-DCMAKE_SHARED_LINKER_FLAGS=-mthreads',123 '-DCMAKE_STATIC_LINKER_FLAGS=-mthreads'])124 assert set(pkg.cmake_flag_args) == expected125 def test_ld_libs_cmake(self, temp_env):126 s = spack.spec.Spec('cmake-client ldlibs=-lfoo')127 s.concretize()128 pkg = spack.repo.get(s)129 pkg.flag_handler = build_system_flags130 spack.build_environment.setup_package(pkg, False)131 assert 'SPACK_LDLIBS' not in os.environ132 assert 'LDLIBS' not in os.environ133 expected = set(['-DCMAKE_C_STANDARD_LIBRARIES=-lfoo',134 '-DCMAKE_CXX_STANDARD_LIBRARIES=-lfoo',135 '-DCMAKE_Fortran_STANDARD_LIBRARIES=-lfoo'])...

Full Screen

Full Screen

zipTool.py

Source:zipTool.py Github

copy

Full Screen

...47 zip_file.write(Source_path + "/" + dirpath + "/" + filename,48 arcname=dirpath + "/" + filename)49 zip_file.close()50 return zip_file_path51def setup_package(info={}):52 '''53 设置资源包的信息54 '''55 route = info[ROUTE] if ROUTE in info else input("请输入资源包的路由URL:")56 entrance = info[ENTRANCE] if ENTRANCE in info else input("请指定资源包的入口文件:")57 version = input("请输入版本号(当前版本" + str(info[VERSION]) + "):") if VERSION in info else input("请输入版本号:")58 package_info = {59 ROUTE: route,60 ENTRANCE: entrance,61 VERSION: version62 }63 with open(INFO_FILE, "w") as f:64 json.dump(package_info, f)65 # 打包66 return package(route)67def main():68 if os.path.isfile(INFO_FILE):69 with open(INFO_FILE, "r") as f:70 info = json.load(f)71 path = setup_package(info)72 else:73 path = setup_package()74 # 打包完成计算摘要并加密75 encrypted_hash = DES_encrypt(path)76 print("打包完成,资源包摘要为:" + encrypted_hash.decode('utf-8'))77 deploy(path)78if __name__ == "__main__":...

Full Screen

Full Screen

service_setup_scripts.py

Source:service_setup_scripts.py Github

copy

Full Screen

1import os2import subprocess3import sys4from typing import List5sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))6from saarctf_commons import config7config.EXTERNAL_TIMER = True8from controlserver.models import Service9from controlserver.db_filesystem import DBFilesystem10"""11Run the setup scripts from all services12ARGUMENTS: none13"""14def run_service_setup_scripts(filters: List[str]):15 # noinspection PyUnresolvedReferences16 import controlserver.app17 if filters:18 services = Service.query.filter(Service.name.in_(filters)).filter(Service.setup_package != None).all()19 else:20 services = Service.query.filter(Service.setup_package != None).all()21 errors = 022 dbfs = DBFilesystem()23 for service in services:24 print(f'[{service.name}] Extracting script from package {service.setup_package} ...')25 path = f'/tmp/setup_packages/{service.setup_package}'26 dbfs.load_package_to_folder(service.setup_package, path, '/tmp/setup_packages/lfs')27 script = f'{path}/dependencies.sh'28 if not os.path.exists(script):29 print(f'[{service.name}] Script not found: "{script}"!')30 errors += 131 else:32 print(f'[{service.name}] Running script "{script}" ...')33 os.system(f'chmod +x "{script}"')34 result = subprocess.run([script])35 if result.returncode != 0:36 errors += 137 print(f'[{service.name}] Script failed with code {result.returncode}.')38 else:39 print(f'[{service.name}] Script succeeded.')40 return errors41if __name__ == '__main__':42 config.set_redis_clientname('script-' + os.path.basename(__file__))43 errors = run_service_setup_scripts(sys.argv[1:])44 if errors > 0:45 print(f'[ERROR] {errors} errors reported.')...

Full Screen

Full Screen

setup.py

Source:setup.py Github

copy

Full Screen

...16# self.pytest_args = []17#18# def run_tests(self):19# sys.exit(0)20def setup_package():21 # cmdclass = {'test': PyTest}22 setup(23 name=NAME,24 url=URL,25 version=VERSION,26 license=LICENSE,27 author=AUTHOR,28 author_email=EMAIL,29 description=DESCRIPTION,30 long_description='',31 setup_requires=['pytest-runner'],32 install_requires=['numpy'],33 extras_require={34 'all': [35 'pandas',36 'matplotlib',37 'jupyter',38 'jupyter_contrib_nbextensions',39 'keras'40 ]41 },42 classifiers=[],43 packages=[package for package in find_packages() if package.startswith('mixsig')],44 tests_require=['pytest', 'hypothesis'],45 test_suite='',46 # cmdclass=cmdclass,47 command_options={},48 entry_points={},49 zip_safe=False50 )51if __name__ == '__main__':...

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