mirror of
https://github.com/veekun/pokedex.git
synced 2024-08-20 18:16:34 +00:00
Fix test_media.py.
- Add --media-root option (was half-supported already, but not accepted on the command line). - Don't test for Colosseum and XD graphics, since we have none. - Acknowledge *-beta sprites.
This commit is contained in:
parent
61ed3c4ccb
commit
14d9b6ead7
2 changed files with 15 additions and 1 deletions
|
@ -13,6 +13,11 @@ import re
|
||||||
from pokedex.db import tables, connect
|
from pokedex.db import tables, connect
|
||||||
from pokedex.util import media
|
from pokedex.util import media
|
||||||
|
|
||||||
|
def pytest_addoption(parser):
|
||||||
|
group = parser.getgroup("pokedex")
|
||||||
|
group.addoption("--media-root", dest="media_root", action="store", default=None,
|
||||||
|
help="path to pokedex-media")
|
||||||
|
|
||||||
def pytest_funcarg__root(request):
|
def pytest_funcarg__root(request):
|
||||||
root = request.config.option.media_root
|
root = request.config.option.media_root
|
||||||
if not root:
|
if not root:
|
||||||
|
@ -119,6 +124,10 @@ def test_get_everything(root, pytestconfig):
|
||||||
versions = list(session.query(tables.Version).all())
|
versions = list(session.query(tables.Version).all())
|
||||||
versions.append('red-green')
|
versions.append('red-green')
|
||||||
|
|
||||||
|
# We don't have any graphics for Colosseum or XD
|
||||||
|
versions.remove(session.query(tables.Version).filter_by(identifier=u'colosseum').one())
|
||||||
|
versions.remove(session.query(tables.Version).filter_by(identifier=u'xd').one())
|
||||||
|
|
||||||
black = session.query(tables.Version).filter_by(identifier=u'black').one()
|
black = session.query(tables.Version).filter_by(identifier=u'black').one()
|
||||||
|
|
||||||
filenames = get_all_filenames(root)
|
filenames = get_all_filenames(root)
|
||||||
|
@ -243,6 +252,8 @@ def test_get_everything(root, pytestconfig):
|
||||||
for filename in filenames:
|
for filename in filenames:
|
||||||
if filename.startswith(exceptions):
|
if filename.startswith(exceptions):
|
||||||
unaccessed_filenames.remove(filename)
|
unaccessed_filenames.remove(filename)
|
||||||
|
if filename.endswith('-beta.png'):
|
||||||
|
unaccessed_filenames.remove(filename)
|
||||||
|
|
||||||
if unaccessed_filenames:
|
if unaccessed_filenames:
|
||||||
print 'Unaccessed files:'
|
print 'Unaccessed files:'
|
||||||
|
|
|
@ -193,7 +193,10 @@ class _BasePokemonMedia(BaseMedia):
|
||||||
version_group = version.version_group
|
version_group = version.version_group
|
||||||
version_dir = '-'.join(
|
version_dir = '-'.join(
|
||||||
v.identifier for v in version_group.versions)
|
v.identifier for v in version_group.versions)
|
||||||
|
try:
|
||||||
generation, info = self._pokemon_sprite_info[version_dir]
|
generation, info = self._pokemon_sprite_info[version_dir]
|
||||||
|
except KeyError:
|
||||||
|
raise ValueError('Version directory %s not found', version_dir)
|
||||||
if generation < self.introduced_in:
|
if generation < self.introduced_in:
|
||||||
raise ValueError("Pokemon %s didn't exist in %s" % (
|
raise ValueError("Pokemon %s didn't exist in %s" % (
|
||||||
self.species_id, version_dir))
|
self.species_id, version_dir))
|
||||||
|
|
Loading…
Reference in a new issue