Skip to content
This repository was archived by the owner on Dec 23, 2021. It is now read-only.

Commit c66967b

Browse files
committed
Fix tests for mac os
1 parent 33828ab commit c66967b

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/adafruit_circuitplayground/test/test_utils.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,21 @@ def test_remove_leading_slashes(self):
1313
assert expected == utils.remove_leading_slashes(original)
1414

1515
def test_escape_notOSX(self):
16+
_utils_sys = utils.sys
1617
if sys.platform.startswith(CONSTANTS.MAC_OS):
1718
utils.sys = mock.MagicMock()
1819
utils.sys.configure_mock(platform="win32")
1920
original = "a b"
2021
assert original == utils.escape_if_OSX(original)
22+
utils.sys = _utils_sys
2123

2224
def test_escape_isOSX(self):
25+
_utils_sys = utils.sys
2326
if not sys.platform.startswith(CONSTANTS.MAC_OS):
2427
utils.sys = mock.MagicMock()
2528
utils.sys.configure_mock(platform="darwin")
2629
original = "a b"
2730
expected = "a%20b"
2831
assert expected == utils.escape_if_OSX(original)
32+
utils.sys = _utils_sys
33+

src/common/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,6 @@ def remove_leading_slashes(string):
4444

4545

4646
def escape_if_OSX(file_name):
47-
if sys.platform.startswith(CONSTANTS.MAC_OS):
47+
if sys.platform == CONSTANTS.MAC_OS:
4848
file_name = file_name.replace(" ", "%20")
4949
return file_name

0 commit comments

Comments
 (0)