Skip to content
Permalink
Browse files

Merge pull request #101 from Pyfa-fit/development

2017.05.21
  • Loading branch information...
Ebag333 committed May 22, 2017
2 parents 216d29c + 03dcd9b commit c468f6193f9376622530e6cea8ab90881443b388
Showing with 934 additions and 538 deletions.
  1. +36 −40 .appveyor.yml
  2. +5 −0 .codecov.yml
  3. +73 −13 .travis.yml
  4. +14 −15 README.md
  5. +0 −80 _development/helpers.py
  6. +5 −5 _development/helpers_fits.py
  7. +2 −2 _development/helpers_items.py
  8. +2 −2 config.py
  9. BIN dist_assets/linux/pyfa.ico
  10. +83 −0 dist_assets/linux/pyfa.spec
  11. +83 −0 dist_assets/linux/pyfa_debug.spec
  12. +83 −0 dist_assets/mac/pyfa.spec
  13. +83 −0 dist_assets/mac/pyfa_debug.spec
  14. +3 −1 dist_assets/win/pyfa.spec
  15. +38 −6 eos/db/__init__.py
  16. +24 −20 eos/db/migrations/upgrade17.py
  17. +9 −3 eos/db/migrations/upgrade6.py
  18. +1 −1 eos/effects/adaptivearmorhardener.py
  19. +5 −1 eos/events.py
  20. +1 −1 eos/gamedata.py
  21. +22 −11 eos/saveddata/character.py
  22. +2 −3 eos/saveddata/fit.py
  23. +8 −16 eos/saveddata/module.py
  24. BIN eve.db
  25. +5 −5 gui/bitmapLoader.py
  26. +4 −4 gui/builtinContextMenus/changeAffectingSkills.py
  27. +18 −7 gui/builtinContextMenus/commandFits.py
  28. +6 −0 gui/builtinContextMenus/implantSets.py
  29. +1 −1 gui/builtinContextMenus/tabbedFits.py
  30. +0 −10 gui/builtinPreferenceViews/pyfaLoggingPreferences.py
  31. +1 −1 gui/builtinStatsViews/capacitorViewFull.py
  32. +1 −1 gui/builtinStatsViews/capacitorViewMinimal.py
  33. +2 −2 gui/builtinStatsViews/outgoingViewFull.py
  34. +2 −2 gui/builtinStatsViews/outgoingViewMinimal.py
  35. +1 −1 gui/builtinStatsViews/priceViewFull.py
  36. +3 −26 gui/builtinStatsViews/priceViewMinimal.py
  37. +1 −1 gui/builtinStatsViews/rechargeViewFull.py
  38. +1 −1 gui/builtinStatsViews/rechargeViewMinimal.py
  39. +1 −1 gui/builtinStatsViews/targetingMiscViewMinimal.py
  40. +3 −1 gui/builtinViewColumns/baseName.py
  41. +30 −13 gui/builtinViews/fittingView.py
  42. +1 −1 gui/characterEditor.py
  43. +3 −3 gui/characterSelection.py
  44. +5 −5 gui/chromeTabs.py
  45. +4 −2 gui/commandView.py
  46. +4 −4 gui/graphFrame.py
  47. +11 −0 gui/implantView.py
  48. +6 −6 gui/mainFrame.py
  49. +3 −3 gui/marketBrowser.py
  50. +4 −2 gui/projectedView.py
  51. +1 −1 gui/recentShipBrowser.py
  52. +1 −1 gui/sfBrowserItem.py
  53. +8 −5 gui/shipBrowser.py
  54. +1 −1 gui/utils/drawUtils.py
  55. +1 −2 gui/utils/exportHtml.py
  56. +108 −99 gui/utils/floatspin.py
  57. +1 −2 requirements.txt
  58. +4 −4 requirements_build_windows.txt → requirements_build.txt
  59. +0 −8 requirements_build_linux.txt
  60. +0 −9 requirements_build_osx.txt
  61. +4 −3 service/character.py
  62. +37 −9 service/fit.py
  63. +1 −1 service/implantSet.py
  64. +2 −1 service/market.py
  65. +2 −2 service/port.py
  66. +5 −2 service/settings.py
  67. +2 −3 tests/test_locale/file_dialog.py
  68. +1 −1 tests/test_locale/test_Pyfa/test_codec_english.py
  69. +1 −1 tests/test_locale/test_os_walk.py
  70. +2 −2 tests/test_locale/test_знаф/test_codec_russian.py
  71. +1 −1 tests/test_locale/test_פטכש/test_codec_hebrew.py
  72. +1 −1 tests/test_locale/test_测试/test_codec_chinese_simplified.py
  73. +3 −4 tests/test_modules/test_eos/test_gamedata.py
  74. +4 −4 tests/test_modules/test_eos/test_modifiedAttributeDict.py
  75. +8 −8 tests/test_modules/test_eos/test_saveddata/test_booster.py
  76. +14 −15 tests/test_modules/test_eos/test_saveddata/test_fit_2.py
  77. +2 −2 tests/test_modules/test_gui/test_aboutData.py
  78. +1 −1 tests/test_modules/test_service/test_attribute.py
  79. +5 −5 tests/test_modules/test_service/test_fit.py
  80. +1 −0 tests/test_placeholder.py
  81. +5 −5 tests/test_smoketests/test_rifter.py
  82. +3 −11 tests/test_unread_desc.py
  83. +1 −1 tox.ini
