Skip to content

Commit 4dfdb11

Browse files
committed
Move pinvalidate files
1 parent e602adb commit 4dfdb11

File tree

10 files changed

+16
-14
lines changed

10 files changed

+16
-14
lines changed

hal/tests/TESTS/pin_names/pinvalidate.py renamed to hal/tests/pinvalidate/pinvalidate.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def error(self, message):
4848

4949
def find_target_by_path(target_path):
5050
"""Find a target by path."""
51-
mbed_os_root = pathlib.Path(__file__).absolute().parents[4]
51+
mbed_os_root = pathlib.Path(__file__).absolute().parents[3]
5252

5353
targets = dict()
5454

@@ -95,7 +95,7 @@ def find_target_by_path(target_path):
9595

9696
def find_target_by_name(target_name=""):
9797
"""Find a target by name."""
98-
mbed_os_root = pathlib.Path(__file__).absolute().parents[4]
98+
mbed_os_root = pathlib.Path(__file__).absolute().parents[3]
9999

100100
targets = dict()
101101

@@ -131,7 +131,7 @@ def find_target_by_name(target_name=""):
131131

132132
def check_markers(test_mode=False):
133133
"""Validate markers in PinNames.h files"""
134-
mbed_os_root = pathlib.Path(__file__).absolute().parents[4]
134+
mbed_os_root = pathlib.Path(__file__).absolute().parents[3]
135135

136136
errors = []
137137

@@ -185,7 +185,7 @@ def check_markers(test_mode=False):
185185

186186
def check_duplicate_pinnames_files(test_mode=False):
187187
"""Check for duplicate PinNames.h files"""
188-
mbed_os_root = pathlib.Path(__file__).absolute().parents[4]
188+
mbed_os_root = pathlib.Path(__file__).absolute().parents[3]
189189

190190
errors = []
191191

@@ -218,7 +218,7 @@ def check_duplicate_pinnames_files(test_mode=False):
218218

219219
def check_duplicate_markers(test_mode=False):
220220
"""Check target markers in PinNames.h files for duplicates."""
221-
mbed_os_root = pathlib.Path(__file__).absolute().parents[4]
221+
mbed_os_root = pathlib.Path(__file__).absolute().parents[3]
222222

223223
errors = []
224224

@@ -260,7 +260,7 @@ def check_duplicate_markers(test_mode=False):
260260

261261
def target_has_arduino_form_factor(target_name):
262262
"""Check if the target has the Arduino form factor."""
263-
mbed_os_root = pathlib.Path(__file__).absolute().parents[4]
263+
mbed_os_root = pathlib.Path(__file__).absolute().parents[3]
264264

265265
with (
266266
mbed_os_root.joinpath("targets", "targets.json")

hal/tests/TESTS/pin_names/pinvalidate_test.py renamed to hal/tests/pinvalidate/pinvalidate_test.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
"""
1616

1717
import pytest
18+
import os
1819
from pinvalidate import *
1920

2021
@pytest.fixture
@@ -28,27 +29,27 @@ def pin_name_dict(pin_name_content):
2829

2930
def test_marker_check():
3031
expect = [
31-
{'file': '/Users/geopsi01/Development/mbed-os/hal/tests/TESTS/pin_names/test_files/nonexistent_target/PinNames.h', 'error': 'target not found'},
32-
{'file': '/Users/geopsi01/Development/mbed-os/hal/tests/TESTS/pin_names/test_files/misformatted_marker/PinNames.h', 'error': 'marker invalid or not found'},
33-
{'file': '/Users/geopsi01/Development/mbed-os/hal/tests/TESTS/pin_names/test_files/missing_marker/PinNames.h', 'error': 'marker invalid or not found'}
32+
{'file': os.path.abspath('./test_files/nonexistent_target/PinNames.h'), 'error': 'target not found'},
33+
{'file': os.path.abspath('./test_files/misformatted_marker/PinNames.h'), 'error': 'marker invalid or not found'},
34+
{'file': os.path.abspath('./test_files/missing_marker/PinNames.h'), 'error': 'marker invalid or not found'}
3435
]
3536

3637
assert check_markers(test_mode=True) == expect
3738

3839
def test_duplicate_pinnames_files_check():
3940
expect = [
40-
{'file': '/Users/geopsi01/Development/mbed-os/hal/tests/TESTS/pin_names/test_files/PinNames.h', 'error': 'duplicate file'},
41-
{'file': '/Users/geopsi01/Development/mbed-os/hal/tests/TESTS/pin_names/test_files/duplicate_marker/PinNames.h', 'error': 'duplicate file'}
41+
{'file': os.path.abspath('./test_files/PinNames.h'), 'error': 'duplicate file'},
42+
{'file': os.path.abspath('./test_files/duplicate_marker/PinNames.h'), 'error': 'duplicate file'}
4243
]
4344

4445
assert check_duplicate_pinnames_files(test_mode=True) == expect
4546

4647
def test_duplicate_markers_check():
4748
expect = [
48-
{'file': '/Users/geopsi01/Development/mbed-os/hal/tests/TESTS/pin_names/test_files/duplicate_file/PinNames.h', 'error': 'duplicate marker'},
49-
{'file': '/Users/geopsi01/Development/mbed-os/hal/tests/TESTS/pin_names/test_files/duplicate_marker/PinNames.h', 'error': 'duplicate marker'}
49+
{'file': os.path.abspath('./test_files/duplicate_file/PinNames.h'), 'error': 'duplicate marker'},
50+
{'file': os.path.abspath('./test_files/duplicate_marker/PinNames.h'), 'error': 'duplicate marker'}
5051
]
51-
52+
5253
assert check_duplicate_markers(test_mode=True) == expect
5354

5455
def test_pin_name_to_dict(pin_name_dict):
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*

0 commit comments

Comments
 (0)