Skip to content

Commit d364d36

Browse files
author
Cruz Monrreal
authored
Merge pull request #7078 from cmonr/windows-pytest-fixes
Windows pytest fixes
2 parents 2d0e5f0 + 0e85dd8 commit d364d36

File tree

3 files changed

+22
-44
lines changed

3 files changed

+22
-44
lines changed

tools/test/memap/parse_test.py

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import sys
22
from io import open
3+
from os import sep
34
from os.path import isfile, join, dirname
45
import json
56

@@ -20,9 +21,12 @@
2021
def test_parse_armcc():
2122
memap = MemapParser()
2223
memap.parse(join(dirname(__file__), "arm.map"), "ARM")
23-
assert memap.modules == PARSED_ARM_DATA
24-
memap.parse(join(dirname(__file__), "arm.map"), "UARM")
25-
assert memap.modules == PARSED_ARM_DATA
24+
25+
parsed_data_os_agnostic = dict()
26+
for k in PARSED_ARM_DATA:
27+
parsed_data_os_agnostic[k.replace('/', sep)] = PARSED_ARM_DATA[k]
28+
29+
assert memap.modules == parsed_data_os_agnostic
2630

2731
PARSED_IAR_DATA = {
2832
"startup/startup.o": {".text": 0xc0},
@@ -35,7 +39,12 @@ def test_parse_armcc():
3539
def test_parse_iar():
3640
memap = MemapParser()
3741
memap.parse(join(dirname(__file__), "iar.map"), "IAR")
38-
assert memap.modules == PARSED_IAR_DATA
42+
43+
parsed_data_os_agnostic = dict()
44+
for k in PARSED_IAR_DATA:
45+
parsed_data_os_agnostic[k.replace('/', sep)] = PARSED_IAR_DATA[k]
46+
47+
assert memap.modules == parsed_data_os_agnostic
3948

4049
PARSED_GCC_DATA = {
4150
"startup/startup.o": {".text": 0xc0},
@@ -49,9 +58,14 @@ def test_parse_iar():
4958
def test_parse_gcc():
5059
memap = MemapParser()
5160
memap.parse(join(dirname(__file__), "gcc.map"), "GCC_ARM")
52-
assert memap.modules == PARSED_GCC_DATA
61+
62+
parsed_data_os_agnostic = dict()
63+
for k in PARSED_GCC_DATA:
64+
parsed_data_os_agnostic[k.replace('/', sep)] = PARSED_GCC_DATA[k]
65+
66+
assert memap.modules == parsed_data_os_agnostic
5367
memap.parse(join(dirname(__file__), "gcc.map"), "GCC_CR")
54-
assert memap.modules == PARSED_GCC_DATA
68+
assert memap.modules == parsed_data_os_agnostic
5569

5670

5771
def test_add_empty_module():

tools/test/test_api/test_api_test.py

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -59,39 +59,3 @@ def test_find_tests_app_config(base_dir, target, toolchain_name, app_config):
5959
"prepare_toolchain was not called with app_config"
6060
assert args[1]['app_config'] == app_config,\
6161
"prepare_toolchain was called with an incorrect app_config"
62-
63-
64-
@pytest.mark.parametrize("build_path", ["build_path"])
65-
@pytest.mark.parametrize("target", ["K64F"])
66-
@pytest.mark.parametrize("toolchain_name", ["ARM"])
67-
@pytest.mark.parametrize("app_config", ["app_config", None])
68-
def test_find_tests_app_config(build_path, target, toolchain_name, app_config):
69-
"""
70-
Test find_tests for correct use of app_config
71-
72-
:param base_dir: dummy value for the test base directory
73-
:param target: the target to "test" for
74-
:param toolchain_name: the toolchain to use for "testing"
75-
:param app_config: Application configuration parameter to find tests
76-
"""
77-
tests = {'test1': 'test1_path','test2': 'test2_path'}
78-
src_paths = ['.']
79-
set_targets_json_location()
80-
with patch('tools.test_api.scan_resources') as mock_scan_resources,\
81-
patch('tools.test_api.build_project') as mock_build_project,\
82-
patch('tools.test_api.get_config') as mock_get_config:
83-
mock_build_project.return_value = "build_project"
84-
mock_scan_resources().inc_dirs.return_value = []
85-
mock_get_config.return_value = ({}, "", "")
86-
87-
build_tests(tests, src_paths, build_path, target, toolchain_name,
88-
app_config=app_config)
89-
90-
arg_list = mock_build_project.call_args_list
91-
for args in arg_list:
92-
assert 'app_config' in args[1],\
93-
"build_tests was not called with app_config"
94-
assert args[1]['app_config'] == app_config,\
95-
"build_tests was called with an incorrect app_config"
96-
mock_get_config.called_with(src_paths, target,
97-
toolchain_name, app_conifg=app_config)

tools/test/toolchains/api_test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
from tools.targets import TARGET_MAP
1717
from tools.notifier.mock import MockNotifier
1818

19-
ALPHABET = [char for char in printable if char not in [u'.', u'/']]
19+
ALPHABET = [char for char in printable if char not in [u'.', u'/', u'\\']]
2020

2121
@given(fixed_dictionaries({
2222
'common': lists(text()),
@@ -175,7 +175,7 @@ def test_detect_duplicates(filenames):
175175
assert "dupe.c" in notification["message"]
176176
assert "dupe.cpp" in notification["message"]
177177

178-
@given(text(alphabet=ALPHABET + ["/"], min_size=1))
178+
@given(text(alphabet=ALPHABET + [os.sep], min_size=1))
179179
@given(booleans())
180180
@given(booleans())
181181
@settings(max_examples=20)

0 commit comments

Comments
 (0)