summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_winsound.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_winsound.py')
-rw-r--r--Lib/test/test_winsound.py14
1 files changed, 4 insertions, 10 deletions
diff --git a/Lib/test/test_winsound.py b/Lib/test/test_winsound.py
index a59d0d2..870ab7b 100644
--- a/Lib/test/test_winsound.py
+++ b/Lib/test/test_winsound.py
@@ -1,12 +1,13 @@
# Ridiculously simple test of the winsound module for Windows.
import functools
-import pathlib
+import os
import time
import unittest
from test import support
from test.support import import_helper
+from test.support import os_helper
support.requires('audio')
@@ -85,13 +86,6 @@ class MessageBeepTest(unittest.TestCase):
safe_MessageBeep(type=winsound.MB_OK)
-# A class for testing winsound when the given path resolves
-# to bytes rather than str.
-class BytesPath(pathlib.WindowsPath):
- def __fspath__(self):
- return bytes(super().__fspath__(), 'UTF-8')
-
-
class PlaySoundTest(unittest.TestCase):
def test_errors(self):
@@ -126,7 +120,7 @@ class PlaySoundTest(unittest.TestCase):
def test_snd_filepath(self):
fn = support.findfile('pluck-pcm8.wav', subdir='audiodata')
- path = pathlib.Path(fn)
+ path = os_helper.FakePath(fn)
safe_PlaySound(path, winsound.SND_FILENAME | winsound.SND_NODEFAULT)
def test_snd_filepath_as_bytes(self):
@@ -134,7 +128,7 @@ class PlaySoundTest(unittest.TestCase):
self.assertRaises(
TypeError,
winsound.PlaySound,
- BytesPath(fn),
+ os_helper.FakePath(os.fsencode(fn)),
winsound.SND_FILENAME | winsound.SND_NODEFAULT
)