How to use libraries method in autotest

Best Python code snippet using autotest_python

tests.py

Source:tests.py Github

copy

Full Screen

1"""2mbed SDK3Copyright (c) 2011-2013 ARM Limited4Licensed under the Apache License, Version 2.0 (the "License");5you may not use this file except in compliance with the License.6You may obtain a copy of the License at7 http://www.apache.org/licenses/LICENSE-2.08Unless required by applicable law or agreed to in writing, software9distributed under the License is distributed on an "AS IS" BASIS,10WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.11See the License for the specific language governing permissions and12limitations under the License.13"""14from workspace_tools.paths import *15from workspace_tools.data.support import *16TEST_CMSIS_LIB = join(TEST_DIR, "cmsis", "lib")17TEST_MBED_LIB = join(TEST_DIR, "mbed", "env")18PERIPHERALS = join(TEST_DIR, "peripherals")19BENCHMARKS_DIR = join(TEST_DIR, "benchmarks")20SD = join(TEST_DIR, "sd")21TMP102 = join(PERIPHERALS, 'TMP102')22"""23Wiring:24 * Ground:25 * LPC1*: p126 * KL25Z: GND27 * Vout28 * LPC1*: p4029 * KL25Z: P3V330 * TMP102 (I2C):31 * LPC1*: (SDA=p28 , SCL=p27)32 * KL25Z: (SDA=PTC9, SCL=PTC8)33 * MAXWSNENV: (SDA=TP6, SCL=TP5)34 * digital_loop (Digital(In|Out|InOut), InterruptIn):35 * Arduino headers: (D0 <-> D7)36 * LPC1549: (D2 <-> D7)37 * LPC1*: (p5 <-> p25 )38 * KL25Z: (PTA5<-> PTC6)39 * NUCLEO_F103RB: (PC_6 <-> PB_8)40 * MAXWSNENV: (TP3 <-> TP4)41 * MAX32600MBED: (P1_0 <-> P4_7)42 * port_loop (Port(In|Out|InOut)):43 * Arduino headers: (D0 <-> D7), (D1 <-> D6)44 * LPC1*: (p5 <-> p25), (p6 <-> p26)45 * KL25Z: (PTA5 <-> PTC6), (PTA4 <-> PTC5)46 * NUCLEO_F103RB: (PC_6 <-> PB_8), (PC_5 <-> PB_9)47 * MAXWSNENV: (TP1 <-> TP3), (TP2 <-> TP4)48 * MAX32600MBED: (P1_0 <-> P4_7), (P1_1 <-> P4_6)49 * analog_loop (AnalogIn, AnalogOut):50 * Arduino headers: (A0 <-> A5)51 * LPC1549: (A0 <-> D12)52 * LPC1*: (p17 <-> p18 )53 * KL25Z: (PTE30 <-> PTC2)54 * analog_pot (AnalogIn):55 * Arduino headers: (A0, A1)56 57 * SD (SPI):58 * LPC1*: (mosi=p11 , miso=p12 , sclk=p13 , cs=p14 )59 * KL25Z: (mosi=PTD2, miso=PTD3, sclk=PTD1, cs=PTD0)60 * MMA7660 (I2C):61 * LPC1*: (SDA=p28 , SCL=p27)62 * i2c_loop:63 * LPC1768: (p28 <-> p9), (p27 <-> p10)64 * i2c_eeprom:65 * LPC1*: (SDA=p28 , SCL=p27)66 * KL25Z: (SDA=PTE0, SCL=PTE1)67 68"""69TESTS = [70 # Automated MBED tests71 {72 "id": "MBED_A1", "description": "Basic",73 "source_dir": join(TEST_DIR, "mbed", "basic"),74 "dependencies": [MBED_LIBRARIES, TEST_MBED_LIB],75 "automated": True,76 },77 {78 "id": "MBED_A2", "description": "Semihost file system",79 "source_dir": join(TEST_DIR, "mbed", "file"),80 "dependencies": [MBED_LIBRARIES, TEST_MBED_LIB],81 "automated": True,82 "mcu": ["LPC1768", "LPC2368", "LPC11U24"]83 },84 {85 "id": "MBED_A3", "description": "C++ STL",86 "source_dir": join(TEST_DIR, "mbed", "stl"),87 "dependencies": [MBED_LIBRARIES, TEST_MBED_LIB],88 "automated": False,89 },90 {91 "id": "MBED_A4", "description": "I2C TMP102",92 "source_dir": join(TEST_DIR, "mbed", "i2c_TMP102"),93 "dependencies": [MBED_LIBRARIES, TEST_MBED_LIB, TMP102],94 "automated": True,95 "peripherals": ["TMP102"]96 },97 {98 "id": "MBED_A5", "description": "DigitalIn DigitalOut",99 "source_dir": join(TEST_DIR, "mbed", "digitalin_digitalout"),100 "dependencies": [MBED_LIBRARIES, TEST_MBED_LIB],101 "automated": True,102 "peripherals": ["digital_loop"]103 },104 {105 "id": "MBED_A6", "description": "DigitalInOut",106 "source_dir": join(TEST_DIR, "mbed", "digitalinout"),107 "dependencies": [MBED_LIBRARIES, TEST_MBED_LIB],108 "automated": True,109 "peripherals": ["digital_loop"]110 },111 {112 "id": "MBED_A7", "description": "InterruptIn",113 "source_dir": join(TEST_DIR, "mbed", "interruptin"),114 "dependencies": [MBED_LIBRARIES, TEST_MBED_LIB],115 "duration": 15,116 "automated": True,117 "peripherals": ["digital_loop"]118 },119 {120 "id": "MBED_A8", "description": "Analog",121 "source_dir": join(TEST_DIR, "mbed", "analog"),122 "dependencies": [MBED_LIBRARIES, TEST_MBED_LIB],123 "automated": True,124 "peripherals": ["analog_loop"],125 "mcu": ["LPC1768", "LPC2368", "KL25Z", "K64F", "K22F", "LPC4088", "LPC1549",126 "NUCLEO_F072RB", "NUCLEO_F091RC", "NUCLEO_F302R8", "NUCLEO_F303RE",127 "NUCLEO_F334R8", "NUCLEO_L053R8", "NUCLEO_L073RZ", "NUCLEO_L152RE",128 "NUCLEO_F411RE", "DISCO_F407VG", "ARCH_MAX", "MAX32600MBED"]129 },130 {131 "id": "MBED_A9", "description": "Serial Echo at 115200",132 "source_dir": join(TEST_DIR, "mbed", "echo"),133 "dependencies": [MBED_LIBRARIES, TEST_MBED_LIB],134 "automated": True,135 #"host_test": "echo"136 },137 {138 "id": "MBED_A10", "description": "PortOut PortIn",139 "source_dir": join(TEST_DIR, "mbed", "portout_portin"),140 "dependencies": [MBED_LIBRARIES, TEST_MBED_LIB],141 "peripherals": ["port_loop"],142 "supported": DEFAULT_SUPPORT,143 "automated": True,144 },145 {146 "id": "MBED_A11", "description": "PortInOut",147 "source_dir": join(TEST_DIR, "mbed", "portinout"),148 "dependencies": [MBED_LIBRARIES, TEST_MBED_LIB],149 "peripherals": ["port_loop"],150 "supported": DEFAULT_SUPPORT,151 "automated": True,152 },153 {154 "id": "MBED_A12", "description": "SD File System",155 "source_dir": join(TEST_DIR, "mbed", "sd"),156 "dependencies": [MBED_LIBRARIES, TEST_MBED_LIB, FS_LIBRARY],157 "automated": True,158 "duration": 15,159 "peripherals": ["SD"]160 },161 {162 "id": "MBED_A13", "description": "I2C MMA7660 accelerometer",163 "source_dir": join(TEST_DIR, "mbed", "i2c_MMA7660"),164 "dependencies": [MBED_LIBRARIES, TEST_MBED_LIB, join(PERIPHERALS, 'MMA7660')],165 "automated": True,166 "peripherals": ["MMA7660"]167 },168 {169 "id": "MBED_A14", "description": "I2C Master",170 "source_dir": join(TEST_DIR, "mbed", "i2c_master"),171 "dependencies": [MBED_LIBRARIES, TEST_MBED_LIB,],172 },173 {174 "id": "MBED_A15", "description": "I2C Slave",175 "source_dir": join(TEST_DIR, "mbed", "i2c_slave"),176 "dependencies": [MBED_LIBRARIES, TEST_MBED_LIB,],177 },178 {179 "id": "MBED_A16", "description": "SPI Master",180 "source_dir": join(TEST_DIR, "mbed", "spi_master"),181 "dependencies": [MBED_LIBRARIES, TEST_MBED_LIB,],182 },183 {184 "id": "MBED_A17", "description": "SPI Slave",185 "source_dir": join(TEST_DIR, "mbed", "spi_slave"),186 "dependencies": [MBED_LIBRARIES, TEST_MBED_LIB,],187 },188 {189 "id": "MBED_A18", "description": "Interrupt vector relocation",190 "source_dir": join(TEST_DIR, "mbed", "vtor_reloc"),191 "dependencies": [MBED_LIBRARIES, TEST_MBED_LIB,],192 "mcu": ["LPC1768"],193 "automated": True,194 },195 {196 "id": "MBED_A19", "description": "I2C EEPROM read/write test",197 "source_dir": join(TEST_DIR, "mbed", "i2c_eeprom"),198 "dependencies": [MBED_LIBRARIES, TEST_MBED_LIB],199 "peripherals": ["24LC256"],200 "automated": True,201 "duration": 15,202 },203 {204 "id": "MBED_A20", "description": "I2C master/slave test",205 "source_dir": join(TEST_DIR, "mbed", "i2c_master_slave"),206 "dependencies": [MBED_LIBRARIES, TEST_MBED_LIB,],207 "mcu": ["LPC1768", "RZ_A1H"],208 "peripherals": ["i2c_loop"]209 },210 {211 "id": "MBED_A21", "description": "Call function before main (mbed_main)",212 "source_dir": join(TEST_DIR, "mbed", "call_before_main"),213 "dependencies": [MBED_LIBRARIES, TEST_MBED_LIB],214 "automated": True,215 },216 {217 "id": "MBED_A22", "description": "SPIFI for LPC4088 (test 1)",218 "source_dir": join(TEST_DIR, "mbed", "spifi1"),219 "dependencies": [MBED_LIBRARIES, TEST_MBED_LIB],220 "automated": True,221 "duration": 30,222 "mcu": ["LPC4088","LPC4088_DM"]223 },224 {225 "id": "MBED_A23", "description": "SPIFI for LPC4088 (test 2)",226 "source_dir": join(TEST_DIR, "mbed", "spifi2"),227 "dependencies": [MBED_LIBRARIES, TEST_MBED_LIB],228 "automated": True,229 "duration": 30,230 "mcu": ["LPC4088","LPC4088_DM"]231 },232 {233 "id": "MBED_A24", "description": "Serial echo with RTS/CTS flow control",234 "source_dir": join(TEST_DIR, "mbed", "echo_flow_control"),235 "dependencies": [MBED_LIBRARIES],236 "automated": "True",237 "host_test": "echo_flow_control",238 "mcu": ["LPC1768"],239 "peripherals": ["extra_serial"]240 },241 {242 "id": "MBED_A25", "description": "I2C EEPROM line read/write test",243 "source_dir": join(TEST_DIR, "mbed", "i2c_eeprom_line"),244 "dependencies": [MBED_LIBRARIES, TEST_MBED_LIB],245 "peripherals": ["24LC256"],246 "automated": True,247 "duration": 10,248 },249 {250 "id": "MBED_A26", "description": "AnalogIn potentiometer test",251 "source_dir": join(TEST_DIR, "mbed", "analog_pot"),252 "dependencies": [MBED_LIBRARIES, TEST_MBED_LIB],253 "peripherals": ["analog_pot"],254 "automated": True,255 "duration": 10,256 },257 {258 "id": "MBED_BLINKY", "description": "Blinky",259 "source_dir": join(TEST_DIR, "mbed", "blinky"),260 "dependencies": [MBED_LIBRARIES, TEST_MBED_LIB],261 "automated": False,262 },263 {264 "id": "MBED_BUS", "description": "Blinky BUS",265 "source_dir": join(TEST_DIR, "mbed", "bus"),266 "dependencies": [MBED_LIBRARIES, TEST_MBED_LIB],267 "automated": False,268 "duration": 15,269 },270 {271 "id": "MBED_BUSOUT", "description": "BusOut",272 "source_dir": join(TEST_DIR, "mbed", "bus_out"),273 "dependencies": [MBED_LIBRARIES, TEST_MBED_LIB],274 "automated": True,275 "duration": 15,276 },277 # Size benchmarks278 {279 "id": "BENCHMARK_1", "description": "Size (c environment)",280 "source_dir": join(BENCHMARKS_DIR, "cenv"),281 "dependencies": [MBED_LIBRARIES]282 },283 {284 "id": "BENCHMARK_2", "description": "Size (float math)",285 "source_dir": join(BENCHMARKS_DIR, "float_math"),286 "dependencies": [MBED_LIBRARIES]287 },288 {289 "id": "BENCHMARK_3", "description": "Size (printf)",290 "source_dir": join(BENCHMARKS_DIR, "printf"),291 "dependencies": [MBED_LIBRARIES]292 },293 {294 "id": "BENCHMARK_4", "description": "Size (mbed libs)",295 "source_dir": join(BENCHMARKS_DIR, "mbed"),296 "dependencies": [MBED_LIBRARIES]297 },298 {299 "id": "BENCHMARK_5", "description": "Size (all)",300 "source_dir": join(BENCHMARKS_DIR, "all"),301 "dependencies": [MBED_LIBRARIES]302 },303 # performance related tests304 {305 "id": "PERF_1", "description": "SD Stdio R/W Speed",306 "source_dir": join(TEST_DIR, "mbed", "sd_perf_stdio"),307 "dependencies": [MBED_LIBRARIES, TEST_MBED_LIB, FS_LIBRARY],308 "automated": True,309 "duration": 15,310 "peripherals": ["SD"]311 },312 {313 "id": "PERF_2", "description": "SD FileHandle R/W Speed",314 "source_dir": join(TEST_DIR, "mbed", "sd_perf_fhandle"),315 "dependencies": [MBED_LIBRARIES, TEST_MBED_LIB, FS_LIBRARY],316 "automated": True,317 "duration": 15,318 "peripherals": ["SD"]319 },320 {321 "id": "PERF_3", "description": "SD FatFS R/W Speed",322 "source_dir": join(TEST_DIR, "mbed", "sd_perf_fatfs"),323 "dependencies": [MBED_LIBRARIES, TEST_MBED_LIB, FS_LIBRARY],324 "automated": True,325 "duration": 15,326 "peripherals": ["SD"]327 },328 # Not automated MBED tests329 {330 "id": "MBED_1", "description": "I2C SRF08",331 "source_dir": join(TEST_DIR, "mbed", "i2c_SRF08"),332 "dependencies": [MBED_LIBRARIES, TEST_MBED_LIB, join(PERIPHERALS, 'SRF08')],333 "peripherals": ["SRF08"]334 },335 {336 "id": "MBED_2", "description": "stdio",337 "source_dir": join(TEST_DIR, "mbed", "stdio"),338 "dependencies": [MBED_LIBRARIES, TEST_MBED_LIB],339 "duration": 20,340 "automated": True,341 #"host_test": "stdio_auto"342 },343 {344 "id": "MBED_3", "description": "PortOut",345 "source_dir": join(TEST_DIR, "mbed", "portout"),346 "dependencies": [MBED_LIBRARIES],347 },348 {349 "id": "MBED_4", "description": "Sleep",350 "source_dir": join(TEST_DIR, "mbed", "sleep"),351 "dependencies": [MBED_LIBRARIES, TEST_MBED_LIB],352 "duration": 30,353 "mcu": ["LPC1768", "LPC11U24", "LPC4088","LPC4088_DM","NRF51822", "LPC11U68"]354 },355 {356 "id": "MBED_5", "description": "PWM",357 "source_dir": join(TEST_DIR, "mbed", "pwm"),358 "dependencies": [MBED_LIBRARIES, TEST_MBED_LIB],359 },360 {361 "id": "MBED_6", "description": "SW Reset",362 "source_dir": join(TEST_DIR, "mbed", "reset"),363 "dependencies": [MBED_LIBRARIES],364 "duration": 15365 },366 {367 "id": "MBED_7", "description": "stdio benchmark",368 "source_dir": join(TEST_DIR, "mbed", "stdio_benchmark"),369 "dependencies": [MBED_LIBRARIES],370 "duration": 40371 },372 {373 "id": "MBED_8", "description": "SPI",374 "source_dir": join(TEST_DIR, "mbed", "spi"),375 "dependencies": [MBED_LIBRARIES],376 },377 {378 "id": "MBED_9", "description": "Sleep Timeout",379 "source_dir": join(TEST_DIR, "mbed", "sleep_timeout"),380 "dependencies": [MBED_LIBRARIES],381 },382 {383 "id": "MBED_10", "description": "Hello World",384 "source_dir": join(TEST_DIR, "mbed", "hello"),385 "dependencies": [MBED_LIBRARIES, TEST_MBED_LIB],386 "automated": True,387 #"host_test": "hello_auto",388 },389 {390 "id": "MBED_11", "description": "Ticker Int",391 "source_dir": join(TEST_DIR, "mbed", "ticker"),392 "dependencies": [MBED_LIBRARIES, TEST_MBED_LIB],393 "automated": True,394 #"host_test": "wait_us_auto",395 "duration": 20,396 },397 {398 "id": "MBED_12", "description": "C++",399 "source_dir": join(TEST_DIR, "mbed", "cpp"),400 "dependencies": [MBED_LIBRARIES, TEST_MBED_LIB],401 "automated": True402 },403 {404 "id": "MBED_13", "description": "Heap & Stack",405 "source_dir": join(TEST_DIR, "mbed", "heap_and_stack"),406 "dependencies": [MBED_LIBRARIES, TEST_MBED_LIB],407 },408 {409 "id": "MBED_14", "description": "Serial Interrupt",410 "source_dir": join(TEST_DIR, "mbed", "serial_interrupt"),411 "dependencies": [MBED_LIBRARIES, TEST_MBED_LIB],412 },413 {414 "id": "MBED_15", "description": "RPC",415 "source_dir": join(TEST_DIR, "mbed", "rpc"),416 "dependencies": [MBED_LIBRARIES, join(LIB_DIR, "rpc"), TEST_MBED_LIB],417 "automated": False,418 "mcu": ["LPC1768"]419 },420 {421 "id": "MBED_16", "description": "RTC",422 "source_dir": join(TEST_DIR, "mbed", "rtc"),423 "dependencies": [MBED_LIBRARIES, TEST_MBED_LIB],424 "automated": True,425 #"host_test": "rtc_auto",426 "duration": 15427 },428 {429 "id": "MBED_17", "description": "Serial Interrupt 2",430 "source_dir": join(TEST_DIR, "mbed", "serial_interrupt_2"),431 "dependencies": [MBED_LIBRARIES],432 },433 {434 "id": "MBED_18", "description": "Local FS Directory",435 "source_dir": join(TEST_DIR, "mbed", "dir"),436 "dependencies": [MBED_LIBRARIES],437 },438 {439 "id": "MBED_19", "description": "SD FS Directory",440 "source_dir": join(TEST_DIR, "mbed", "dir_sd"),441 "dependencies": [MBED_LIBRARIES, FS_LIBRARY],442 "peripherals": ["SD"]443 },444 {445 "id": "MBED_20", "description": "InterruptIn 2",446 "source_dir": join(TEST_DIR, "mbed", "interruptin_2"),447 "dependencies": [MBED_LIBRARIES],448 },449 {450 "id": "MBED_21", "description": "freopen Stream",451 "source_dir": join(TEST_DIR, "mbed", "freopen"),452 "dependencies": [MBED_LIBRARIES],453 },454 {455 "id": "MBED_22", "description": "Semihost",456 "source_dir": join(TEST_DIR, "mbed", "semihost"),457 "dependencies": [MBED_LIBRARIES, TEST_MBED_LIB],458 "automated": True,459 "mcu": ["LPC1768", "LPC2368", "LPC11U24"]460 },461 {462 "id": "MBED_23", "description": "Ticker Int us",463 "source_dir": join(TEST_DIR, "mbed", "ticker_2"),464 "dependencies": [MBED_LIBRARIES, TEST_MBED_LIB],465 "duration": 15,466 "automated": True,467 #"host_test": "wait_us_auto"468 },469 {470 "id": "MBED_24", "description": "Timeout Int us",471 "source_dir": join(TEST_DIR, "mbed", "timeout"),472 "dependencies": [MBED_LIBRARIES, TEST_MBED_LIB],473 "duration": 15,474 "automated": True,475 #"host_test": "wait_us_auto"476 },477 {478 "id": "MBED_25", "description": "Time us",479 "source_dir": join(TEST_DIR, "mbed", "time_us"),480 "dependencies": [MBED_LIBRARIES, TEST_MBED_LIB],481 "duration": 15,482 "automated": True,483 #"host_test": "wait_us_auto"484 },485 {486 "id": "MBED_26", "description": "Integer constant division",487 "source_dir": join(TEST_DIR, "mbed", "div"),488 "dependencies": [MBED_LIBRARIES, TEST_MBED_LIB],489 "automated": True,490 },491 {492 "id": "MBED_27", "description": "SPI ADXL345",493 "source_dir": join(TEST_DIR, "mbed", "spi_ADXL345"),494 "dependencies": [MBED_LIBRARIES, TEST_MBED_LIB, join(PERIPHERALS, 'ADXL345')],495 "peripherals": ["ADXL345"]496 },497 {498 "id": "MBED_28", "description": "Interrupt chaining (InterruptManager)",499 "source_dir": join(TEST_DIR, "mbed", "interrupt_chaining"),500 "dependencies": [MBED_LIBRARIES, TEST_MBED_LIB],501 },502 {503 "id": "MBED_29", "description": "CAN network test",504 "source_dir": join(TEST_DIR, "mbed", "can"),505 "dependencies": [MBED_LIBRARIES],506 "mcu": ["LPC1768", "LPC4088", "LPC1549"]507 },508 {509 "id": "MBED_30", "description": "CAN network test using interrupts",510 "source_dir": join(TEST_DIR, "mbed", "can_interrupt"),511 "dependencies": [MBED_LIBRARIES],512 "mcu": ["LPC1768", "LPC4088", "LPC1549"]513 },514 {515 "id": "MBED_31", "description": "PWM LED test",516 "source_dir": join(TEST_DIR, "mbed", "pwm_led"),517 "dependencies": [MBED_LIBRARIES],518 },519 {520 "id": "MBED_32", "description": "Pin toggling",521 "source_dir": join(TEST_DIR, "mbed", "pin_toggling"),522 "dependencies": [MBED_LIBRARIES],523 },524 {525 "id": "MBED_33", "description": "C string operations",526 "source_dir": join(TEST_DIR, "mbed", "cstring"),527 "dependencies": [MBED_LIBRARIES, TEST_MBED_LIB],528 "duration": 10,529 "automated": False,530 },531 {532 "id": "MBED_34", "description": "Ticker Two callbacks",533 "source_dir": join(TEST_DIR, "mbed", "ticker_3"),534 "dependencies": [MBED_LIBRARIES, TEST_MBED_LIB],535 "duration": 15,536 "automated": True,537 #"host_test": "wait_us_auto"538 },539 # CMSIS RTOS tests540 {541 "id": "CMSIS_RTOS_1", "description": "Basic",542 "source_dir": join(TEST_DIR, "rtos", "cmsis", "basic"),543 "dependencies": [MBED_LIBRARIES, RTOS_LIBRARIES],544 },545 {546 "id": "CMSIS_RTOS_2", "description": "Mutex",547 "source_dir": join(TEST_DIR, "rtos", "cmsis", "mutex"),548 "dependencies": [MBED_LIBRARIES, RTOS_LIBRARIES],549 "duration": 20550 },551 {552 "id": "CMSIS_RTOS_3", "description": "Semaphore",553 "source_dir": join(TEST_DIR, "rtos", "cmsis", "semaphore"),554 "dependencies": [MBED_LIBRARIES, RTOS_LIBRARIES],555 "duration": 20556 },557 {558 "id": "CMSIS_RTOS_4", "description": "Signals",559 "source_dir": join(TEST_DIR, "rtos", "cmsis", "signals"),560 "dependencies": [MBED_LIBRARIES, RTOS_LIBRARIES],561 },562 {563 "id": "CMSIS_RTOS_5", "description": "Queue",564 "source_dir": join(TEST_DIR, "rtos", "cmsis", "queue"),565 "dependencies": [MBED_LIBRARIES, RTOS_LIBRARIES],566 "duration": 20567 },568 {569 "id": "CMSIS_RTOS_6", "description": "Mail",570 "source_dir": join(TEST_DIR, "rtos", "cmsis", "mail"),571 "dependencies": [MBED_LIBRARIES, RTOS_LIBRARIES],572 "duration": 20573 },574 {575 "id": "CMSIS_RTOS_7", "description": "Timer",576 "source_dir": join(TEST_DIR, "rtos", "cmsis", "timer"),577 "dependencies": [MBED_LIBRARIES, RTOS_LIBRARIES],578 },579 {580 "id": "CMSIS_RTOS_8", "description": "ISR",581 "source_dir": join(TEST_DIR, "rtos", "cmsis", "isr"),582 "dependencies": [MBED_LIBRARIES, RTOS_LIBRARIES],583 },584 # mbed RTOS tests585 {586 "id": "RTOS_1", "description": "Basic thread",587 "source_dir": join(TEST_DIR, "rtos", "mbed", "basic"),588 "dependencies": [MBED_LIBRARIES, RTOS_LIBRARIES, TEST_MBED_LIB],589 "duration": 15,590 "automated": True,591 #"host_test": "wait_us_auto",592 "mcu": ["LPC1768", "LPC1549", "LPC11U24", "LPC812",593 "KL25Z", "KL05Z", "K64F", "KL46Z",594 "RZ_A1H", "DISCO_F407VG", "DISCO_F429ZI", "NUCLEO_F411RE",595 "NUCLEO_F401RE", "NUCLEO_F334R8", "DISCO_F334C8", "NUCLEO_F302R8",596 "NUCLEO_L053R8", "DISCO_L053C8", "NUCLEO_L073RZ", "NUCLEO_F072RB", "NUCLEO_F091RC",597 "DISCO_F401VC", "NUCLEO_F303RE", "MAXWSNENV", "MAX32600MBED"],598 },599 {600 "id": "RTOS_2", "description": "Mutex resource lock",601 "source_dir": join(TEST_DIR, "rtos", "mbed", "mutex"),602 "dependencies": [MBED_LIBRARIES, RTOS_LIBRARIES, TEST_MBED_LIB],603 "duration": 20,604 "automated": True,605 "mcu": ["LPC1768", "LPC1549", "LPC11U24", "LPC812",606 "KL25Z", "KL05Z", "K64F", "KL46Z",607 "RZ_A1H", "DISCO_F407VG", "DISCO_F429ZI", "NUCLEO_F411RE",608 "NUCLEO_F401RE", "NUCLEO_F334R8", "DISCO_F334C8", "NUCLEO_F302R8",609 "NUCLEO_L053R8", "DISCO_L053C8", "NUCLEO_L073RZ", "NUCLEO_F072RB", "NUCLEO_F091RC",610 "DISCO_F401VC", "NUCLEO_F303RE", "MAXWSNENV", "MAX32600MBED"],611 },612 {613 "id": "RTOS_3", "description": "Semaphore resource lock",614 "source_dir": join(TEST_DIR, "rtos", "mbed", "semaphore"),615 "dependencies": [MBED_LIBRARIES, RTOS_LIBRARIES, TEST_MBED_LIB],616 "duration": 20,617 "automated": True,618 "mcu": ["LPC1768", "LPC1549", "LPC11U24", "LPC812",619 "KL25Z", "KL05Z", "K64F", "KL46Z",620 "RZ_A1H", "DISCO_F407VG", "DISCO_F429ZI", "NUCLEO_F411RE",621 "NUCLEO_F401RE", "NUCLEO_F334R8", "DISCO_F334C8", "NUCLEO_F302R8",622 "NUCLEO_L053R8", "DISCO_L053C8", "NUCLEO_L073RZ", "NUCLEO_F072RB", "NUCLEO_F091RC",623 "DISCO_F401VC", "NUCLEO_F303RE", "MAXWSNENV", "MAX32600MBED"],624 },625 {626 "id": "RTOS_4", "description": "Signals messaging",627 "source_dir": join(TEST_DIR, "rtos", "mbed", "signals"),628 "dependencies": [MBED_LIBRARIES, RTOS_LIBRARIES, TEST_MBED_LIB],629 "automated": True,630 "mcu": ["LPC1768", "LPC1549", "LPC11U24", "LPC812",631 "KL25Z", "KL05Z", "K64F", "KL46Z",632 "RZ_A1H", "DISCO_F407VG", "DISCO_F429ZI", "NUCLEO_F411RE",633 "NUCLEO_F401RE", "NUCLEO_F334R8", "DISCO_F334C8", "NUCLEO_F302R8",634 "NUCLEO_L053R8", "DISCO_L053C8", "NUCLEO_L073RZ", "NUCLEO_F072RB", "NUCLEO_F091RC",635 "DISCO_F401VC", "NUCLEO_F303RE", "MAXWSNENV", "MAX32600MBED"],636 },637 {638 "id": "RTOS_5", "description": "Queue messaging",639 "source_dir": join(TEST_DIR, "rtos", "mbed", "queue"),640 "dependencies": [MBED_LIBRARIES, RTOS_LIBRARIES, TEST_MBED_LIB],641 "automated": True,642 "mcu": ["LPC1768", "LPC1549", "LPC11U24", "LPC812",643 "KL25Z", "KL05Z", "K64F", "KL46Z",644 "RZ_A1H", "DISCO_F407VG", "DISCO_F429ZI", "NUCLEO_F411RE",645 "NUCLEO_F401RE", "NUCLEO_F334R8", "DISCO_F334C8", "NUCLEO_F302R8",646 "NUCLEO_L053R8", "DISCO_L053C8", "NUCLEO_L073RZ", "NUCLEO_F072RB", "NUCLEO_F091RC",647 "DISCO_F401VC", "NUCLEO_F303RE", "MAXWSNENV", "MAX32600MBED"],648 },649 {650 "id": "RTOS_6", "description": "Mail messaging",651 "source_dir": join(TEST_DIR, "rtos", "mbed", "mail"),652 "dependencies": [MBED_LIBRARIES, RTOS_LIBRARIES, TEST_MBED_LIB],653 "automated": True,654 "mcu": ["LPC1768", "LPC1549", "LPC11U24", "LPC812",655 "KL25Z", "KL05Z", "K64F", "KL46Z",656 "RZ_A1H", "DISCO_F407VG", "DISCO_F429ZI", "NUCLEO_F411RE",657 "NUCLEO_F401RE", "NUCLEO_F334R8", "DISCO_F334C8", "NUCLEO_F302R8",658 "NUCLEO_L053R8", "DISCO_L053C8", "NUCLEO_L073RZ", "NUCLEO_F072RB", "NUCLEO_F091RC",659 "DISCO_F401VC", "NUCLEO_F303RE", "MAXWSNENV", "MAX32600MBED"],660 },661 {662 "id": "RTOS_7", "description": "Timer",663 "source_dir": join(TEST_DIR, "rtos", "mbed", "timer"),664 "dependencies": [MBED_LIBRARIES, RTOS_LIBRARIES, TEST_MBED_LIB],665 "duration": 15,666 "automated": True,667 #"host_test": "wait_us_auto",668 "mcu": ["LPC1768", "LPC1549", "LPC11U24", "LPC812",669 "KL25Z", "KL05Z", "K64F", "KL46Z",670 "RZ_A1H", "DISCO_F407VG", "DISCO_F429ZI", "NUCLEO_F411RE",671 "NUCLEO_F401RE", "NUCLEO_F334R8", "DISCO_F334C8", "NUCLEO_F302R8",672 "NUCLEO_L053R8", "DISCO_L053C8", "NUCLEO_L073RZ", "NUCLEO_F072RB", "NUCLEO_F091RC",673 "DISCO_F401VC", "NUCLEO_F303RE", "MAXWSNENV", "MAX32600MBED"],674 },675 {676 "id": "RTOS_8", "description": "ISR (Queue)",677 "source_dir": join(TEST_DIR, "rtos", "mbed", "isr"),678 "dependencies": [MBED_LIBRARIES, RTOS_LIBRARIES, TEST_MBED_LIB],679 "automated": True,680 "mcu": ["LPC1768", "LPC1549", "LPC11U24", "LPC812",681 "KL25Z", "KL05Z", "K64F", "KL46Z",682 "RZ_A1H", "DISCO_F407VG", "DISCO_F429ZI", "NUCLEO_F411RE",683 "NUCLEO_F401RE", "NUCLEO_F334R8", "DISCO_F334C8", "NUCLEO_F302R8",684 "NUCLEO_L053R8", "DISCO_L053C8", "NUCLEO_L073RZ", "NUCLEO_F072RB", "NUCLEO_F091RC",685 "DISCO_F401VC", "NUCLEO_F303RE", "MAXWSNENV", "MAX32600MBED"],686 },687 {688 "id": "RTOS_9", "description": "SD File write-read",689 "source_dir": join(TEST_DIR, "rtos", "mbed", "file"),690 "dependencies": [MBED_LIBRARIES, RTOS_LIBRARIES, TEST_MBED_LIB, FS_LIBRARY],691 "automated": True,692 "peripherals": ["SD"],693 "mcu": ["LPC1768", "LPC11U24", "LPC812", "KL25Z",694 "KL05Z", "K64F", "KL46Z", "RZ_A1H",695 "DISCO_F407VG", "DISCO_F429ZI", "NUCLEO_F411RE", "NUCLEO_F401RE"],696 },697 # Networking Tests698 {699 "id": "NET_1", "description": "TCP client hello world",700 "source_dir": join(TEST_DIR, "net", "helloworld", "tcpclient"),701 "dependencies": [MBED_LIBRARIES, RTOS_LIBRARIES, ETH_LIBRARY, TEST_MBED_LIB],702 "duration": 15,703 "automated": True,704 "peripherals": ["ethernet"],705 },706 {707 "id": "NET_2", "description": "NIST Internet Time Service",708 "source_dir": join(TEST_DIR, "net", "helloworld", "udpclient"),709 "dependencies": [MBED_LIBRARIES, RTOS_LIBRARIES, ETH_LIBRARY, TEST_MBED_LIB],710 "duration": 15,711 "automated": True,712 "peripherals": ["ethernet"],713 },714 {715 "id": "NET_3", "description": "TCP echo server",716 "source_dir": join(TEST_DIR, "net", "echo", "tcp_server"),717 "dependencies": [MBED_LIBRARIES, RTOS_LIBRARIES, ETH_LIBRARY, TEST_MBED_LIB],718 "automated": True,719 #"host_test" : "tcpecho_server_auto",720 "peripherals": ["ethernet"],721 },722 {723 "id": "NET_4", "description": "TCP echo client",724 "source_dir": join(TEST_DIR, "net", "echo", "tcp_client"),725 "dependencies": [MBED_LIBRARIES, RTOS_LIBRARIES, ETH_LIBRARY, TEST_MBED_LIB],726 "automated": True,727 #"host_test": "tcpecho_client_auto",728 "peripherals": ["ethernet"]729 },730 {731 "id": "NET_5", "description": "UDP echo server",732 "source_dir": join(TEST_DIR, "net", "echo", "udp_server"),733 "dependencies": [MBED_LIBRARIES, RTOS_LIBRARIES, ETH_LIBRARY, TEST_MBED_LIB],734 "automated": True,735 #"host_test" : "udpecho_server_auto",736 "peripherals": ["ethernet"]737 },738 {739 "id": "NET_6", "description": "UDP echo client",740 "source_dir": join(TEST_DIR, "net", "echo", "udp_client"),741 "dependencies": [MBED_LIBRARIES, RTOS_LIBRARIES, ETH_LIBRARY, TEST_MBED_LIB],742 "automated": True,743 #"host_test" : "udpecho_client_auto",744 "peripherals": ["ethernet"],745 },746 {747 "id": "NET_7", "description": "HTTP client hello world",748 "source_dir": join(TEST_DIR, "net", "protocols", "HTTPClient_HelloWorld"),749 "dependencies": [MBED_LIBRARIES, RTOS_LIBRARIES, ETH_LIBRARY, TEST_MBED_LIB],750 "automated": True,751 "duration": 15,752 "peripherals": ["ethernet"],753 },754 {755 "id": "NET_8", "description": "NTP client",756 "source_dir": join(TEST_DIR, "net", "protocols", "NTPClient_HelloWorld"),757 "dependencies": [MBED_LIBRARIES, RTOS_LIBRARIES, ETH_LIBRARY, TEST_MBED_LIB],758 "automated": True,759 "peripherals": ["ethernet"],760 },761 {762 "id": "NET_9", "description": "Multicast Send",763 "source_dir": join(TEST_DIR, "net", "helloworld", "multicast_send"),764 "dependencies": [MBED_LIBRARIES, RTOS_LIBRARIES, ETH_LIBRARY],765 "peripherals": ["ethernet"],766 },767 {768 "id": "NET_10", "description": "Multicast Receive",769 "source_dir": join(TEST_DIR, "net", "helloworld", "multicast_receive"),770 "dependencies": [MBED_LIBRARIES, RTOS_LIBRARIES, ETH_LIBRARY],771 "peripherals": ["ethernet"],772 },773 {774 "id": "NET_11", "description": "Broadcast Send",775 "source_dir": join(TEST_DIR, "net", "helloworld", "broadcast_send"),776 "dependencies": [MBED_LIBRARIES, RTOS_LIBRARIES, ETH_LIBRARY],777 "peripherals": ["ethernet"],778 },779 {780 "id": "NET_12", "description": "Broadcast Receive",781 "source_dir": join(TEST_DIR, "net", "helloworld", "broadcast_receive"),782 "dependencies": [MBED_LIBRARIES, RTOS_LIBRARIES, ETH_LIBRARY],783 "peripherals": ["ethernet"],784 },785 {786 "id": "NET_13", "description": "TCP client echo loop",787 "source_dir": join(TEST_DIR, "net", "echo", "tcp_client_loop"),788 "dependencies": [MBED_LIBRARIES, RTOS_LIBRARIES, ETH_LIBRARY, TEST_MBED_LIB],789 "automated": True,790 "duration": 15,791 #"host_test": "tcpecho_client_auto",792 "peripherals": ["ethernet"],793 },794 {795 "id": "NET_14", "description": "UDP PHY/Data link layer",796 "source_dir": join(TEST_DIR, "net", "echo", "udp_link_layer"),797 "dependencies": [MBED_LIBRARIES, RTOS_LIBRARIES, ETH_LIBRARY],798 "automated": False,799 "duration": 20,800 "host_test": "udp_link_layer_auto",801 "peripherals": ["ethernet"],802 },803 # u-blox tests804 {805 "id": "UB_1", "description": "u-blox USB modem: HTTP client",806 "source_dir": [join(TEST_DIR, "net", "cellular", "http", "ubloxusb"), join(TEST_DIR, "net", "cellular", "http", "common")],807 "dependencies": [MBED_LIBRARIES, RTOS_LIBRARIES, USB_HOST_LIBRARIES, UBLOX_LIBRARY],808 "supported": CORTEX_ARM_SUPPORT,809 },810 {811 "id": "UB_2", "description": "u-blox USB modem: SMS test",812 "source_dir": [join(TEST_DIR, "net", "cellular", "sms", "ubloxusb"), join(TEST_DIR, "net", "cellular", "sms", "common")],813 "dependencies": [MBED_LIBRARIES, RTOS_LIBRARIES, USB_HOST_LIBRARIES, UBLOX_LIBRARY],814 "supported": CORTEX_ARM_SUPPORT,815 },816 # USB Tests817 {818 "id": "USB_1", "description": "Mouse",819 "source_dir": join(TEST_DIR, "usb", "device", "basic"),820 "dependencies": [MBED_LIBRARIES, USB_LIBRARIES],821 },822 {823 "id": "USB_2", "description": "Keyboard",824 "source_dir": join(TEST_DIR, "usb", "device", "keyboard"),825 "dependencies": [MBED_LIBRARIES, USB_LIBRARIES],826 },827 {828 "id": "USB_3", "description": "Mouse_Keyboard",829 "source_dir": join(TEST_DIR, "usb", "device", "keyboard"),830 "dependencies": [MBED_LIBRARIES, USB_LIBRARIES],831 },832 {833 "id": "USB_4", "description": "Serial Port",834 "source_dir": join(TEST_DIR, "usb", "device", "serial"),835 "dependencies": [MBED_LIBRARIES, USB_LIBRARIES],836 "supported": CORTEX_ARM_SUPPORT,837 },838 {839 "id": "USB_5", "description": "Generic HID",840 "source_dir": join(TEST_DIR, "usb", "device", "raw_hid"),841 "dependencies": [MBED_LIBRARIES, USB_LIBRARIES],842 },843 {844 "id": "USB_6", "description": "MIDI",845 "source_dir": join(TEST_DIR, "usb", "device", "midi"),846 "dependencies": [MBED_LIBRARIES, USB_LIBRARIES],847 },848 {849 "id": "USB_7", "description": "AUDIO",850 "source_dir": join(TEST_DIR, "usb", "device", "audio"),851 "dependencies": [MBED_LIBRARIES, USB_LIBRARIES],852 },853 # CMSIS DSP854 {855 "id": "CMSIS_DSP_1", "description": "FIR",856 "source_dir": join(TEST_DIR, "dsp", "cmsis", "fir_f32"),857 "dependencies": [MBED_LIBRARIES, DSP_LIBRARIES],858 },859 # mbed DSP860 {861 "id": "DSP_1", "description": "FIR",862 "source_dir": join(TEST_DIR, "dsp", "mbed", "fir_f32"),863 "dependencies": [MBED_LIBRARIES, DSP_LIBRARIES],864 },865 # KL25Z866 {867 "id": "KL25Z_1", "description": "LPTMR",868 "source_dir": join(TEST_DIR, "KL25Z", "lptmr"),869 "dependencies": [MBED_LIBRARIES],870 "supported": CORTEX_ARM_SUPPORT,871 "mcu": ["KL25Z"],872 },873 {874 "id": "KL25Z_2", "description": "PIT",875 "source_dir": join(TEST_DIR, "KL25Z", "pit"),876 "dependencies": [MBED_LIBRARIES],877 "supported": CORTEX_ARM_SUPPORT,878 "mcu": ["KL25Z"],879 },880 {881 "id": "KL25Z_3", "description": "TSI Touch Sensor",882 "source_dir": join(TEST_DIR, "mbed", "tsi"),883 "dependencies": [MBED_LIBRARIES, TEST_MBED_LIB, join(PERIPHERALS, 'TSI')],884 "mcu": ["KL25Z"],885 },886 {887 "id": "KL25Z_4", "description": "RTC",888 "source_dir": join(TEST_DIR, "KL25Z", "rtc"),889 "dependencies": [MBED_LIBRARIES],890 "mcu": ["KL25Z"],891 },892 {893 "id": "KL25Z_5", "description": "MMA8451Q accelerometer",894 "source_dir": join(TEST_DIR, "mbed", "i2c_MMA8451Q"),895 "dependencies": [MBED_LIBRARIES, TEST_MBED_LIB, join(PERIPHERALS, 'MMA8451Q')],896 "mcu": ["KL25Z", "KL05Z", "KL46Z", "K20D50M"],897 "automated": True,898 "duration": 15,899 },900 # Examples901 {902 "id": "EXAMPLE_1", "description": "/dev/null",903 "source_dir": join(TEST_DIR, "mbed", "dev_null"),904 "dependencies": [MBED_LIBRARIES, TEST_MBED_LIB],905 "automated": True,906 #"host_test" : "dev_null_auto",907 },908 {909 "id": "EXAMPLE_2", "description": "FS + RTOS",910 "source_dir": join(TEST_DIR, "mbed", "fs"),911 "dependencies": [MBED_LIBRARIES, RTOS_LIBRARIES, TEST_MBED_LIB, FS_LIBRARY],912 },913 # CPPUTEST Library provides Unit testing Framework914 #915 # To write TESTs and TEST_GROUPs please add CPPUTEST_LIBRARY to 'dependencies'916 #917 # This will also include:918 # 1. test runner - main function with call to CommandLineTestRunner::RunAllTests(ac, av)919 # 2. Serial console object to print test result on serial port console920 #921 # Unit testing with cpputest library922 {923 "id": "UT_1", "description": "Basic",924 "source_dir": join(TEST_DIR, "utest", "basic"),925 "dependencies": [MBED_LIBRARIES, TEST_MBED_LIB, CPPUTEST_LIBRARY],926 "automated": False,927 },928 {929 "id": "UT_2", "description": "Semihost file system",930 "source_dir": join(TEST_DIR, "utest", "semihost_fs"),931 "dependencies": [MBED_LIBRARIES, TEST_MBED_LIB, CPPUTEST_LIBRARY],932 "automated": False,933 "mcu": ["LPC1768", "LPC2368", "LPC11U24"]934 },935 {936 "id": "UT_3", "description": "General tests",937 "source_dir": join(TEST_DIR, "utest", "general"),938 "dependencies": [MBED_LIBRARIES, TEST_MBED_LIB, CPPUTEST_LIBRARY],939 "automated": False,940 },941 {942 "id": "UT_BUSIO", "description": "BusIn BusOut",943 "source_dir": join(TEST_DIR, "utest", "bus"),944 "dependencies": [MBED_LIBRARIES, TEST_MBED_LIB, CPPUTEST_LIBRARY],945 "automated": False,946 },947 # Tests used for target information purposes948 {949 "id": "DTCT_1", "description": "Simple detect test",950 "source_dir": join(TEST_DIR, "mbed", "detect"),951 "dependencies": [MBED_LIBRARIES, TEST_MBED_LIB],952 "automated": True,953 #"host_test" : "detect_auto",954 },955]956# Group tests with the same goals into categories957GROUPS = {958 "core": ["MBED_A1", "MBED_A2", "MBED_A3", "MBED_A18"],959 "digital_io": ["MBED_A5", "MBED_A6", "MBED_A7", "MBED_A10", "MBED_A11"],960 "analog_io": ["MBED_A8"],961 "i2c": ["MBED_A19", "MBED_A20"],962 "spi": ["MBED_A12"],963}964GROUPS["rtos"] = [test["id"] for test in TESTS if test["id"].startswith("RTOS_")]965GROUPS["net"] = [test["id"] for test in TESTS if test["id"].startswith("NET_")]966GROUPS["automated"] = [test["id"] for test in TESTS if test.get("automated", False)]967# Look for 'TEST_GROUPS' in private_settings.py and update the GROUPS dictionary968# with the information in test_groups if found969try:970 from workspace_tools.private_settings import TEST_GROUPS971except:972 TEST_GROUPS = {}973GROUPS.update(TEST_GROUPS)974class Test:975 DEFAULTS = {976 #'mcu': None,977 'description': None,978 'dependencies': None,979 'duration': 10,980 'host_test': 'host_test',981 'automated': False,982 'peripherals': None,983 #'supported': None,984 'source_dir': None,985 'extra_files': None986 }987 def __init__(self, n):988 self.n = n989 self.__dict__.update(Test.DEFAULTS)990 self.__dict__.update(TESTS[n])991 def is_supported(self, target, toolchain):992 if hasattr(self, 'mcu') and not target in self.mcu:993 return False994 if not hasattr(self, 'supported'):995 return True996 return (target in self.supported) and (toolchain in self.supported[target])997 def get_description(self):998 if self.description:999 return self.description1000 else:1001 return self.id1002 def __cmp__(self, other):1003 return cmp(self.n, other.n)1004 def __str__(self):1005 return "[%3d] %s: %s" % (self.n, self.id, self.get_description())1006 def __getitem__(self, key):1007 if key == "id": return self.id1008 elif key == "mcu": return self.mcu1009 elif key == "dependencies": return self.dependencies1010 elif key == "description": return self.description1011 elif key == "duration": return self.duration1012 elif key == "host_test": return self.host_test1013 elif key == "automated": return self.automated1014 elif key == "peripherals": return self.peripherals1015 elif key == "supported": return self.supported1016 elif key == "source_dir": return self.source_dir1017 elif key == "extra_files": return self.extra_files1018 else:1019 return None...

Full Screen

Full Screen

django.py

Source:django.py Github

copy

Full Screen

...15 options.setdefault('autoescape', True)16 options.setdefault('debug', settings.DEBUG)17 options.setdefault('file_charset', 'utf-8')18 libraries = options.get('libraries', {})19 options['libraries'] = self.get_templatetag_libraries(libraries)20 super().__init__(params)21 self.engine = Engine(self.dirs, self.app_dirs, **options)22 def from_string(self, template_code):23 return Template(self.engine.from_string(template_code), self)24 def get_template(self, template_name):25 try:26 return Template(self.engine.get_template(template_name), self)27 except TemplateDoesNotExist as exc:28 reraise(exc, self)29 def get_templatetag_libraries(self, custom_libraries):30 """31 Return a collation of template tag libraries from installed32 applications and the supplied custom_libraries argument.33 """34 libraries = get_installed_libraries()35 libraries.update(custom_libraries)36 return libraries37class Template:38 def __init__(self, template, backend):39 self.template = template40 self.backend = backend41 @property42 def origin(self):43 return self.template.origin44 def render(self, context=None, request=None):45 context = make_context(context, request, autoescape=self.backend.engine.autoescape)46 try:47 return self.template.render(context)48 except TemplateDoesNotExist as exc:49 reraise(exc, self.backend)50def copy_exception(exc, backend=None):51 """52 Create a new TemplateDoesNotExist. Preserve its declared attributes and53 template debug data but discard __traceback__, __context__, and __cause__54 to make this object suitable for keeping around (in a cache, for example).55 """56 backend = backend or exc.backend57 new = exc.__class__(*exc.args, tried=exc.tried, backend=backend, chain=exc.chain)58 if hasattr(exc, 'template_debug'):59 new.template_debug = exc.template_debug60 return new61def reraise(exc, backend):62 """63 Reraise TemplateDoesNotExist while maintaining template debug information.64 """65 new = copy_exception(exc, backend)66 raise new from exc67def get_installed_libraries():68 """69 Return the built-in template tag libraries and those from installed70 applications. Libraries are stored in a dictionary where keys are the71 individual module names, not the full module paths. Example:72 django.templatetags.i18n is stored as i18n.73 """74 libraries = {}75 candidates = ['django.templatetags']76 candidates.extend(77 '%s.templatetags' % app_config.name78 for app_config in apps.get_app_configs())79 for candidate in candidates:80 try:81 pkg = import_module(candidate)82 except ImportError:83 # No templatetags package defined. This is safe to ignore.84 continue85 if hasattr(pkg, '__path__'):86 for name in get_package_libraries(pkg):87 libraries[name[len(candidate) + 1:]] = name88 return libraries89def get_package_libraries(pkg):90 """91 Recursively yield template tag libraries defined in submodules of a92 package.93 """94 for entry in walk_packages(pkg.__path__, pkg.__name__ + '.'):95 try:96 module = import_module(entry[1])97 except ImportError as e:98 raise InvalidTemplateLibrary(99 "Invalid template library specified. ImportError raised when "100 "trying to load '%s': %s" % (entry[1], e)101 )102 if hasattr(module, 'register'):103 yield entry[1]

Full Screen

Full Screen

libraries.py

Source:libraries.py Github

copy

Full Screen

1"""2mbed SDK3Copyright (c) 2011-2013 ARM Limited4Licensed under the Apache License, Version 2.0 (the "License");5you may not use this file except in compliance with the License.6You may obtain a copy of the License at7 http://www.apache.org/licenses/LICENSE-2.08Unless required by applicable law or agreed to in writing, software9distributed under the License is distributed on an "AS IS" BASIS,10WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.11See the License for the specific language governing permissions and12limitations under the License.13"""14from workspace_tools.paths import *15from workspace_tools.data.support import *16from workspace_tools.tests import TEST_MBED_LIB17LIBRARIES = [18 # RTOS libraries19 {20 "id": "rtx",21 "source_dir": MBED_RTX,22 "build_dir": RTOS_LIBRARIES,23 "dependencies": [MBED_LIBRARIES],24 },25 {26 "id": "rtos",27 "source_dir": RTOS_ABSTRACTION,28 "build_dir": RTOS_LIBRARIES,29 "dependencies": [MBED_LIBRARIES, MBED_RTX],30 },31 # USB Device libraries32 {33 "id": "usb",34 "source_dir": USB,35 "build_dir": USB_LIBRARIES,36 "dependencies": [MBED_LIBRARIES],37 },38 # USB Host libraries39 {40 "id": "usb_host",41 "source_dir": USB_HOST,42 "build_dir": USB_HOST_LIBRARIES,43 "dependencies": [MBED_LIBRARIES, FAT_FS, MBED_RTX, RTOS_ABSTRACTION],44 },45 # DSP libraries46 {47 "id": "cmsis_dsp",48 "source_dir": DSP_CMSIS,49 "build_dir": DSP_LIBRARIES,50 "dependencies": [MBED_LIBRARIES],51 },52 {53 "id": "dsp",54 "source_dir": DSP_ABSTRACTION,55 "build_dir": DSP_LIBRARIES,56 "dependencies": [MBED_LIBRARIES, DSP_CMSIS],57 },58 # File system libraries59 {60 "id": "fat",61 "source_dir": [FAT_FS, SD_FS],62 "build_dir": FS_LIBRARY,63 "dependencies": [MBED_LIBRARIES]64 },65 # Network libraries66 {67 "id": "eth",68 "source_dir": [ETH_SOURCES, LWIP_SOURCES],69 "build_dir": ETH_LIBRARY,70 "dependencies": [MBED_LIBRARIES, RTOS_LIBRARIES]71 },72 {73 "id": "ublox",74 "source_dir": [UBLOX_SOURCES, CELLULAR_SOURCES, CELLULAR_USB_SOURCES, LWIP_SOURCES],75 "build_dir": UBLOX_LIBRARY,76 "dependencies": [MBED_LIBRARIES, RTOS_LIBRARIES, USB_HOST_LIBRARIES],77 },78 # Unit Testing library79 {80 "id": "cpputest",81 "source_dir": [CPPUTEST_SRC, CPPUTEST_PLATFORM_SRC, CPPUTEST_TESTRUNNER_SCR],82 "build_dir": CPPUTEST_LIBRARY,83 "dependencies": [MBED_LIBRARIES],84 'inc_dirs': [CPPUTEST_INC, CPPUTEST_PLATFORM_INC, CPPUTEST_TESTRUNNER_INC, TEST_MBED_LIB],85 'inc_dirs_ext': [CPPUTEST_INC_EXT],86 'macros': ["CPPUTEST_USE_MEM_LEAK_DETECTION=0", "CPPUTEST_USE_STD_CPP_LIB=0", "CPPUTEST=1"],87 },88]89LIBRARY_MAP = dict([(library['id'], library) for library in LIBRARIES])90class Library:91 DEFAULTS = {92 "supported": DEFAULT_SUPPORT,93 'dependencies': None,94 'inc_dirs': None, # Include dirs required by library build95 'inc_dirs_ext': None, # Include dirs required by others to use with this library96 'macros': None, # Additional macros you want to define when building library97 }98 def __init__(self, lib_id):99 self.__dict__.update(Library.DEFAULTS)100 self.__dict__.update(LIBRARY_MAP[lib_id])101 def is_supported(self, target, toolchain):102 if not hasattr(self, 'supported'):103 return True...

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