@@ -5,16 +5,14 @@ skip_branch_with_pr: true

# scripts that are called at very beginning, before repo cloning
init:
- ps: Update-AppveyorBuild -Version "$env:APPVEYOR_REPO_BRANCH.$(Get-Date -format yyyy.mm.dd).$env:appveyor_build_number"
- ps: Update-AppveyorBuild -Version "$env:APPVEYOR_REPO_BRANCH.$(Get-Date -format yyyy.MM.dd).$env:appveyor_build_number"

- ECHO " "
- ECHO "------------------------"
- ECHO " "
- ECHO "JOB NAME:"
- ECHO %APPVEYOR_JOB_NAME%
- ECHO "JOB NAME:" %APPVEYOR_JOB_NAME%
- ECHO " "
- ECHO "BUILD VERSION"
- ECHO %AppveyorBuild%
- ECHO "BUILD VERSION" %AppveyorBuild%
- ECHO " "
- ECHO "------------------------"
- ECHO " "
@@ -115,14 +113,16 @@ install:
- "appveyor DownloadFile https://goo.gl/Uj0jV3 -FileName C:\\wxpython64.exe"

- 'ECHO Install wxPython'
- "C:\\wxpython.exe /SP- /VERYSILENT /NORESTART"
- "C:\\wxpython64.exe /SP- /VERYSILENT /NORESTART"
- if [%PYTHON_ARCH%]==[32] (
C:\wxpython.exe /SP- /VERYSILENT /NORESTART)
- if [%PYTHON_ARCH%]==[64] (
C:\wxpython64.exe /SP- /VERYSILENT /NORESTART)

- ECHO "Filesystem root:"
- ps: "ls \"C:/\""
# - ECHO "Filesystem root:"
# - ps: "ls \"C:/\""

- ECHO "Filesystem pyfa root:"
- ps: "ls"
# - ECHO "Filesystem pyfa root:"
# - ps: "ls"

- ECHO "Installed SDKs:"
- ps: "ls \"C:/Program Files/Microsoft SDKs/Windows\""
@@ -152,7 +152,7 @@ install:
- ECHO "Install pip requirements:"
- "pip install -r requirements.txt"
- "pip install -r requirements_test.txt"
- "pip install -r requirements_build_windows.txt"
- "pip install -r requirements_build.txt"

build_script:
# Build the compiled extension
@@ -161,46 +161,42 @@ build_script:
- copy .\dist_assets\win\pyfa.spec .\pyfa.spec
- "pyinstaller.exe --clean --noconfirm --windowed --upx-dir=.\\scripts\\upx.exe .\\pyfa.spec"


- ECHO "Build pyfa (Debug):"
- copy .\dist_assets\win\pyfa_debug.spec .\pyfa_debug.spec
- "pyinstaller.exe --clean --noconfirm --windowed --upx-dir=.\\scripts\\upx.exe .\\pyfa_debug.spec"
- if [%PYTHON_ARCH%]==[32] (
pyinstaller.exe --clean --noconfirm --windowed --upx-dir=.\\scripts\\upx.exe .\\pyfa_debug.spec)

build: on

