Guest User

Pytest output for arcade roguelike

a guest
May 14th, 2022
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 24.45 KB | None | 0 0
  1. (.venv) user@system:~/src/arcade-roguelike$ pytest
  2. ========================================= test session starts ==========================================
  3. platform linux -- Python 3.9.2, pytest-7.1.2, pluggy-1.0.0
  4. rootdir: /home/user/src/arcade-roguelike
  5. plugins: cov-3.0.0, mock-3.7.0
  6. collected 29 items
  7.  
  8. tests/test_game_window.py ..........EE..............EEE [100%]
  9.  
  10. ================================================ ERRORS ================================================
  11. _________ ERROR at setup of TestMyGame.test_draw_in_select_location_state_with_mouse_position __________
  12.  
  13. path = 'sounds/footstep_concrete_002.ogg', streaming = False
  14.  
  15. def load_sound(path: Union[str, Path], streaming: bool = False) -> Optional[Sound]:
  16. """
  17. Load a sound.
  18.  
  19. :param Path path: Name of the sound file to load.
  20. :param bool streaming: Boolean for determining if we stream the sound
  21. or load it all into memory. Set to ``True`` for long sounds to save
  22. memory, ``False`` for short sounds to speed playback.
  23. :returns: Sound object which can be used by the :func:`play_sound` function.
  24. :rtype: Sound
  25. """
  26.  
  27. file_name = str(path)
  28. try:
  29. > sound = Sound(file_name, streaming)
  30.  
  31. .venv/lib/python3.9/site-packages/arcade/sound.py:144:
  32. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  33.  
  34. self = <arcade.sound.Sound object at 0x7fdd9a745df0>, file_name = 'sounds/footstep_concrete_002.ogg'
  35. streaming = False
  36.  
  37. def __init__(self, file_name: Union[str, Path], streaming: bool = False):
  38. self.file_name: str = ""
  39. > file_name = resolve_resource_path(file_name)
  40.  
  41. .venv/lib/python3.9/site-packages/arcade/sound.py:26:
  42. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  43.  
  44. path = PosixPath('sounds/footstep_concrete_002.ogg')
  45.  
  46. def resolve_resource_path(path: Union[str, Path]) -> Path:
  47. """Resolves a resource path and returns a Path object.
  48.  
  49. :param Union[str, Path] path: A Path or string
  50. """
  51. # Convert to a Path object and resolve :resources:
  52. if isinstance(path, str):
  53. path = path.strip() # Allow for silly mistakes with extra spaces
  54. if path.startswith(':'):
  55. path = path[1:]
  56. handle, resource = path.split(":")
  57. while resource.startswith('/') or resource.startswith('\\'):
  58. resource = resource[1:]
  59.  
  60. try:
  61. handle_path = resource_handles[handle]
  62. except KeyError:
  63. raise KeyError(f"Unknown resource handle \"{handle}\"")
  64.  
  65. # Always convert into a Path object
  66. path = Path(handle_path / resource)
  67. else:
  68. path = Path(path)
  69.  
  70. # Check for the existence of the file and provide useful feedback to
  71. # avoid deep stack trace into pathlib
  72. if not path.exists():
  73. > raise FileNotFoundError(f"Cannot locate resource : {path}")
  74. E FileNotFoundError: Cannot locate resource : sounds/footstep_concrete_002.ogg
  75.  
  76. .venv/lib/python3.9/site-packages/arcade/resources/__init__.py:39: FileNotFoundError
  77.  
  78. During handling of the above exception, another exception occurred:
  79.  
  80. mock_arcade = <MagicMock name='arcade' id='140589756285088'>
  81.  
  82. @pytest.fixture
  83. def window(mock_arcade):
  84. > return MyGame(100, 100, "foo")
  85.  
  86. tests/test_game_window.py:47:
  87. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  88. source/game_window.py:35: in __init__
  89. self.game_engine = GameEngine()
  90. source/game_engine.py:49: in __init__
  91. self.walk_sound = arcade.load_sound("sounds/footstep_concrete_002.ogg")
  92. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  93.  
  94. path = 'sounds/footstep_concrete_002.ogg', streaming = False
  95.  
  96. def load_sound(path: Union[str, Path], streaming: bool = False) -> Optional[Sound]:
  97. """
  98. Load a sound.
  99.  
  100. :param Path path: Name of the sound file to load.
  101. :param bool streaming: Boolean for determining if we stream the sound
  102. or load it all into memory. Set to ``True`` for long sounds to save
  103. memory, ``False`` for short sounds to speed playback.
  104. :returns: Sound object which can be used by the :func:`play_sound` function.
  105. :rtype: Sound
  106. """
  107.  
  108. file_name = str(path)
  109. try:
  110. sound = Sound(file_name, streaming)
  111. return sound
  112. except Exception as ex:
  113. > raise FileNotFoundError(f'Unable to load sound file: "{file_name}". Exception: {ex}')
  114. E FileNotFoundError: Unable to load sound file: "sounds/footstep_concrete_002.ogg". Exception: Cannot locate resource : sounds/footstep_concrete_002.ogg
  115.  
  116. .venv/lib/python3.9/site-packages/arcade/sound.py:147: FileNotFoundError
  117. ________ ERROR at setup of TestMyGame.test_draw_in_select_location_state_without_mouse_position ________
  118.  
  119. path = 'sounds/footstep_concrete_002.ogg', streaming = False
  120.  
  121. def load_sound(path: Union[str, Path], streaming: bool = False) -> Optional[Sound]:
  122. """
  123. Load a sound.
  124.  
  125. :param Path path: Name of the sound file to load.
  126. :param bool streaming: Boolean for determining if we stream the sound
  127. or load it all into memory. Set to ``True`` for long sounds to save
  128. memory, ``False`` for short sounds to speed playback.
  129. :returns: Sound object which can be used by the :func:`play_sound` function.
  130. :rtype: Sound
  131. """
  132.  
  133. file_name = str(path)
  134. try:
  135. > sound = Sound(file_name, streaming)
  136.  
  137. .venv/lib/python3.9/site-packages/arcade/sound.py:144:
  138. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  139.  
  140. self = <arcade.sound.Sound object at 0x7fdd9a8a44c0>, file_name = 'sounds/footstep_concrete_002.ogg'
  141. streaming = False
  142.  
  143. def __init__(self, file_name: Union[str, Path], streaming: bool = False):
  144. self.file_name: str = ""
  145. > file_name = resolve_resource_path(file_name)
  146.  
  147. .venv/lib/python3.9/site-packages/arcade/sound.py:26:
  148. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  149.  
  150. path = PosixPath('sounds/footstep_concrete_002.ogg')
  151.  
  152. def resolve_resource_path(path: Union[str, Path]) -> Path:
  153. """Resolves a resource path and returns a Path object.
  154.  
  155. :param Union[str, Path] path: A Path or string
  156. """
  157. # Convert to a Path object and resolve :resources:
  158. if isinstance(path, str):
  159. path = path.strip() # Allow for silly mistakes with extra spaces
  160. if path.startswith(':'):
  161. path = path[1:]
  162. handle, resource = path.split(":")
  163. while resource.startswith('/') or resource.startswith('\\'):
  164. resource = resource[1:]
  165.  
  166. try:
  167. handle_path = resource_handles[handle]
  168. except KeyError:
  169. raise KeyError(f"Unknown resource handle \"{handle}\"")
  170.  
  171. # Always convert into a Path object
  172. path = Path(handle_path / resource)
  173. else:
  174. path = Path(path)
  175.  
  176. # Check for the existence of the file and provide useful feedback to
  177. # avoid deep stack trace into pathlib
  178. if not path.exists():
  179. > raise FileNotFoundError(f"Cannot locate resource : {path}")
  180. E FileNotFoundError: Cannot locate resource : sounds/footstep_concrete_002.ogg
  181.  
  182. .venv/lib/python3.9/site-packages/arcade/resources/__init__.py:39: FileNotFoundError
  183.  
  184. During handling of the above exception, another exception occurred:
  185.  
  186. mock_arcade = <MagicMock name='arcade' id='140589755480816'>
  187.  
  188. @pytest.fixture
  189. def window(mock_arcade):
  190. > return MyGame(100, 100, "foo")
  191.  
  192. tests/test_game_window.py:47:
  193. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  194. source/game_window.py:35: in __init__
  195. self.game_engine = GameEngine()
  196. source/game_engine.py:49: in __init__
  197. self.walk_sound = arcade.load_sound("sounds/footstep_concrete_002.ogg")
  198. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  199.  
  200. path = 'sounds/footstep_concrete_002.ogg', streaming = False
  201.  
  202. def load_sound(path: Union[str, Path], streaming: bool = False) -> Optional[Sound]:
  203. """
  204. Load a sound.
  205.  
  206. :param Path path: Name of the sound file to load.
  207. :param bool streaming: Boolean for determining if we stream the sound
  208. or load it all into memory. Set to ``True`` for long sounds to save
  209. memory, ``False`` for short sounds to speed playback.
  210. :returns: Sound object which can be used by the :func:`play_sound` function.
  211. :rtype: Sound
  212. """
  213.  
  214. file_name = str(path)
  215. try:
  216. sound = Sound(file_name, streaming)
  217. return sound
  218. except Exception as ex:
  219. > raise FileNotFoundError(f'Unable to load sound file: "{file_name}". Exception: {ex}')
  220. E FileNotFoundError: Unable to load sound file: "sounds/footstep_concrete_002.ogg". Exception: Cannot locate resource : sounds/footstep_concrete_002.ogg
  221.  
  222. .venv/lib/python3.9/site-packages/arcade/sound.py:147: FileNotFoundError
  223. __________________ ERROR at setup of TestMyGame.test_on_draw_in_select_location_state __________________
  224.  
  225. path = 'sounds/footstep_concrete_002.ogg', streaming = False
  226.  
  227. def load_sound(path: Union[str, Path], streaming: bool = False) -> Optional[Sound]:
  228. """
  229. Load a sound.
  230.  
  231. :param Path path: Name of the sound file to load.
  232. :param bool streaming: Boolean for determining if we stream the sound
  233. or load it all into memory. Set to ``True`` for long sounds to save
  234. memory, ``False`` for short sounds to speed playback.
  235. :returns: Sound object which can be used by the :func:`play_sound` function.
  236. :rtype: Sound
  237. """
  238.  
  239. file_name = str(path)
  240. try:
  241. > sound = Sound(file_name, streaming)
  242.  
  243. .venv/lib/python3.9/site-packages/arcade/sound.py:144:
  244. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  245.  
  246. self = <arcade.sound.Sound object at 0x7fdd9a7b1a30>, file_name = 'sounds/footstep_concrete_002.ogg'
  247. streaming = False
  248.  
  249. def __init__(self, file_name: Union[str, Path], streaming: bool = False):
  250. self.file_name: str = ""
  251. > file_name = resolve_resource_path(file_name)
  252.  
  253. .venv/lib/python3.9/site-packages/arcade/sound.py:26:
  254. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  255.  
  256. path = PosixPath('sounds/footstep_concrete_002.ogg')
  257.  
  258. def resolve_resource_path(path: Union[str, Path]) -> Path:
  259. """Resolves a resource path and returns a Path object.
  260.  
  261. :param Union[str, Path] path: A Path or string
  262. """
  263. # Convert to a Path object and resolve :resources:
  264. if isinstance(path, str):
  265. path = path.strip() # Allow for silly mistakes with extra spaces
  266. if path.startswith(':'):
  267. path = path[1:]
  268. handle, resource = path.split(":")
  269. while resource.startswith('/') or resource.startswith('\\'):
  270. resource = resource[1:]
  271.  
  272. try:
  273. handle_path = resource_handles[handle]
  274. except KeyError:
  275. raise KeyError(f"Unknown resource handle \"{handle}\"")
  276.  
  277. # Always convert into a Path object
  278. path = Path(handle_path / resource)
  279. else:
  280. path = Path(path)
  281.  
  282. # Check for the existence of the file and provide useful feedback to
  283. # avoid deep stack trace into pathlib
  284. if not path.exists():
  285. > raise FileNotFoundError(f"Cannot locate resource : {path}")
  286. E FileNotFoundError: Cannot locate resource : sounds/footstep_concrete_002.ogg
  287.  
  288. .venv/lib/python3.9/site-packages/arcade/resources/__init__.py:39: FileNotFoundError
  289.  
  290. During handling of the above exception, another exception occurred:
  291.  
  292. mock_arcade = <MagicMock name='arcade' id='140589755075696'>
  293.  
  294. @pytest.fixture
  295. def window(mock_arcade):
  296. > return MyGame(100, 100, "foo")
  297.  
  298. tests/test_game_window.py:47:
  299. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  300. source/game_window.py:35: in __init__
  301. self.game_engine = GameEngine()
  302. source/game_engine.py:49: in __init__
  303. self.walk_sound = arcade.load_sound("sounds/footstep_concrete_002.ogg")
  304. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  305.  
  306. path = 'sounds/footstep_concrete_002.ogg', streaming = False
  307.  
  308. def load_sound(path: Union[str, Path], streaming: bool = False) -> Optional[Sound]:
  309. """
  310. Load a sound.
  311.  
  312. :param Path path: Name of the sound file to load.
  313. :param bool streaming: Boolean for determining if we stream the sound
  314. or load it all into memory. Set to ``True`` for long sounds to save
  315. memory, ``False`` for short sounds to speed playback.
  316. :returns: Sound object which can be used by the :func:`play_sound` function.
  317. :rtype: Sound
  318. """
  319.  
  320. file_name = str(path)
  321. try:
  322. sound = Sound(file_name, streaming)
  323. return sound
  324. except Exception as ex:
  325. > raise FileNotFoundError(f'Unable to load sound file: "{file_name}". Exception: {ex}')
  326. E FileNotFoundError: Unable to load sound file: "sounds/footstep_concrete_002.ogg". Exception: Cannot locate resource : sounds/footstep_concrete_002.ogg
  327.  
  328. .venv/lib/python3.9/site-packages/arcade/sound.py:147: FileNotFoundError
  329. ______________________ ERROR at setup of TestMyGame.test_on_draw_in_normal_state _______________________
  330.  
  331. path = 'sounds/footstep_concrete_002.ogg', streaming = False
  332.  
  333. def load_sound(path: Union[str, Path], streaming: bool = False) -> Optional[Sound]:
  334. """
  335. Load a sound.
  336.  
  337. :param Path path: Name of the sound file to load.
  338. :param bool streaming: Boolean for determining if we stream the sound
  339. or load it all into memory. Set to ``True`` for long sounds to save
  340. memory, ``False`` for short sounds to speed playback.
  341. :returns: Sound object which can be used by the :func:`play_sound` function.
  342. :rtype: Sound
  343. """
  344.  
  345. file_name = str(path)
  346. try:
  347. > sound = Sound(file_name, streaming)
  348.  
  349. .venv/lib/python3.9/site-packages/arcade/sound.py:144:
  350. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  351.  
  352. self = <arcade.sound.Sound object at 0x7fdd9a6c8a60>, file_name = 'sounds/footstep_concrete_002.ogg'
  353. streaming = False
  354.  
  355. def __init__(self, file_name: Union[str, Path], streaming: bool = False):
  356. self.file_name: str = ""
  357. > file_name = resolve_resource_path(file_name)
  358.  
  359. .venv/lib/python3.9/site-packages/arcade/sound.py:26:
  360. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  361.  
  362. path = PosixPath('sounds/footstep_concrete_002.ogg')
  363.  
  364. def resolve_resource_path(path: Union[str, Path]) -> Path:
  365. """Resolves a resource path and returns a Path object.
  366.  
  367. :param Union[str, Path] path: A Path or string
  368. """
  369. # Convert to a Path object and resolve :resources:
  370. if isinstance(path, str):
  371. path = path.strip() # Allow for silly mistakes with extra spaces
  372. if path.startswith(':'):
  373. path = path[1:]
  374. handle, resource = path.split(":")
  375. while resource.startswith('/') or resource.startswith('\\'):
  376. resource = resource[1:]
  377.  
  378. try:
  379. handle_path = resource_handles[handle]
  380. except KeyError:
  381. raise KeyError(f"Unknown resource handle \"{handle}\"")
  382.  
  383. # Always convert into a Path object
  384. path = Path(handle_path / resource)
  385. else:
  386. path = Path(path)
  387.  
  388. # Check for the existence of the file and provide useful feedback to
  389. # avoid deep stack trace into pathlib
  390. if not path.exists():
  391. > raise FileNotFoundError(f"Cannot locate resource : {path}")
  392. E FileNotFoundError: Cannot locate resource : sounds/footstep_concrete_002.ogg
  393.  
  394. .venv/lib/python3.9/site-packages/arcade/resources/__init__.py:39: FileNotFoundError
  395.  
  396. During handling of the above exception, another exception occurred:
  397.  
  398. mock_arcade = <MagicMock name='arcade' id='140589754760016'>
  399.  
  400. @pytest.fixture
  401. def window(mock_arcade):
  402. > return MyGame(100, 100, "foo")
  403.  
  404. tests/test_game_window.py:47:
  405. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  406. source/game_window.py:35: in __init__
  407. self.game_engine = GameEngine()
  408. source/game_engine.py:49: in __init__
  409. self.walk_sound = arcade.load_sound("sounds/footstep_concrete_002.ogg")
  410. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  411.  
  412. path = 'sounds/footstep_concrete_002.ogg', streaming = False
  413.  
  414. def load_sound(path: Union[str, Path], streaming: bool = False) -> Optional[Sound]:
  415. """
  416. Load a sound.
  417.  
  418. :param Path path: Name of the sound file to load.
  419. :param bool streaming: Boolean for determining if we stream the sound
  420. or load it all into memory. Set to ``True`` for long sounds to save
  421. memory, ``False`` for short sounds to speed playback.
  422. :returns: Sound object which can be used by the :func:`play_sound` function.
  423. :rtype: Sound
  424. """
  425.  
  426. file_name = str(path)
  427. try:
  428. sound = Sound(file_name, streaming)
  429. return sound
  430. except Exception as ex:
  431. > raise FileNotFoundError(f'Unable to load sound file: "{file_name}". Exception: {ex}')
  432. E FileNotFoundError: Unable to load sound file: "sounds/footstep_concrete_002.ogg". Exception: Cannot locate resource : sounds/footstep_concrete_002.ogg
  433.  
  434. .venv/lib/python3.9/site-packages/arcade/sound.py:147: FileNotFoundError
  435. _________________ ERROR at setup of TestMyGame.test_on_draw_in_character_screen_state __________________
  436.  
  437. path = 'sounds/footstep_concrete_002.ogg', streaming = False
  438.  
  439. def load_sound(path: Union[str, Path], streaming: bool = False) -> Optional[Sound]:
  440. """
  441. Load a sound.
  442.  
  443. :param Path path: Name of the sound file to load.
  444. :param bool streaming: Boolean for determining if we stream the sound
  445. or load it all into memory. Set to ``True`` for long sounds to save
  446. memory, ``False`` for short sounds to speed playback.
  447. :returns: Sound object which can be used by the :func:`play_sound` function.
  448. :rtype: Sound
  449. """
  450.  
  451. file_name = str(path)
  452. try:
  453. > sound = Sound(file_name, streaming)
  454.  
  455. .venv/lib/python3.9/site-packages/arcade/sound.py:144:
  456. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  457.  
  458. self = <arcade.sound.Sound object at 0x7fdd9a6e9100>, file_name = 'sounds/footstep_concrete_002.ogg'
  459. streaming = False
  460.  
  461. def __init__(self, file_name: Union[str, Path], streaming: bool = False):
  462. self.file_name: str = ""
  463. > file_name = resolve_resource_path(file_name)
  464.  
  465. .venv/lib/python3.9/site-packages/arcade/sound.py:26:
  466. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  467.  
  468. path = PosixPath('sounds/footstep_concrete_002.ogg')
  469.  
  470. def resolve_resource_path(path: Union[str, Path]) -> Path:
  471. """Resolves a resource path and returns a Path object.
  472.  
  473. :param Union[str, Path] path: A Path or string
  474. """
  475. # Convert to a Path object and resolve :resources:
  476. if isinstance(path, str):
  477. path = path.strip() # Allow for silly mistakes with extra spaces
  478. if path.startswith(':'):
  479. path = path[1:]
  480. handle, resource = path.split(":")
  481. while resource.startswith('/') or resource.startswith('\\'):
  482. resource = resource[1:]
  483.  
  484. try:
  485. handle_path = resource_handles[handle]
  486. except KeyError:
  487. raise KeyError(f"Unknown resource handle \"{handle}\"")
  488.  
  489. # Always convert into a Path object
  490. path = Path(handle_path / resource)
  491. else:
  492. path = Path(path)
  493.  
  494. # Check for the existence of the file and provide useful feedback to
  495. # avoid deep stack trace into pathlib
  496. if not path.exists():
  497. > raise FileNotFoundError(f"Cannot locate resource : {path}")
  498. E FileNotFoundError: Cannot locate resource : sounds/footstep_concrete_002.ogg
  499.  
  500. .venv/lib/python3.9/site-packages/arcade/resources/__init__.py:39: FileNotFoundError
  501.  
  502. During handling of the above exception, another exception occurred:
  503.  
  504. mock_arcade = <MagicMock name='arcade' id='140589755402224'>
  505.  
  506. @pytest.fixture
  507. def window(mock_arcade):
  508. > return MyGame(100, 100, "foo")
  509.  
  510. tests/test_game_window.py:47:
  511. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  512. source/game_window.py:35: in __init__
  513. self.game_engine = GameEngine()
  514. source/game_engine.py:49: in __init__
  515. self.walk_sound = arcade.load_sound("sounds/footstep_concrete_002.ogg")
  516. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  517.  
  518. path = 'sounds/footstep_concrete_002.ogg', streaming = False
  519.  
  520. def load_sound(path: Union[str, Path], streaming: bool = False) -> Optional[Sound]:
  521. """
  522. Load a sound.
  523.  
  524. :param Path path: Name of the sound file to load.
  525. :param bool streaming: Boolean for determining if we stream the sound
  526. or load it all into memory. Set to ``True`` for long sounds to save
  527. memory, ``False`` for short sounds to speed playback.
  528. :returns: Sound object which can be used by the :func:`play_sound` function.
  529. :rtype: Sound
  530. """
  531.  
  532. file_name = str(path)
  533. try:
  534. sound = Sound(file_name, streaming)
  535. return sound
  536. except Exception as ex:
  537. > raise FileNotFoundError(f'Unable to load sound file: "{file_name}". Exception: {ex}')
  538. E FileNotFoundError: Unable to load sound file: "sounds/footstep_concrete_002.ogg". Exception: Cannot locate resource : sounds/footstep_concrete_002.ogg
  539.  
  540. .venv/lib/python3.9/site-packages/arcade/sound.py:147: FileNotFoundError
  541. ======================================= short test summary info ========================================
  542. ERROR tests/test_game_window.py::TestMyGame::test_draw_in_select_location_state_with_mouse_position
  543. ERROR tests/test_game_window.py::TestMyGame::test_draw_in_select_location_state_without_mouse_position
  544. ERROR tests/test_game_window.py::TestMyGame::test_on_draw_in_select_location_state - FileNotFoundErro...
  545. ERROR tests/test_game_window.py::TestMyGame::test_on_draw_in_normal_state - FileNotFoundError: Unable...
  546. ERROR tests/test_game_window.py::TestMyGame::test_on_draw_in_character_screen_state - FileNotFoundErr...
  547. ===================================== 24 passed, 5 errors in 0.76s =====================================
Advertisement
Add Comment
Please, Sign In to add comment