Skip to content

Commit 2ad79c6

Browse files
fundakolrlubos
authored andcommitted
scripts: partition manager: split single test to multiple tests
Refactored partition manager test to multiple tests to have better coverage for each functionality. Signed-off-by: Lukasz Fundakowski <lukasz.fundakowski@nordicsemi.no>
1 parent af3df8e commit 2ad79c6

File tree

5 files changed

+323
-206
lines changed

5 files changed

+323
-206
lines changed

.github/workflows/scripts-test.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ on:
55
branches:
66
- main
77
paths:
8-
- 'scripts/**'
8+
- 'scripts/**/*'
99

1010
jobs:
1111
test-scripts:
@@ -25,4 +25,4 @@ jobs:
2525
- name: Install packages
2626
run: python -m pip install -r scripts/requirements-test.txt
2727
- name: Run tests
28-
run: python -m pytest scripts/bootloader/tests scripts/tests
28+
run: python -m pytest scripts

CODEOWNERS

+1
Original file line numberDiff line numberDiff line change
@@ -691,6 +691,7 @@
691691
/scripts/sdp/ @nrfconnect/ncs-ll-ursus
692692
/scripts/twister/alt/zephyr/tests/drivers/mspi/api/testcase.yaml @nrfconnect/ncs-ll-ursus
693693
/scripts/generate_psa_key_attributes.py @nrfconnect/ncs-aurora
694+
/scripts/tests/ @nrfconnect/ncs-pluto @fundakol
694695

695696
/scripts/docker/*.rst @nrfconnect/ncs-doc-leads
696697
/scripts/hid_configurator/*.rst @nrfconnect/ncs-si-bluebagel-doc

scripts/partition_manager.py

+3-21
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
66

77
import argparse
8-
import yaml
9-
from os import path
108
import sys
9+
from os import path
1110
from pprint import pformat
12-
from io import StringIO
11+
12+
import yaml
1313

1414
PERMITTED_STR_KEYS = ['size', 'region']
1515
END_TO_START = 'end_to_start'
@@ -1050,23 +1050,5 @@ def main():
10501050
write_yaml_out_file(regions, args.output_regions)
10511051

10521052

1053-
def expect_addr_size(td, name, expected_address, expected_size):
1054-
if expected_size is not None:
1055-
assert td[name]['size'] == expected_size, \
1056-
'Size of {} was {}, expected {}.\ntd:{}'.format(name, td[name]['size'], expected_size, pformat(td))
1057-
if expected_address is not None:
1058-
assert td[name]['address'] == expected_address, \
1059-
'Address of {} was {}, expected {}.\ntd:{}'.format(name, td[name]['address'], expected_address, pformat(td))
1060-
if expected_size is not None and expected_address is not None:
1061-
assert td[name]['end_address'] == expected_address + expected_size, \
1062-
'End address of {} was {}, expected {}.\ntd:{}'.format(name, td[name]['end_address'], expected_address + expected_size, pformat(td))
1063-
1064-
1065-
def expect_list(expected, actual):
1066-
expected_list = list(sorted(expected))
1067-
actual_list = list(sorted(actual))
1068-
assert sorted(expected_list) == sorted(actual_list), 'Expected list {}, was {}'.format(expected_list, actual_list)
1069-
1070-
10711053
if __name__ == '__main__':
10721054
main()

scripts/requirements-test.txt

+1
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
cryptography
33
intelhex
44
pytest
5+
pyyaml

0 commit comments

Comments
 (0)