after_build:
- ps: "ls \"./\""
#- ps: "ls \"C:\\projects\\pyfa\\build\\pyfa\\\""
- ps: "ls \".\\dist\\\""
- ps: "ls \".\\dist\\pyfa\\\""
# Zip
# APPVEYOR_PULL_REQUEST_NUMBER -and $env:APPVEYOR_BUILD_NUMBER
#- 7z a build.zip -r C:\projects\pyfa\build\pyfa\*.*
- 7z a pyfa.zip -r .\dist\pyfa\*.*
- 7z a pyfa_debug.zip -r .\dist\pyfa_debug\*.*
- if [%PYTHON_ARCH%]==[32] (
7z a Pyfa_Windows.zip -r .\dist\pyfa\*.*)
- if [%PYTHON_ARCH%]==[64] (
7z a Pyfa_Windows_x64.zip -r .\dist\pyfa\*.*)

- if [%PYTHON_ARCH%]==[32] (
7z a pyfa_windows_debug.zip -r .\dist\pyfa_debug\*.*)


- ps: if ($env:APPVEYOR_PULL_REQUEST_NUMBER -and $env:APPVEYOR_BUILD_NUMBER -ne ((Invoke-RestMethod `
https://ci.appveyor.com/api/projects/$env:APPVEYOR_ACCOUNT_NAME/$env:APPVEYOR_PROJECT_SLUG/history?recordsNumber=50).builds | `
Where-Object pullRequestId -eq $env:APPVEYOR_PULL_REQUEST_NUMBER)[0].buildNumber) { `
throw "There are newer queued builds for this pull request, failing early." }

- ps: if ($env:PYTHON_ARCH -eq 32){
Push-AppveyorArtifact Pyfa_Windows.zip;
Push-AppveyorArtifact Pyfa_Windows_debug.zip
}

on_success:
# Do nothing right now
- ps: if ($env:PYTHON_ARCH -eq 64){
Push-AppveyorArtifact Pyfa_Windows_x64.zip
}

test_script:
- tox
- "py.test --cov=./"
# Run the project tests
# - "%CMD_IN_ENV% python C:/projects/eve-gnosis/setup.py nosetests"

after_test:
# If tests are successful, create binary packages for the project.
# - "%CMD_IN_ENV% python setup.py bdist_wheel"
# - "%CMD_IN_ENV% python setup.py bdist_wininst"
# - "%CMD_IN_ENV% python setup.py bdist_msi"
# - ps: "ls dist"

artifacts:
# Archive the generated packages in the ci.appveyor.com build report.
- path: pyfa.zip
name: Pyfa
- path: pyfa_debug.zip
name: Pyfa_debug

#on_success:
# - TODO: upload the content of dist/*.whl to a public wheelhouse
#
@@ -2,6 +2,11 @@ codecov:
notify:
require_ci_to_pass: yes

ignore:
- "scripts" # ignore scripts folder
- "setup.py"
- "setup-osx.py"

coverage:
precision: 2
round: down
@@ -1,22 +1,40 @@
language: python
cache: pip
python:
- '2.7'
env:
- TOXENV=pep8
matrix:
include:
- os: linux
sudo: required
language: python
python: 2.7
env: "TOXENV=pep8 ARTIFACTS_BUCKET=pyfa.builds ARTIFACTS_PATHS=\"$TRAVIS_BUILD_DIR/pyfa_linux.zip:/$TRAVIS_BUILD_DIR/pyfa_linux_debug.zip:$TRAVIS_BUILD_DIR/build/pyfa/warnpyfa.txt\""
- os: osx
language: generic
python: 2.7
env: "TOXENV=pep8 ARTIFACTS_BUCKET=pyfa.builds ARTIFACTS_PATHS=\"$TRAVIS_BUILD_DIR/pyfa_mac.zip:$TRAVIS_BUILD_DIR/pyfa_mac_debug.zip:$TRAVIS_BUILD_DIR/build/pyfa/warnpyfa.txt\""
addons:
apt:
packages:
before_install:
- sudo apt-get update && sudo apt-get --reinstall install -qq language-pack-en language-pack-ru language-pack-he language-pack-zh-hans
- 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;
# Update the environment
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
sudo apt-get install libatk-adaptor libgail-common;
sudo apt-get install libatk-adaptor:i386 libgail-common:i386;
sudo apt-get install gtk2-engines;
sudo apt-get install gtk2-engines-*;
sudo apt-get install libfreetype6-dev;
sudo apt-get install fonts-cantarell lmodern ttf-aenigma ttf-georgewilliams ttf-bitstream-vera ttf-sjfonts ttf-tuffy tv-fonts;
sudo apt-get install ubuntustudio-font-meta;
sudo apt-get update && sudo apt-get --reinstall install -qq language-pack-en language-pack-ru language-pack-he language-pack-zh-hans;
wget https://repo.continuum.io/miniconda/Miniconda2-latest-Linux-x86_64.sh -O miniconda.sh;
fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
brew update;
brew install graphviz;
fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
wget https://repo.continuum.io/miniconda/Miniconda2-latest-MacOSX-x86_64.sh -O miniconda.sh;
fi
- bash miniconda.sh -b -p $HOME/miniconda
- export PATH="$HOME/miniconda/bin:$PATH"
@@ -34,6 +52,48 @@ before_script:
script:
- py.test --cov=./
after_success:
# Upload coverage data
- bash <(curl -s https://codecov.io/bash)
before_deploy:
- pip install -r requirements_build_linux.txt

# Install requirements to build the package
- pip install -r requirements_build.txt

# copy pyinstaller build files into place
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
cp $TRAVIS_BUILD_DIR/dist_assets/linux/pyfa.spec $TRAVIS_BUILD_DIR/pyfa.spec;
cp $TRAVIS_BUILD_DIR/dist_assets/linux/pyfa_debug.spec $TRAVIS_BUILD_DIR/pyfa_debug.spec;
fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
cp $TRAVIS_BUILD_DIR/dist_assets/mac/pyfa.spec $TRAVIS_BUILD_DIR/pyfa.spec;
cp $TRAVIS_BUILD_DIR/dist_assets/mac/pyfa_debug.spec $TRAVIS_BUILD_DIR/pyfa_debug.spec;
fi
- ls $TRAVIS_BUILD_DIR
- if [[ "$TRAVIS_OS_NAME" == "mac" ]]; then
cp ~/dist_assets/mac/pyfa.spec ~/pyfa.spec;
cp ~/dist_assets/mac/pyfa_debug.spec ~/pyfa_debug.spec;
fi
- ls $TRAVIS_BUILD_DIR
- ls $TRAVIS_BUILD_DIR/dist_assets/mac/

# Run build
- cd $TRAVIS_BUILD_DIR
- pyinstaller --clean --noconfirm --windowed $TRAVIS_BUILD_DIR/pyfa.spec
- pyinstaller --clean --noconfirm --windowed $TRAVIS_BUILD_DIR/pyfa_debug.spec

# zip builds
- cd $TRAVIS_BUILD_DIR/dist/;
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
zip -r $TRAVIS_BUILD_DIR/pyfa_linux.zip $TRAVIS_BUILD_DIR/dist/pyfa;
zip -r $TRAVIS_BUILD_DIR/pyfa_linux_debug.zip $TRAVIS_BUILD_DIR/dist/pyfa_debug;
fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
zip -r $TRAVIS_BUILD_DIR/pyfa_mac.zip $TRAVIS_BUILD_DIR/dist/pyfa;
zip -r $TRAVIS_BUILD_DIR/pyfa_mac_debug.zip $TRAVIS_BUILD_DIR/dist/pyfa_debug;
fi

# Debugging
- ls $TRAVIS_BUILD_DIR

addons:
artifacts:
s3_region: "us-west-2"
@@ -1,8 +1,8 @@
# pyfa.fit

_Master_: [![Build Status](https://travis-ci.org/Pyfa-fit/Pyfa.svg?branch=master)](https://travis-ci.org/pyfa-fit/Pyfa) [![Build Status](https://ci.appveyor.com/api/projects/status/6o0qe49yajcg7hyy/branch/master?svg=true)](https://ci.appveyor.com/project/Ebag333/pyfa-nr5qw/branch/master) [![codecov](https://codecov.io/gh/Pyfa-fit/Pyfa/branch/master/graph/badge.svg)](https://codecov.io/gh/Pyfa-fit/Pyfa) [![Codacy Badge](https://api.codacy.com/project/badge/Grade/99b3b8298c534ebab103435cc6471554)](https://www.codacy.com/app/Ebag333/Pyfa?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=Pyfa-fit/Pyfa&amp;utm_campaign=Badge_Grade)
_Master_: [![Build Status](https://travis-ci.org/Pyfa-fit/Pyfa.svg?branch=master)](https://travis-ci.org/pyfa-fit/Pyfa) [![Build Status](https://ci.appveyor.com/api/projects/status/6o0qe49yajcg7hyy/branch/master?svg=true)](https://ci.appveyor.com/project/Ebag333/pyfa-nr5qw/branch/master) [![codecov](https://codecov.io/gh/Pyfa-fit/Pyfa-fit/branch/master/graph/badge.svg)](https://codecov.io/gh/Pyfa-fit/Pyfa) [![Codacy Badge](https://api.codacy.com/project/badge/Grade/86ace8fc05c24ae59b61e0223f7d161b)](https://www.codacy.com/app/Ebag333/Pyfa-fit?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=Pyfa-fit/Pyfa-fit&amp;utm_campaign=Badge_Grade)

_Development_: [![Build Status](https://travis-ci.org/Pyfa-fit/Pyfa.svg?branch=development)](https://travis-ci.org/pyfa-fit/Pyfa) [![Build Status](https://ci.appveyor.com/api/projects/status/6o0qe49yajcg7hyy/branch/development?svg=true)](https://ci.appveyor.com/project/Ebag333/pyfa-nr5qw/branch/development) [![codecov](https://codecov.io/gh/Pyfa-fit/Pyfa/branch/development/graph/badge.svg)](https://codecov.io/gh/Pyfa-fit/Pyfa)
_Development_: [![Build Status](https://travis-ci.org/Pyfa-fit/Pyfa.svg?branch=development)](https://travis-ci.org/pyfa-fit/Pyfa) [![Build Status](https://ci.appveyor.com/api/projects/status/6o0qe49yajcg7hyy/branch/development?svg=true)](https://ci.appveyor.com/project/Ebag333/pyfa-nr5qw/branch/development) [![codecov](https://codecov.io/gh/Pyfa-fit/Pyfa-fit/branch/development/graph/badge.svg)](https://codecov.io/gh/Pyfa-fit/Pyfa)

![pyfa](/imgs/mainframe.png "Pyfa")
## What is it?
@@ -18,37 +18,36 @@ Development releases will have newer features, and may not function correctly. U
_*Release Downloads*_:
[Current Release](https://github.com/Pyfa-fit/Pyfa/releases)
### Windows
### Development Downloads
_*Development Downloads*_:
[x86](https://ci.appveyor.com/api/projects/Ebag333/pyfa-nr5qw/artifacts/pyfa.zip?branch=development&job=Environment%3A%20PYTHON%3DC%3A%5CPython27%2C%20PYTHON_VERSION%3D2.7.x%2C%20PYTHON_ARCH%3D32)
_*Windows*_:
[x86](https://ci.appveyor.com/api/projects/Ebag333/pyfa-nr5qw/artifacts/Pyfa_Windows.zip?branch=development&job=Environment%3A%20PYTHON%3DC%3A%5CPython27%2C%20PYTHON_VERSION%3D2.7.x%2C%20PYTHON_ARCH%3D32)
|
[x64](https://ci.appveyor.com/api/projects/Ebag333/pyfa-nr5qw/artifacts/pyfa.zip?branch=development&job=Environment%3A%20PYTHON%3DC%3A%5CPython27-x64%2C%20PYTHON_VERSION%3D2.7.x%2C%20PYTHON_ARCH%3D64)
### Linux/OS X
[x64](https://ci.appveyor.com/api/projects/Ebag333/pyfa-nr5qw/artifacts/Pyfa_Windows_x64.zip?branch=development&job=Environment%3A%20PYTHON%3DC%3A%5CPython27-x64%2C%20PYTHON_VERSION%3D2.7.x%2C%20PYTHON_ARCH%3D64)
_*Development Downloads*_:
Can be fetched by download the current repository
_*Linux/OS X*_:
Can be fetched by downloading the current repository
## Installation
### Windows
Windows users are supplied self-contained builds of pyfa on the [latest releases](https://github.com/Pyfa-fit/Pyfa/releases/latest) page. An `.exe` installer is also available for Windows builds.
Windows users are supplied self-contained builds of pyfa on the [latest releases](https://github.com/Pyfa-fit/Pyfa-fit/releases/latest) page. Simply download the zip file, extract, and run `pyfa.exe`.
#### Linux/OS X
Linux and Mac users can run pyfa using their distribution's Python interpreter. There is no official self-contained package for Linux or Mac (a feature currently in progress).
Linux and Mac users can run pyfa using their distribution's Python interpreter. There is no official self-contained package for Linux or Mac (a feature currently in progress). Download the latest zip file from the [latest releases](https://github.com/Pyfa-fit/Pyfa-fit/releases/latest) page, extract, and run `python ./pyfa.py`.
### Dependencies
If you wish to help with development or simply need to run pyfa through a Python interpreter, all requirements are listed in `requirements.txt`.
If you wish to run pyfa through a Python interpreter, all requirements are listed in `requirements.txt`.
For development, it is recommended also using `requirements_build.txt` and `requirements_test.txt`.
## Bug Reporting
The preferred method of reporting bugs is through the project's [GitHub Issues interface](https://github.com/pyfa-fit/Pyfa/issues).
The preferred method of reporting bugs is through the project's [GitHub Issues interface](https://github.com/pyfa-fit/Pyfa-fit/issues).
## License
pyfa is licensed under the GNU GPL v3.0, see LICENSE
## Resources
* Development repository: [https://github.com/pyfa-fit/Pyfa](https://github.com/pyfa-fit/Pyfa)
* Development repository: [https://github.com/Pyfa-fit/Pyfa-fit](https://github.com/Pyfa-fit/Pyfa-fit)
* [EVE University guide using pyfa](http://wiki.eveuniversity.org/Guide_to_using_PYFA)
* [EVE Online website](http://www.eveonline.com/)
@@ -3,93 +3,13 @@

import os
import sys
import threading

from sqlalchemy import MetaData, create_engine
from sqlalchemy.orm import sessionmaker

script_dir = os.path.dirname(os.path.abspath(__file__))
# Add root folder to python paths
sys.path.append(os.path.realpath(os.path.join(script_dir, u'..', u'..')))
sys._called_from_test = True


# noinspection PyUnresolvedReferences,PyUnusedLocal
@pytest.fixture
def DBInMemory_test():
def rollback():
with sd_lock:
saveddata_session.rollback()

print("Creating database in memory")
from os.path import realpath, join, dirname, abspath

debug = False
gamedataCache = True
saveddataCache = True
gamedata_version = ""
gamedata_connectionstring = 'sqlite:///' + realpath(join(dirname(abspath(unicode(__file__))), "..", "eve.db"))
saveddata_connectionstring = 'sqlite:///:memory:'

class ReadOnlyException(Exception):
pass

if callable(gamedata_connectionstring):
gamedata_engine = create_engine("sqlite://", creator=gamedata_connectionstring, echo=debug)
else:
gamedata_engine = create_engine(gamedata_connectionstring, echo=debug)

gamedata_meta = MetaData()
gamedata_meta.bind = gamedata_engine
gamedata_session = sessionmaker(bind=gamedata_engine, autoflush=False, expire_on_commit=False)()

# This should be moved elsewhere, maybe as an actual query. Current, without try-except, it breaks when making a new
# game db because we haven't reached gamedata_meta.create_all()
try:
gamedata_version = gamedata_session.execute(
"SELECT `field_value` FROM `metadata` WHERE `field_name` LIKE 'client_build'"
).fetchone()[0]
except Exception as e:
print("Missing gamedata version.")
gamedata_version = None

if saveddata_connectionstring is not None:
if callable(saveddata_connectionstring):
saveddata_engine = create_engine(creator=saveddata_connectionstring, echo=debug)
else:
saveddata_engine = create_engine(saveddata_connectionstring, echo=debug)

saveddata_meta = MetaData()
saveddata_meta.bind = saveddata_engine
saveddata_session = sessionmaker(bind=saveddata_engine, autoflush=False, expire_on_commit=False)()
else:
saveddata_meta = None

# Lock controlling any changes introduced to session
sd_lock = threading.Lock()

# Import all the definitions for all our database stuff
# noinspection PyPep8
# from eos.db.gamedata import alphaClones, attribute, category, effect, group, icon, item, marketGroup, metaData, metaGroup, queries, traits, unit
# noinspection PyPep8
# from eos.db.saveddata import booster, cargo, character, crest, damagePattern, databaseRepair, drone, fighter, fit, implant, implantSet, loadDefaultDatabaseValues, miscData, module, override, price, queries, skill, targetResists, user

# If using in memory saveddata, you'll want to reflect it so the data structure is good.
if saveddata_connectionstring == "sqlite:///:memory:":
saveddata_meta.create_all()

# Output debug info to help us troubleshoot Travis
print(saveddata_engine)
print(gamedata_engine)

helper = {
# 'config': eos.config,
'gamedata_session' : gamedata_session,
'saveddata_session': saveddata_session,
}
return helper


# noinspection PyUnresolvedReferences,PyUnusedLocal
@pytest.fixture
def DBInMemory():

0 comments on commit c468f61

Please sign in to comment.
You can’t perform that action at this time.