move tests to a test folder

This commit is contained in:
Carlos Millett 2017-07-12 20:17:35 -03:00
parent 55f520400b
commit be1610747b
8 changed files with 20 additions and 15 deletions

0
tests/__init__.py Normal file
View file

View file

@ -2,8 +2,8 @@
# To run the tests, use: python3 -m pytest --capture=sys
from database import Database
from test_utils import expected_len
from pokemonterminal.database import Database
from tests.test_utils import expected_len
def test_extra_length(region_name='extra'):

View file

@ -2,8 +2,8 @@
# To run the tests, use: python3 -m pytest --capture=sys
from database import Database
from test_utils import region_dict, get_region, make_extra_counts, MAX_ID
from pokemonterminal.database import Database
from tests.test_utils import region_dict, get_region, make_extra_counts, MAX_ID
def test_first_database():

View file

@ -2,9 +2,9 @@
# To run the tests, use: python3 -m pytest --capture=sys
from database import Database, Pokemon
from load_all_pokemon import load_all_pokemon
from test_utils import expected_len, MAX_ID
from pokemonterminal.database import Database, Pokemon
from pokemonterminal.load_all_pokemon import load_all_pokemon
from tests.test_utils import expected_len, MAX_ID
def compare_pokemon(a, b):

View file

@ -2,9 +2,9 @@
# To run the tests, use: python3 -m pytest --capture=sys
from database import Database
from main import main
from test_utils import region_dict
from pokemonterminal.database import Database
from pokemonterminal.main import main
from tests.test_utils import region_dict
db = Database()
print(len(db))

View file

@ -2,17 +2,18 @@
# To run use python3 -m pytest --capture=sys
from adapter import available_terminals, base
import os
from pokemonterminal.adapter import available_terminals, base
from tests.test_utils import SCRIPT_DIR
def test_available_terminals():
assert available_terminals, 'No available_terminals found.'
terminal_names = [terminal.__name__ for terminal in available_terminals]
non_terminals = ['NullAdapter', '__init__']
assert all(terminal not in terminal_names for terminal in non_terminals)
script_dir = os.path.dirname(os.path.realpath(__file__))
terminals_dir = os.path.join(script_dir, 'adapter', 'implementations')
terminals_dir = os.path.join(SCRIPT_DIR, 'adapter', 'implementations')
assert os.path.isdir(terminals_dir), 'Not found: ' + terminals_dir
for filename in os.listdir(terminals_dir):
terminal, ext = os.path.splitext(filename)

View file

@ -11,8 +11,11 @@
import os
from collections import Counter, namedtuple
import pokemonterminal
MAX_ID = 719
SCRIPT_DIR = os.path.dirname(os.path.realpath(__file__))
SCRIPT_DIR = os.path.dirname(os.path.realpath(pokemonterminal.__file__))
region_info = namedtuple('region_info', 'start end first last')
region_dict = {

View file

@ -1,8 +1,9 @@
# This module is for testing the different components of this project.
from database import Database
import sys
from pokemonterminal.database import Database
def print_items(items):
# Print each item in a collection.