-
Notifications
You must be signed in to change notification settings - Fork 2
/
test_persistence.py
34 lines (24 loc) · 1021 Bytes
/
test_persistence.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import os.path
import sys
script_dir = os.path.dirname(os.path.abspath(__file__))
sys.path.append(os.path.realpath(os.path.join(script_dir, 'external')))
import os
from service.data.eve_data.query import *
from service.data.pyfa_data import *
from service.data.pyfa_data.query import *
from service.data.pyfa_data import PyfaDataManager
from service.source import SourceManager
eve_dbpath_tq = os.path.join(script_dir, 'staticdata', 'tranquility.db')
pyfa_dbpath = os.path.join(script_dir, 'userdata', 'pyfadata.db')
# Initialize databases with eve data
SourceManager.add('tq', eve_dbpath_tq, make_default=True)
SourceManager.add('sisi', eve_dbpath_tq)
# (Re-)Initialize database for pyfa save data
PyfaDataManager.set_pyfadb_path(pyfa_dbpath)
session_pyfadata = PyfaDataManager.session
def print_attrs(item):
print(item.eve_name)
for k in sorted(item.attributes, key=lambda i: i.name):
print(' {}: {}'.format(k.name, item.attributes[k]))
for fit in query_all_fits():
print_attrs(fit.ship)