Skip to content

Commit ca77c98

Browse files
author
sreeder
committed
update tests, add iss files for windows setup
1 parent 8d3429b commit ca77c98

35 files changed

Lines changed: 272360 additions & 122 deletions

.travis.yml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
language: python
2+
sudo: required
3+
# if the https://travis-ci.org/ODM2/ODMToolsPython/requests ever says: missing config
4+
# validate at: http://lint.travis-ci.org/
5+
python:
6+
# - "2.6"
7+
- "2.7"
8+
# - "3.2"
9+
# - "3.3"
10+
# - "3.4"
11+
# - "3.5"
12+
# - "3.5-dev" # 3.5 development branch
13+
# - "nightly" # currently points to 3.6-dev
14+
# command to install dependencies
15+
cache:
16+
directories:
17+
- $HOME/.cache/pip/wheels
18+
- $HOME/virtualenv/python2.7.9
19+
services:
20+
- mysql
21+
- postgresql
22+
addons:
23+
apt:
24+
packages:
25+
- cmake
26+
- unixodbc
27+
- unixodbc-dev
28+
- odbcinst1debian2
29+
- odbcinst
30+
- freetds-dev
31+
- freetds-bin
32+
- tdsodbc
33+
- libc6
34+
- e2fsprogs
35+
- mysql-client
36+
- libproj-dev
37+
# mariadb: '10.1'
38+
before_script:
39+
- ./scripts/tests/mysql_setup.sh
40+
- ./scripts/tests/postgres_setup.sh
41+
- ./scripts/tests/freetds.sh
42+
43+
before_install:
44+
# python -m pip makes the install go into the virtualenv
45+
- python -m pip install pandas
46+
- export PYMSSQL_BUILD_WITH_BUNDLED_FREETDS=1;python -m pip install pymssql
47+
# - python -m pip install mysql-python
48+
install: # now just our code
49+
- pip install geoalchemy2
50+
- pip install -r requirements_tests.txt --allow-external pyodbc --allow-unverified pyodbc
51+
- pip list
52+
53+
# don't forget to open up the azure mssql server to these addreses
54+
# https://docs.travis-ci.com/user/ip-addresses/
55+
56+
# command to run tests
57+
script:
58+
- py.test
59+

