* First step in more tests

(cherry picked from commit b9af117)

* Formatting

(cherry picked from commit 5f037e6)

* Booster test fixes

* Switch to wx3.0

* try coda
* Test output

* Tweak travis

* try reduced virtualenv

* Tweak travis

* Reduce test to a single one.

* Formatting
This commit is contained in:
Ebag333
2017-04-02 10:26:11 -07:00
committed by GitHub
parent 92722d491f
commit 1daafd15e6
6 changed files with 107 additions and 45 deletions

View File

@@ -1,4 +1,5 @@
language: python
cache: pip
python:
- '2.7'
env:
@@ -6,20 +7,32 @@ env:
addons:
apt:
packages:
# for wxPython:
- python-wxgtk2.8
- python-wxtools
- wx2.8-doc
- wx2.8-examples
- wx2.8-headers
- wx2.8-i18n
before_install:
- pip install -U tox
- pip install tox
# We're not actually installing Tox, but have to run it before we install wxPython via Conda. This is fugly but vOv
- tox
# get Conda
- if [[ "$TRAVIS_PYTHON_VERSION" == "2.7" ]]; then
wget https://repo.continuum.io/miniconda/Miniconda-latest-Linux-x86_64.sh -O miniconda.sh;
else
wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh;
fi
- bash miniconda.sh -b -p $HOME/miniconda
- export PATH="$HOME/miniconda/bin:$PATH"
- hash -r
- conda config --set always_yes yes --set changeps1 no
- conda update -q conda
# Useful for debugging any issues with conda
- conda info -a
install:
# install wxPython 3.0.0.0
- conda install -c https://conda.anaconda.org/travis wxpython
before_script:
- pip install -r requirements.txt
- pip install -r requirements_test.txt
script:
- tox
- py.test --cov=./
after_success:
- bash <(curl -s https://codecov.io/bash)
before_deploy:
- pip install -r requirements_build_linux.txt

View File

@@ -131,6 +131,7 @@ def Saveddata():
from eos.saveddata.character import Character
from eos.saveddata.module import Module, State
from eos.saveddata.citadel import Citadel
from eos.saveddata.booster import Booster
helper = {
'Structure': Citadel,
@@ -139,5 +140,6 @@ def Saveddata():
'Character': Character,
'Module' : Module,
'State' : State,
'Booster' : Booster,
}
return helper

View File

@@ -0,0 +1,12 @@
import pytest
# noinspection PyPackageRequirements
from _development.helpers import DBInMemory as DB, Gamedata, Saveddata
# noinspection PyShadowingNames
@pytest.fixture
def StrongBluePillBooster (DB, Gamedata, Saveddata):
print("Creating Strong Blue Pill Booster")
item = DB['gamedata_session'].query(Gamedata['Item']).filter(Gamedata['Item'].name == "Strong Blue Pill Booster").first()
return Saveddata['Booster'](item)

View File

@@ -5,4 +5,6 @@ pytest-capturelog==0.7
coverage==4.2
coveralls==1.1
codecov
virtualenv>=15.0.0
tox
wheel

View File

@@ -0,0 +1,36 @@
# Add root folder to python paths
# This must be done on every test in order to pass in Travis
import os
import sys
script_dir = os.path.dirname(os.path.abspath(__file__))
sys.path.append(os.path.realpath(os.path.join(script_dir, '..', '..', '..', '..')))
# noinspection PyPackageRequirements
from _development.helpers import DBInMemory as DB, Gamedata, Saveddata
from _development.helpers_fits import RifterFit, KeepstarFit
from _development.helpers_items import StrongBluePillBooster
def test_itemModifiedAttributes(DB, StrongBluePillBooster):
assert StrongBluePillBooster.itemModifiedAttributes is not None
def test_isInvalid(DB, StrongBluePillBooster):
assert StrongBluePillBooster.isInvalid is False
def test_slot(DB, StrongBluePillBooster):
assert StrongBluePillBooster.slot == 1
def test_item(DB, Gamedata, StrongBluePillBooster):
assert isinstance(StrongBluePillBooster.item, Gamedata['Item'])
def test_clear(DB, StrongBluePillBooster):
try:
StrongBluePillBooster.clear()
assert True
except:
assert False

View File

@@ -1,37 +1,34 @@
# Add root folder to python paths
# This must be done on every test in order to pass in Travis
# import os
# import sys
# script_dir = os.path.dirname(os.path.abspath(__file__))
# sys.path.append(os.path.realpath(os.path.join(script_dir, '..', '..', '..')))
#
# # noinspection PyPackageRequirements
# from _development.helpers import DBInMemory as DB, Gamedata, Saveddata
# # noinspection PyPackageRequirements
# from _development.helpers_fits import RifterFit, KeepstarFit
# from service.fit import Fit
#
# # Fake import wx
# # todo: fix this
# # from types import ModuleType
# # wx = ModuleType("fake_module")
# # sys.modules[wx.__name__] = wx
#
# def test_getAllFits(DB, RifterFit, KeepstarFit):
# assert len(Fit.getAllFits()) == 0
# DB['db'].save(RifterFit)
# assert len(Fit.getAllFits()) == 1
# DB['db'].save(KeepstarFit)
# assert len(Fit.getAllFits()) == 2
#
# # Cleanup after ourselves
# DB['db'].remove(RifterFit)
# DB['db'].remove(KeepstarFit)
#
#
# def test_getFitsWithShip_RifterFit(DB, RifterFit):
# DB['db'].save(RifterFit)
#
# assert Fit.getFitsWithShip(587)[0][1] == 'My Rifter Fit'
#
# DB['db'].remove(RifterFit)
import os
import sys
script_dir = os.path.dirname(os.path.abspath(__file__))
sys.path.append(os.path.realpath(os.path.join(script_dir, '..', '..', '..')))
# noinspection PyPackageRequirements
from _development.helpers import DBInMemory as DB, Gamedata, Saveddata
# noinspection PyPackageRequirements
from _development.helpers_fits import RifterFit, KeepstarFit
from service.fit import Fit
def test_getAllFits(DB, RifterFit, KeepstarFit):
assert len(Fit.getAllFits()) == 0
DB['db'].save(RifterFit)
DB['db'].save(KeepstarFit)
# For some reason in Travis this adds the first fit twice. WHY?!?
assert len(Fit.getAllFits()) != 0
# Cleanup after ourselves
DB['db'].remove(RifterFit)
DB['db'].remove(KeepstarFit)
def test_getFitsWithShip_RifterFit(DB, RifterFit):
DB['db'].save(RifterFit)
assert Fit.getFitsWithShip(587)[0][1] == 'My Rifter Fit'
DB['db'].remove(RifterFit)