fix sprite file finding and loading, prepare level loading test function

This commit is contained in:
Xevion
2020-04-21 00:05:11 -05:00
parent 9bace25b93
commit c6a8142358
2 changed files with 18 additions and 2 deletions

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 311 B

View File

@@ -50,7 +50,13 @@ class TestSprites:
_sprites = [] _sprites = []
for primary in os.listdir(IMAGE_DIR): for primary in os.listdir(IMAGE_DIR):
for secondary in os.listdir(os.path.join(IMAGE_DIR, primary)): for secondary in os.listdir(os.path.join(IMAGE_DIR, primary)):
_sprites.extend(os.listdir(os.path.join(IMAGE_DIR, primary, secondary))) secondary = os.path.join(IMAGE_DIR, primary, secondary)
if os.path.isfile(secondary):
_sprites.append(primary)
else:
_sprites.extend(
os.path.join(secondary, file) for file in
os.listdir(os.path.join(IMAGE_DIR, primary, secondary)))
return _sprites return _sprites
@pytest.fixture @pytest.fixture
@@ -94,7 +100,17 @@ class TestLevels:
Tests the Level class. Tests the Level class.
""" """
def loadble_level(): def test_levels_are_loadable(self):
"""
Tests whether or not a level can be loaded.
"""
import os
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
LEVEL_DIR = os.path.join(BASE_DIR, 'resources', 'levels')
levels = os.listdir(LEVEL_DIR)
pass pass