odmtools/controller/frmBulkInsert.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ def readDataFromCSV(self, filepath):
6363
8: str.strip,
6464
9: str.strip})
6565
except CParserError as e:
66+
6667
msg = wx.MessageDialog(None, "There was an issue trying to parse your file. "
6768
"Please compare your csv with the template version as the file"
6869
" you provided "

odmtools/controller/frmSeriesSelector.py

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,6 @@ def refreshTableSeries(self, db):
8484
8585
:return:
8686
"""
87-
88-
chcklist= self.tblSeries.GetCheckedObjects()
89-
90-
9187
self.memDB.set_series_service(db)
9288
object = self.series_service.get_all_series()
9389
#checkedObjs = self.tblSeries.GetCheckedObjects()
@@ -97,10 +93,6 @@ def refreshTableSeries(self, db):
9793
if x.id not in idList:
9894
self.tblSeries.AddObject(x)
9995

100-
101-
for c in chcklist:
102-
self.tblSeries.SetCheckState(c, True)
103-
10496
#for x in checkedObjs:
10597
# super(FastObjectListView, self.tblSeries).SetCheckState(x, True)
10698

@@ -109,18 +101,10 @@ def refreshSeries(self):
109101
110102
:return:
111103
"""
112-
chcklist= self.tblSeries.GetCheckedObjects()
113104
self.series_service = None
114-
115105
self.series_service = self.parent.Parent.createService()
116106
#self.refreshTableSeries(self.dbservice)
117107
self.resetDB(self.series_service)
118-
for c in chcklist:
119-
for val in self.tblSeries.GetObjects():
120-
if c == val:
121-
self.tblSeries.SetCheckState(val, True)
122-
break
123-
124108
logger.debug("Repopulate Series Selector")
125109

126110
def initSVBoxes(self):
@@ -574,14 +558,9 @@ def stopEdit(self):
574558
575559
:return:
576560
"""
577-
578561
self.isEditing = False
579-
chcklist= self.tblSeries.GetCheckedObjects()
580-
581562
self.tblSeries.RefreshObject(self.tblSeries.editingObject)
582-
for c in chcklist:
583-
self.tblSeries.SetCheckState(c, True)
584-
563+
self.tblSeries.editingObject = None
585564
self.memDB.stopEdit()
586565

587566
def isEditing(self):

odmtools/controller/logicPlotOptions.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -125,20 +125,11 @@ def getEditSeriesID(self):
125125
else:
126126
return None
127127

128-
129-
130-
131-
def updateEditSeries(self):
132-
#update values
133-
if self.editID in self._seriesInfos:
134-
# self._seriesInfos[self.editID].dataTable = self.memDB.getEditDataValuesforGraph()
135-
data =self.memDB.getEditDataValuesforGraph()
136-
self._seriesInfos[self.editID].dataTable = data
137-
138128
def setEditSeries(self, seriesID):
139129

140130
self.editID = int(seriesID)
141131
# self.memDB.initEditValues(self.editID)
132+
142133
if self.editID not in self._seriesInfos:
143134
self.update(self.editID, True)
144135
# self.getSeriesInfo(self.editID)
@@ -153,6 +144,15 @@ def setEditSeries(self, seriesID):
153144
self._seriesInfos[self.editID].plotcolor = self._seriesInfos[self.editID].color
154145
self._seriesInfos[self.editID].color = "Black"
155146

147+
148+
def updateEditSeries(self):
149+
#update values
150+
if self.editID in self._seriesInfos:
151+
# self._seriesInfos[self.editID].dataTable = self.memDB.getEditDataValuesforGraph()
152+
data =self.memDB.getEditDataValuesforGraph()
153+
self._seriesInfos[self.editID].dataTable = data
154+
155+
156156
def stopEditSeries(self):
157157
if self.editID in self._seriesInfos:
158158
data = self.memDB.getDataValuesforGraph(

odmtools/gui/frmODMTools.py

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ class frmODMToolsMain(wx.Frame):
3838

3939
def __init__(self, **kwargs):
4040
"""
41+
4142
"""
4243

4344
self.taskserver = kwargs.pop('taskServer')
@@ -437,18 +438,12 @@ def addEdit(self, event):
437438

438439
def stopEdit(self, event):
439440

440-
val = wx.MessageBox( "Are you sure you want to stop editing",
441-
'Stop Editing?', wx.YES_NO | wx.ICON_QUESTION, parent=self)
442-
if val == 2: #_YES
443-
444-
self.pnlSelector.stopEdit()
445-
446-
self.dataTable.stopEdit()
447-
self.pnlPlot.stopEdit()
448-
Publisher.sendMessage("toggleEdit", checked=False)
449-
self.memDB.reset_edit()
450-
self.record_service = None
451-
self._ribbon.toggleEditButtons(False)
441+
self.pnlSelector.stopEdit()
442+
self.dataTable.stopEdit()
443+
self.pnlPlot.stopEdit()
444+
Publisher.sendMessage("toggleEdit", checked=False)
445+
self.record_service = None
446+
self._ribbon.toggleEditButtons(False)
452447

453448

454449
def getRecordService(self):

odmtools/gui/mnuPlotToolbar.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -149,11 +149,8 @@ def stopEdit(self):
149149
self.xys = None
150150
self.editCurve = None
151151
self.lassoAction = None
152-
# untoggle select button
153-
self.ToggleTool(self.select_tool.Id, False)
154152
# disable select button
155153
self.select_tool.Enable(False)
156-
157154
self.zoom_to_data.Enable(False)
158155
self.Realize()
159156
#untoggle lasso button

odmtools/gui/plotTimeSeries.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,7 @@ def changePlotSelection(self, filtered_datetime):
176176
def lassoChangeSelection(self, filtered_datetime):
177177
self.parent.record_service.select_points(dataframe=filtered_datetime)
178178

179+
179180
def onShowLegend(self, isVisible):
180181
if isVisible:
181182
self.isShowLegendEnabled = True
@@ -303,6 +304,10 @@ def Plot(self, seriesPlotInfo):
303304
self.toolbar.update()
304305
self.toolbar.push_current()
305306

307+
#self._views.home()
308+
#self._positions.home()
309+
#self.set_history_buttons()
310+
306311
#clear plot
307312
def clear(self):
308313
"""
@@ -314,7 +319,12 @@ def clear(self):
314319
for key, ax in self.axislist.items():
315320
ax.clear()
316321
self.axislist = {}
317-
322+
#self.canvas.draw()
323+
# self.stopEdit()
324+
#print "TimeSeries: ", dir(self.timeSeries), type(self.timeSeries)
325+
#plt.cla()
326+
#plt.clf()
327+
#self.timeSeries.plot([], [], picker=5)
318328

319329

320330
def setUpYAxis(self):

odmtools/odmdata/series.py

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -96,22 +96,6 @@ class Series(Base):
9696
def __repr__(self):
9797
return "<Series('%s', '%s', '%s', '%s')>" % (self.id, self.site_name, self.variable_code, self.variable_name)
9898

99-
def __eq__(self, other) :
100-
# return self.__dict__ == other.__dict__
101-
return [self.id, self.site_id, self.site_code, self.site_name, self.variable_id, self.variable_code,
102-
self.variable_name, self.speciation, self.variable_units_id, self.variable_units_name,
103-
self.sample_medium, self.value_type, self.time_support, self.time_units_id, self.time_units_name,
104-
self.data_type, self.general_category, self.method_id, self.method_description,
105-
self.source_id, self.source_description, self.organization, self.citation,
106-
self.quality_control_level_id, self.quality_control_level_code, self.begin_date_time,
107-
self.end_date_time, self.begin_date_time_utc, self.end_date_time_utc, self.value_count] ==\
108-
[other.id, other.site_id, other.site_code, other.site_name, other.variable_id, other.variable_code,
109-
other.variable_name, other.speciation, other.variable_units_id, other.variable_units_name,
110-
other.sample_medium, other.value_type, other.time_support, other.time_units_id, other.time_units_name,
111-
other.data_type, other.general_category, other.method_id, other.method_description,
112-
other.source_id, other.source_description, other.organization, other.citation,
113-
other.quality_control_level_id, other.quality_control_level_code, other.begin_date_time,
114-
other.end_date_time, other.begin_date_time_utc, other.end_date_time_utc, other.value_count]
11599

116100
def get_table_columns(self):
117101
return self.__table__.columns.keys()

odmtools/odmservices/service_manager.py

Lines changed: 6 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def __init__(self, debug=False):
2626
f = self._get_file('r')
2727
self._conn_dicts = []
2828
self.version = 0
29-
29+
self._connection_format = "%s+%s://%s:%s@%s/%s"
3030

3131
# Read all lines (connections) in the connection.cfg file
3232
while True:
@@ -185,62 +185,30 @@ def _get_file(self, mode):
185185

186186
return config_file
187187

188-
# def _build_connection_string(self, conn_dict):
189-
# driver = ""
190-
# connformat= self._connection_format
191-
# if conn_dict['engine'] == 'mssql' and sys.platform != 'win32':
192-
# driver = "pyodbc"
193-
# quoted = urllib.quote_plus('DRIVER={FreeTDS};DSN=%s;UID=%s;PWD=%s;' % (conn_dict['address'], conn_dict['user'], conn_dict['password']))
194-
# conn_string = 'mssql+pyodbc:///?odbc_connect={}'.format(quoted)
195-
#
196-
# else:
197-
# if conn_dict['engine'] == 'mssql':
198-
# driver = "pyodbc"
199-
# connformat=self._connection_format = "%s+%s://%s:%s@%s/%s?driver=SQL+Server+Native+Client+10.0"
200-
# elif conn_dict['engine'] == 'mysql':
201-
# driver = "pymysql"
202-
# elif conn_dict['engine'] == 'postgresql':
203-
# driver = "psycopg2"
204-
# else:
205-
# driver = "None"
206-
#
207-
# conn_string = connformat % (
208-
# conn_dict['engine'], driver, conn_dict['user'], conn_dict['password'], conn_dict['address'],
209-
# conn_dict['db'])
210-
# return conn_string
211188
def _build_connection_string(self, conn_dict):
212-
# driver = ""
213-
# print "****", conn_dict
214-
189+
driver = ""
190+
connformat= self._connection_format
215191
if conn_dict['engine'] == 'mssql' and sys.platform != 'win32':
216192
driver = "pyodbc"
217-
#'DRIVER={FreeTDS};DSN=%s;UID=%s;PWD=%s;' % (conn_dict['address'], conn_dict['user'], conn_dict['password'])
218193
quoted = urllib.quote_plus('DRIVER={FreeTDS};DSN=%s;UID=%s;PWD=%s;' % (conn_dict['address'], conn_dict['user'], conn_dict['password']))
219194
conn_string = 'mssql+pyodbc:///?odbc_connect={}'.format(quoted)
195+
220196
else:
221-
self._connection_format = "%s+%s://%s:%s@%s/%s"
222197
if conn_dict['engine'] == 'mssql':
223198
driver = "pyodbc"
224-
#self._connection_format = "%s+%s://%s:%s@%s/%s?driver=SQL+Server+Native+Client+10.0"
225-
conn = "%s+%s://%s:%s@%s/%s?driver=SQL+Server"
226-
if "sqlncli11.dll" in os.listdir("C:\\Windows\\System32"):
227-
conn = "%s+%s://%s:%s@%s/%s?driver=SQL+Server+Native+Client+11.0"
228-
self._connection_format = conn
199+
connformat=self._connection_format = "%s+%s://%s:%s@%s/%s?driver=SQL+Server+Native+Client+10.0"
229200
elif conn_dict['engine'] == 'mysql':
230201
driver = "pymysql"
231202
elif conn_dict['engine'] == 'postgresql':
232203
driver = "psycopg2"
233204
else:
234205
driver = "None"
235206

236-
conn_string = self._connection_format % (
207+
conn_string = connformat % (
237208
conn_dict['engine'], driver, conn_dict['user'], conn_dict['password'], conn_dict['address'],
238209
conn_dict['db'])
239-
240-
# print "******", conn_string
241210
return conn_string
242211

243-
244212
def _save_connections(self):
245213
f = self._get_file('w')
246214
for conn in self._conn_dicts:

requirements.txt

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,15 @@ scipy
66
#psycopg2
77
sqlalchemy
88
matplotlib
9-
pandas
10-
geoalchemy2
11-
#wxpython
12-
9+
#pandas
10+
#geoalchemy2
11+
addons:
12+
apt:
13+
packages:
14+
# for wxPython:
15+
- python-wxgtk2.8
16+
- python-wxtools
17+
- wx2.8-doc
18+
- wx2.8-examples
19+
- wx2.8-headers
20+
- wx2.8-i18n

0 commit comments

Comments
 (0)