From 04ccb73d99e0e90e924d0f8d926c7881833802c3 Mon Sep 17 00:00:00 2001 From: stephanie Date: Tue, 17 May 2016 16:52:51 -0600 Subject: [PATCH 01/36] update tests --- .travis.yml | 4 ++-- requirements.txt | 2 +- tests/test_controller/test_frmAddPoints.py | 4 ++-- tests/test_odmdata/test_FreeTDS.py | 7 +++---- 4 files changed, 8 insertions(+), 9 deletions(-) diff --git a/.travis.yml b/.travis.yml index b3df53a..38a4570 100644 --- a/.travis.yml +++ b/.travis.yml @@ -62,6 +62,6 @@ install: # now just our code # command to run tests script: - - - py.test + - pythonw -m pytest +# - py.test diff --git a/requirements.txt b/requirements.txt index 75eb7ef..9bd5dab 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,7 +3,7 @@ pymysql numpy scipy sqlalchemy -matplotlib +#matplotlib #psycopg2 #pandas #geoalchemy2 diff --git a/tests/test_controller/test_frmAddPoints.py b/tests/test_controller/test_frmAddPoints.py index 66bdc93..777efdb 100755 --- a/tests/test_controller/test_frmAddPoints.py +++ b/tests/test_controller/test_frmAddPoints.py @@ -101,8 +101,8 @@ def test_customRemove(self): ## Test order remains the same after removing size = 10000 objects = self._buildObjects(size) - for i in objects: - print i.dataValue + # for i in objects: + # print i.dataValue assert len(objects) == size tests = [1, 5, 25, 100, 150, 300, 600, 55, 9000] diff --git a/tests/test_odmdata/test_FreeTDS.py b/tests/test_odmdata/test_FreeTDS.py index ce032c1..de36ddb 100644 --- a/tests/test_odmdata/test_FreeTDS.py +++ b/tests/test_odmdata/test_FreeTDS.py @@ -16,7 +16,6 @@ def setup(self): if sys.platform != 'win32': # connection string # create engine - #quoted = urllib.quote_plus('DRIVER={FreeTDS};Server=iutahqc.uwrl.usu.edu;Database=iUTAH_Logan_OD;UID=qc;PWD=iUTAH123!!;TDS_Version=8.0;Port=1433;') quoted = urllib.quote_plus('DRIVER={FreeTDS};DSN=iutahqc;UID=qc;PWD=iUTAH123!!;') engine = sqlalchemy.create_engine('mssql+pyodbc:///?odbc_connect={}'.format(quoted)) # conn = engine.connect() @@ -37,6 +36,6 @@ def setup(self): print i assert q print engine - #todo: does this work on mac? - def test_connection(self): - pass + # + # def test_connection(self): + # pass From 0239db3572fd99fc19b5713dda068057fc9499bb Mon Sep 17 00:00:00 2001 From: stephanie Date: Tue, 17 May 2016 17:24:24 -0600 Subject: [PATCH 02/36] test requirements.txt --- odmtools/odmservices/series_service.py | 1 + requirements_tests.txt | 11 +------- tests/test_odmservices/test_edit_service.py | 29 ++++++++++++++++----- tests/test_util.py | 1 + 4 files changed, 25 insertions(+), 17 deletions(-) diff --git a/odmtools/odmservices/series_service.py b/odmtools/odmservices/series_service.py index 891faae..c843fa7 100644 --- a/odmtools/odmservices/series_service.py +++ b/odmtools/odmservices/series_service.py @@ -744,6 +744,7 @@ def series_exists_quint(self, site_id, var_id, method_id, source_id, qcl_id): return True except: return False + def qcl_exists(self, q): """ diff --git a/requirements_tests.txt b/requirements_tests.txt index 2561a22..9d3c7d6 100644 --- a/requirements_tests.txt +++ b/requirements_tests.txt @@ -1,14 +1,5 @@ -#-r requirements.txt +-r requirements.txt -pyodbc -pymysql -numpy==1.9.2 -scipy -sqlalchemy -matplotlib==1.4.3 -#psycopg2 -#pandas -#geoalchemy2 diff --git a/tests/test_odmservices/test_edit_service.py b/tests/test_odmservices/test_edit_service.py index ded9805..a27ad13 100644 --- a/tests/test_odmservices/test_edit_service.py +++ b/tests/test_odmservices/test_edit_service.py @@ -74,19 +74,34 @@ def test_save_series(self): def test_save_as_series(self): var = test_util.add_variable(self.session) print var + stlen = len(self.series.data_values) assert self.edit_service.save_as(var= var) - ##assert self.edit_service.memDB.series_service.series_exists(self.series.site.id, var, self.series.method.id, - # self.series.source.id, self.series.qcl.id) + assert self.edit_service.memDB.series_service.series_exists_quint(self.series.site_id, var.id, self.series.method_id, self.series.source_id, self.series.quality_control_level_id) def test_save_as_existing_series(self): var = test_util.add_variable(self.session) assert self.edit_service.save_existing(var = var) - def test_save_append(self): - #TODO add custon test - var = test_util.add_variable(self.session) - print var - assert self.edit_service.save_existing(var= var) + # def test_save_append(self): + # #TODO add custon test + # var = test_util.add_variable(self.session) + # meth = test_util.add_method(self.session) + # + # print var + # print meth + # + # print self.series.value_count + # print len(self.series.data_values) + # # keep data from original series if overlap: + # result = self.edit_service.save_appending(var=var, overwrite = False) + # assert result + # + # print self.series.value_count + # print len(self.series.data_values) + # # keep new: + # result = self.edit_service.save_appending(var=var, overwrite = True) + # assert result + diff --git a/tests/test_util.py b/tests/test_util.py index 3e7c2d0..43789d3 100644 --- a/tests/test_util.py +++ b/tests/test_util.py @@ -95,6 +95,7 @@ def add_series(session): series.end_date_time = dvs[-1].local_date_time series.begin_date_time_utc = dvs[0].date_time_utc series.end_date_time_utc = dvs[-1].date_time_utc + series.value_count = len(dvs) session.add(series) session.commit() From 8d1241ba3720920efcd068ccff7921d29c34b595 Mon Sep 17 00:00:00 2001 From: stephanie Date: Tue, 17 May 2016 17:37:07 -0600 Subject: [PATCH 03/36] test requirements --- odmtools/odmservices/edit_service.py | 2 +- requirements.txt | 2 +- requirements_tests.txt | 3 -- tests/test_odmservices/test_edit_service.py | 39 +++++++++++---------- 4 files changed, 22 insertions(+), 24 deletions(-) diff --git a/odmtools/odmservices/edit_service.py b/odmtools/odmservices/edit_service.py index e0699fb..f6a87ee3 100644 --- a/odmtools/odmservices/edit_service.py +++ b/odmtools/odmservices/edit_service.py @@ -510,7 +510,7 @@ def updateSeries(self, var=None, method=None, qcl=None, is_new_series=False, ove series.end_date_time = datetime.datetime.strptime(str(np.max(dvs["LocalDateTime"])), form) series.end_date_time_utc = datetime.datetime.strptime(str(np.max(dvs["DateTimeUTC"])), form) #TODO figure out how to calculate the new value count - series.value_count = series.value_count+len(dvs) + series.value_count = len(dvs) if overlap: if overwrite: diff --git a/requirements.txt b/requirements.txt index 9bd5dab..1aaf9bf 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,7 +1,7 @@ pyodbc pymysql numpy -scipy +#scipy sqlalchemy #matplotlib #psycopg2 diff --git a/requirements_tests.txt b/requirements_tests.txt index 9d3c7d6..0fbc0b9 100644 --- a/requirements_tests.txt +++ b/requirements_tests.txt @@ -1,8 +1,5 @@ -r requirements.txt - - - pytest pytest-cov mock diff --git a/tests/test_odmservices/test_edit_service.py b/tests/test_odmservices/test_edit_service.py index a27ad13..56ba043 100644 --- a/tests/test_odmservices/test_edit_service.py +++ b/tests/test_odmservices/test_edit_service.py @@ -82,25 +82,26 @@ def test_save_as_existing_series(self): var = test_util.add_variable(self.session) assert self.edit_service.save_existing(var = var) - # def test_save_append(self): - # #TODO add custon test - # var = test_util.add_variable(self.session) - # meth = test_util.add_method(self.session) - # - # print var - # print meth - # - # print self.series.value_count - # print len(self.series.data_values) - # # keep data from original series if overlap: - # result = self.edit_service.save_appending(var=var, overwrite = False) - # assert result - # - # print self.series.value_count - # print len(self.series.data_values) - # # keep new: - # result = self.edit_service.save_appending(var=var, overwrite = True) - # assert result + def test_save_append(self): + #TODO add custon test + + len1= len(self.series.data_values) + # keep data from original series if overlap: + result = self.edit_service.save_appending(overwrite = False) + len2= len(self.series.data_values) + assert len1 == len2 + + + # self.edit_service.memDB.updateValue([self.sdate],'+', 5 ) + # dvs = self.memory_db.getDataValuesDF() + # assert dvs["DataValue"][0] == 14 + # assert result + + print self.series.value_count + print len(self.series.data_values) + # keep new: + result = self.edit_service.save_appending(overwrite = True) + assert result From 7d4575a5adf45c436fa1946666454e325f7ce640 Mon Sep 17 00:00:00 2001 From: stephanie Date: Tue, 17 May 2016 17:46:17 -0600 Subject: [PATCH 04/36] add test for save_appending --- .travis.yml | 6 ++--- tests/test_odmservices/test_edit_service.py | 28 +++++++++++++-------- 2 files changed, 21 insertions(+), 13 deletions(-) diff --git a/.travis.yml b/.travis.yml index 38a4570..d7ee912 100644 --- a/.travis.yml +++ b/.travis.yml @@ -43,9 +43,9 @@ addons: # mariadb: '10.1' before_script: - - ./scripts/tests/mysql_setup.sh - - ./scripts/tests/postgres_setup.sh - - ./scripts/tests/freetds.sh + - ./tests/scripts/mysql_setup.sh + - ./tests/scripts/postgres_setup.sh + - ./tests/scripts/freetds.sh before_install: # python -m pip makes the install go into the virtualenv diff --git a/tests/test_odmservices/test_edit_service.py b/tests/test_odmservices/test_edit_service.py index 56ba043..2ba40e1 100644 --- a/tests/test_odmservices/test_edit_service.py +++ b/tests/test_odmservices/test_edit_service.py @@ -82,25 +82,33 @@ def test_save_as_existing_series(self): var = test_util.add_variable(self.session) assert self.edit_service.save_existing(var = var) - def test_save_append(self): + def test_save_append_keep(self): #TODO add custon test len1= len(self.series.data_values) # keep data from original series if overlap: + + + svalue = self.series.data_values[0] + + self.edit_service.memDB.updateValue([svalue.local_date_time],'+', 5 ) + news= self.edit_service.memDB.series_service.get_series_by_id(self.series.id) result = self.edit_service.save_appending(overwrite = False) len2= len(self.series.data_values) assert len1 == len2 + assert news.data_values[0].data_value == svalue.data_value + assert result + def test_save_append_overwrite(self): + len1= len(self.series.data_values) + svalue = self.series.data_values[0] - # self.edit_service.memDB.updateValue([self.sdate],'+', 5 ) - # dvs = self.memory_db.getDataValuesDF() - # assert dvs["DataValue"][0] == 14 - # assert result - - print self.series.value_count - print len(self.series.data_values) - # keep new: - result = self.edit_service.save_appending(overwrite = True) + self.edit_service.memDB.updateValue([svalue.local_date_time],'+', 5 ) + news= self.edit_service.memDB.series_service.get_series_by_id(self.series.id) + result = self.edit_service.save_appending(overwrite = False) + len2= len(self.series.data_values) + assert len1 == len2 + assert news.data_values[0].data_value == svalue.data_value + 5 assert result From 6451515b2c670d1f6a7e1e83d88f233cc408788d Mon Sep 17 00:00:00 2001 From: stephanie Date: Tue, 17 May 2016 17:47:06 -0600 Subject: [PATCH 05/36] fix test typo --- tests/test_odmservices/test_edit_service.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_odmservices/test_edit_service.py b/tests/test_odmservices/test_edit_service.py index 2ba40e1..4e00d40 100644 --- a/tests/test_odmservices/test_edit_service.py +++ b/tests/test_odmservices/test_edit_service.py @@ -105,7 +105,7 @@ def test_save_append_overwrite(self): self.edit_service.memDB.updateValue([svalue.local_date_time],'+', 5 ) news= self.edit_service.memDB.series_service.get_series_by_id(self.series.id) - result = self.edit_service.save_appending(overwrite = False) + result = self.edit_service.save_appending(overwrite = True) len2= len(self.series.data_values) assert len1 == len2 assert news.data_values[0].data_value == svalue.data_value + 5 From 8d56b3f0e227d1123a4f5d915b95c83618337c5d Mon Sep 17 00:00:00 2001 From: stephanie Date: Thu, 19 May 2016 16:18:40 -0600 Subject: [PATCH 06/36] run travis --- .travis.yml | 5 +++++ tests/test_odmservices/test_edit_service.py | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index d7ee912..14f2282 100644 --- a/.travis.yml +++ b/.travis.yml @@ -43,14 +43,19 @@ addons: # mariadb: '10.1' before_script: + - chmod +x ./tests/scripts/mysql_setup.sh + - chmod +x ./tests/scripts/postgres_setup.sh + - chmod +x ./tests/scripts/freetds.sh - ./tests/scripts/mysql_setup.sh - ./tests/scripts/postgres_setup.sh - ./tests/scripts/freetds.sh + before_install: # python -m pip makes the install go into the virtualenv - python -m pip install pandas - export PYMSSQL_BUILD_WITH_BUNDLED_FREETDS=1;python -m pip install pymssql + # - python -m pip install mysql-python install: # now just our code - pip install geoalchemy2 diff --git a/tests/test_odmservices/test_edit_service.py b/tests/test_odmservices/test_edit_service.py index 4e00d40..879113d 100644 --- a/tests/test_odmservices/test_edit_service.py +++ b/tests/test_odmservices/test_edit_service.py @@ -103,7 +103,7 @@ def test_save_append_overwrite(self): len1= len(self.series.data_values) svalue = self.series.data_values[0] - self.edit_service.memDB.updateValue([svalue.local_date_time],'+', 5 ) + self.edit_service.memDB.updateValue([svalue.local_date_time],'+', 5) news= self.edit_service.memDB.series_service.get_series_by_id(self.series.id) result = self.edit_service.save_appending(overwrite = True) len2= len(self.series.data_values) From 788a61f1152741c3a43fbe68fa6e0f6b0d38f25d Mon Sep 17 00:00:00 2001 From: stephanie Date: Fri, 20 May 2016 11:04:03 -0600 Subject: [PATCH 07/36] update testing scripts --- tests/scripts/postgres_setup.sh | 4 ++-- tests/scripts/sampledb/odm_postgres.sql | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/tests/scripts/postgres_setup.sh b/tests/scripts/postgres_setup.sh index 63b052a..6e9df60 100644 --- a/tests/scripts/postgres_setup.sh +++ b/tests/scripts/postgres_setup.sh @@ -2,9 +2,9 @@ psql -U postgres -c "create extension postgis" psql -c 'DROP DATABASE IF EXISTS odmtest;' -U postgres; psql -c 'create database odmtest;' -U postgres; -#psql -U postgres -d odmtest -a -f ./tests/scripts/sampledb/odm_postgresql.sql +#psql -U postgres -d odmtest -a -f .tests/scripts/sampledb/odm_postgres.sql psql -c 'DROP DATABASE IF EXISTS odm;' -U postgres; psql -c 'create database odm;' -U postgres; ## install # add -a to psql to see full log, -q is quiet -psql -U postgres -q -f ./tests/scripts/sampledb/odm_postgresql.sql \ No newline at end of file +psql -U postgres -q -f .tests/scripts/sampledb/odm_postgres.sql \ No newline at end of file diff --git a/tests/scripts/sampledb/odm_postgres.sql b/tests/scripts/sampledb/odm_postgres.sql index 94c12bc..bae8239 100644 --- a/tests/scripts/sampledb/odm_postgres.sql +++ b/tests/scripts/sampledb/odm_postgres.sql @@ -1,3 +1,6 @@ +CREATE DATABASE IF NOT EXISTS `odm` /*!40100 DEFAULT CHARACTER SET latin1 */; +USE `odm`; + CREATE TABLE categories ( VariableID int NOT NULL, DataValue float8 NOT NULL, From a863bbf5e93567a6639fd518ba95501261e84b08 Mon Sep 17 00:00:00 2001 From: stephanie Date: Fri, 20 May 2016 11:23:31 -0600 Subject: [PATCH 08/36] fix typo in script --- tests/scripts/mysql_setup.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/scripts/mysql_setup.sh b/tests/scripts/mysql_setup.sh index f27eb53..a164c6e 100644 --- a/tests/scripts/mysql_setup.sh +++ b/tests/scripts/mysql_setup.sh @@ -21,7 +21,7 @@ mysql -e "create database IF NOT EXISTS odm2test;" --user=root ##### # install ##### -ls -al ./tests/scripts/sampledb/odm_mysql.sql ./tests/scripts/sampledb/odm_postgresql.sql +ls -al ./tests/scripts/sampledb/odm_mysql.sql ./tests/scripts/sampledb/odm_postgres.sql mysql --user=ODM --password=odm odm < ./tests/scripts/sampledb/odm_mysql.sql mysql --user=root -e "show databases;" mysql --user=root -e "GRANT ALL PRIVILEGES ON odm.* TO 'ODM'@'localhost';FLUSH PRIVILEGES;" From 2b4f8d4b884ea24800ce32cce62190d0ed5d0c30 Mon Sep 17 00:00:00 2001 From: stephanie Date: Fri, 20 May 2016 11:32:59 -0600 Subject: [PATCH 09/36] update mysql scripts --- tests/scripts/mysql_setup.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/scripts/mysql_setup.sh b/tests/scripts/mysql_setup.sh index a164c6e..d6c5a43 100644 --- a/tests/scripts/mysql_setup.sh +++ b/tests/scripts/mysql_setup.sh @@ -28,5 +28,5 @@ mysql --user=root -e "GRANT ALL PRIVILEGES ON odm.* TO 'ODM'@'localhost';FLUSH # these should produce results, if they don't the lower_case_table_names failed # should make them grep or sed for some keywords mysql --user=ODM --password=odm odm -e "use odm; Select * from Variables;" -mysql --user=ODM --password=odm odm -e "Select * from Variables;" -mysql --user=ODM --password=odm -e "Select * from Variables;" \ No newline at end of file +mysql --user=ODM --password=odm odm -e "use odm; Select * from Variables;" +mysql --user=ODM --password=odm -e "use odm; Select * from Variables;" \ No newline at end of file From ac5382d6f124add6be16eebd3fe3a1d9a0c0033e Mon Sep 17 00:00:00 2001 From: stephanie Date: Fri, 20 May 2016 11:46:10 -0600 Subject: [PATCH 10/36] fix postgres script --- tests/scripts/postgres_setup.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/scripts/postgres_setup.sh b/tests/scripts/postgres_setup.sh index 6e9df60..7874f5d 100644 --- a/tests/scripts/postgres_setup.sh +++ b/tests/scripts/postgres_setup.sh @@ -2,9 +2,9 @@ psql -U postgres -c "create extension postgis" psql -c 'DROP DATABASE IF EXISTS odmtest;' -U postgres; psql -c 'create database odmtest;' -U postgres; -#psql -U postgres -d odmtest -a -f .tests/scripts/sampledb/odm_postgres.sql +#psql -U postgres -d odmtest -a -f ./tests/scripts/sampledb/odm_postgres.sql psql -c 'DROP DATABASE IF EXISTS odm;' -U postgres; psql -c 'create database odm;' -U postgres; ## install # add -a to psql to see full log, -q is quiet -psql -U postgres -q -f .tests/scripts/sampledb/odm_postgres.sql \ No newline at end of file +psql -U postgres -q -f ./tests/scripts/sampledb/odm_postgres.sql \ No newline at end of file From ff14c63c7cb850145818d5f73a1dbf61cf261495 Mon Sep 17 00:00:00 2001 From: Stephanie Reeder Date: Fri, 20 May 2016 12:24:44 -0600 Subject: [PATCH 11/36] Update .travis.yml --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 14f2282..f75f11c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -44,10 +44,10 @@ addons: # mariadb: '10.1' before_script: - chmod +x ./tests/scripts/mysql_setup.sh - - chmod +x ./tests/scripts/postgres_setup.sh +# - chmod +x ./tests/scripts/postgres_setup.sh - chmod +x ./tests/scripts/freetds.sh - ./tests/scripts/mysql_setup.sh - - ./tests/scripts/postgres_setup.sh +# - ./tests/scripts/postgres_setup.sh - ./tests/scripts/freetds.sh From f1370b928b6f56d8eb7f33077ff6b9b212834e11 Mon Sep 17 00:00:00 2001 From: stephanie Date: Fri, 20 May 2016 12:32:19 -0600 Subject: [PATCH 12/36] change travis script --- .travis.yml | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/.travis.yml b/.travis.yml index f75f11c..613e76f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -41,15 +41,6 @@ addons: - wx2.8-headers - wx2.8-i18n -# mariadb: '10.1' -before_script: - - chmod +x ./tests/scripts/mysql_setup.sh -# - chmod +x ./tests/scripts/postgres_setup.sh - - chmod +x ./tests/scripts/freetds.sh - - ./tests/scripts/mysql_setup.sh -# - ./tests/scripts/postgres_setup.sh - - ./tests/scripts/freetds.sh - before_install: # python -m pip makes the install go into the virtualenv @@ -65,8 +56,17 @@ install: # now just our code # don't forget to open up the azure mssql server to these addreses # https://docs.travis-ci.com/user/ip-addresses/ +# mariadb: '10.1' +before_script: + - chmod +x ./tests/scripts/mysql_setup.sh +# - chmod +x ./tests/scripts/postgres_setup.sh + - chmod +x ./tests/scripts/freetds.sh + - ./tests/scripts/mysql_setup.sh +# - ./tests/scripts/postgres_setup.sh + - ./tests/scripts/freetds.sh + # command to run tests script: - - pythonw -m pytest -# - py.test +# - pythonw -m pytest + - py.test From 81f749b2102d5b4ae179d0968fa4560609ecad4d Mon Sep 17 00:00:00 2001 From: stephanie Date: Mon, 23 May 2016 15:13:24 -0600 Subject: [PATCH 13/36] move icon imports --- odmtools/gui/mnuRibbon.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/odmtools/gui/mnuRibbon.py b/odmtools/gui/mnuRibbon.py index 289a5fc..df63319 100755 --- a/odmtools/gui/mnuRibbon.py +++ b/odmtools/gui/mnuRibbon.py @@ -15,7 +15,7 @@ from odmtools.controller.frmLinearDrift import frmLinearDrift from odmtools.controller.frmAbout import frmAbout import wizSave -from odmtools.common import * +from odmtools.common.icons import * import pandas as pd From 3623f5e7e10e749f39461847f044a30fabfed56e Mon Sep 17 00:00:00 2001 From: sreeder Date: Tue, 24 May 2016 13:12:44 -0600 Subject: [PATCH 14/36] fix issue #272 --- setup/Windows/odmtools_console.iss | 3 ++- setup/Windows/odmtools_no_console.iss | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/setup/Windows/odmtools_console.iss b/setup/Windows/odmtools_console.iss index bfe3440..b3b464e 100644 --- a/setup/Windows/odmtools_console.iss +++ b/setup/Windows/odmtools_console.iss @@ -2,10 +2,11 @@ ; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES! #define MyAppName "ODMTools" +#define MyAppInstallName "ODMTools_1.2.3_Beta_win32_x86_64_console.exe" #define MyAppVersion "1.2.3_Beta" #define MyAppPublisher "ODM2" #define MyAppURL "https://github.com/ODM2/ODMToolsPython" -#define MyAppExeName "ODMTools_1.2.3_Beta_win32_x86_64_console.exe" +#define MyAppExeName "ODMTools.exe" #define MyAppDir "D:\DEV\ODMToolsPython" [Setup] diff --git a/setup/Windows/odmtools_no_console.iss b/setup/Windows/odmtools_no_console.iss index 6376d00..b031365 100644 --- a/setup/Windows/odmtools_no_console.iss +++ b/setup/Windows/odmtools_no_console.iss @@ -1,11 +1,13 @@ ; Script generated by the Inno Setup Script Wizard. ; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES! + #define MyAppName "ODMTools" +#define MyAppInstallName "ODMTools_1.2.3_Beta_win32_x86_64.exe" #define MyAppVersion "1.2.3_Beta" #define MyAppPublisher "ODM2" #define MyAppURL "https://github.com/ODM2/ODMToolsPython" -#define MyAppExeName "ODMTools_1.2.3_Beta_win32_x86_64.exe" +#define MyAppExeName "ODMTools.exe" #define MyAppDir "D:\DEV\ODMToolsPython" [Setup] From 9ca681359dbdd58c8880675f42c05f5b0be28d3b Mon Sep 17 00:00:00 2001 From: sreeder Date: Fri, 27 May 2016 09:55:10 -0600 Subject: [PATCH 15/36] update connection --- odmtools/gui/pageMethod.py | 2 +- odmtools/odmservices/service_manager.py | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/odmtools/gui/pageMethod.py b/odmtools/gui/pageMethod.py index b9c33e2..83acebb 100644 --- a/odmtools/gui/pageMethod.py +++ b/odmtools/gui/pageMethod.py @@ -89,7 +89,7 @@ def OnRbSelectRadiobutton(self, event): event.Skip() def OnRbCreateNewRadiobutton(self, event): - self.lstMethods.Enable(False) + # self.lstMethods.Enable(False) self.txtMethodDescrip.Enable(True) event.Skip() diff --git a/odmtools/odmservices/service_manager.py b/odmtools/odmservices/service_manager.py index 902996f..bb5afd8 100755 --- a/odmtools/odmservices/service_manager.py +++ b/odmtools/odmservices/service_manager.py @@ -186,6 +186,7 @@ def _get_file(self, mode): return config_file def _build_connection_string(self, conn_dict): +<<<<<<< Updated upstream # driver = "" # connformat= self._connection_format # if conn_dict['engine'] == 'mssql' and sys.platform != 'win32': @@ -210,6 +211,9 @@ def _build_connection_string(self, conn_dict): # return conn_string # driver = "" # print "****", conn_dict +======= + self._connection_format = "%s+%s://%s:%s@%s/%s" +>>>>>>> Stashed changes if conn_dict['engine'] == 'mssql' and sys.platform != 'win32': driver = "pyodbc" quoted = urllib.quote_plus('DRIVER={FreeTDS};DSN=%s;UID=%s;PWD=%s;' % (conn_dict['address'], conn_dict['user'], @@ -237,11 +241,19 @@ def _build_connection_string(self, conn_dict): else: driver = "None" conn_string = self.constringBuilder(conn_dict, driver) +<<<<<<< Updated upstream + + + # print "******", conn_string + return conn_string + +======= # print "******", conn_string return conn_string +>>>>>>> Stashed changes def constringBuilder(self, conn_dict, driver): if conn_dict['password'] is None or not conn_dict['password']: conn_string = self._connection_format_nopassword % ( From dd5299ca70ce02d283ecb7703e0b7714d77e7786 Mon Sep 17 00:00:00 2001 From: sreeder Date: Fri, 3 Jun 2016 16:50:57 -0600 Subject: [PATCH 16/36] fix logging so it works from a file --- .gitignore | 1 + ODMTools.py | 4 +- odmtools/common/icons/icons4addpoint.py | 1 - odmtools/common/icons/img2py.py | 2 +- odmtools/common/icons/plotToolbar.py | 86 +++++++++++++++++++++--- odmtools/common/logger.py | 21 +++--- odmtools/common/taskServer.py | 5 +- odmtools/controller/frmAddPoints.py | 3 + odmtools/controller/frmBulkInsert.py | 25 ++++--- odmtools/controller/frmDBConfig.py | 7 +- odmtools/controller/frmDataFilters.py | 7 +- odmtools/controller/frmDataTable.py | 2 +- odmtools/controller/frmSeriesSelector.py | 12 ++-- odmtools/controller/logicEditTools.py | 6 +- odmtools/controller/logicPlotOptions.py | 11 +-- odmtools/controller/odmHighlightSTC.py | 6 +- odmtools/controller/olvDataTable.py | 8 ++- odmtools/controller/olvSeriesSelector.py | 7 +- odmtools/gui/frmFlagValues.py | 2 +- odmtools/gui/frmODMTools.py | 23 ++++--- odmtools/gui/mnuPlotToolbar.py | 46 +++++++++++-- odmtools/gui/mnuRibbon.py | 10 +-- odmtools/gui/pageMethod.py | 18 +++-- odmtools/gui/pageQCL.py | 7 +- odmtools/gui/pageVariable.py | 8 +-- odmtools/gui/plotHistogram.py | 8 ++- odmtools/gui/plotSummary.py | 10 +-- odmtools/gui/plotTimeSeries.py | 22 ++++-- odmtools/gui/pnlDataTable.py | 9 +-- odmtools/gui/pnlPlot.py | 9 +-- odmtools/gui/pnlScript.py | 12 +++- odmtools/gui/wizSave.py | 11 +-- odmtools/odmdata/memory_database.py | 6 +- odmtools/odmservices/edit_service.py | 6 +- odmtools/odmservices/series_service.py | 59 +++++++++------- odmtools/odmservices/service_manager.py | 40 ++++++++--- setup/Mac/ODMTools.packproj | 6 +- setup/Windows/odmtools_console.iss | 6 +- setup/Windows/odmtools_no_console.iss | 6 +- setup/Windows/odmtools_setup.iss | 2 +- 40 files changed, 366 insertions(+), 174 deletions(-) diff --git a/.gitignore b/.gitignore index 046381a..5c80773 100755 --- a/.gitignore +++ b/.gitignore @@ -63,6 +63,7 @@ setup/Output/setup.exe #folders Temp + *.app *.spec diff --git a/ODMTools.py b/ODMTools.py index 4b2ec5a..ecbea16 100755 --- a/ODMTools.py +++ b/ODMTools.py @@ -23,7 +23,7 @@ import psycopg2 tool = LoggerTool() -logger = tool.setupLogger(__name__, __name__ + '.log', 'w', logging.DEBUG) +logger = tool.setupLogger('main', 'odmtools.log', 'a', logging.INFO) wx.Log.SetLogLevel(0) @@ -67,7 +67,7 @@ def runODM(): app.MainLoop() if __name__ == '__main__': - logger.debug("Welcome to ODMTools Python. Please wait as system loads") + logger.info("Welcome to ODMTools Python. Please wait as system loads") # https://docs.python.org/2/library/multiprocessing.html#miscellaneous # Add support for when a program which uses multiprocessing has been frozen to produce a Windows executable. diff --git a/odmtools/common/icons/icons4addpoint.py b/odmtools/common/icons/icons4addpoint.py index d31dbce..202cebd 100644 --- a/odmtools/common/icons/icons4addpoint.py +++ b/odmtools/common/icons/icons4addpoint.py @@ -240,4 +240,3 @@ "fyFkZ8W5EwnwX4WlCUrEwmMFZkmMQPAcCJtVkoD4EMZKSAS83/OIZpUkIGkyMR0zSkDa4aQd" "M1ogpsNJJKIFttbvuQ/ulVA1tikCBXDWEsImM5JQa894HkhCT0SFKtQK4I8S8HPlTrhEwEhE" "JgM+pRN1vhJAqemmBC4LChiWfQsq9brIX7OZ6v/BfANr87/zITFiXQAAAABJRU5ErkJggg==") - diff --git a/odmtools/common/icons/img2py.py b/odmtools/common/icons/img2py.py index 00a4225..71984e0 100644 --- a/odmtools/common/icons/img2py.py +++ b/odmtools/common/icons/img2py.py @@ -9,7 +9,7 @@ from wx.tools import img2py -output = 'icons4addpoint.py' +output = 'test_icons.py' # get the list of BMP files #files = [f for f in os.listdir('.') if re.search(r'odm\d*x\d*\.png', f)] diff --git a/odmtools/common/icons/plotToolbar.py b/odmtools/common/icons/plotToolbar.py index a830906..921c07b 100644 --- a/odmtools/common/icons/plotToolbar.py +++ b/odmtools/common/icons/plotToolbar.py @@ -124,6 +124,7 @@ "CsZqSyMGTTeLOYWm1zaUxPzXpURydi7x7fvSwtupGScWi13keX6xIsHszPP3bkmgmZX1RPJz" "KpFaSCefPpvcxjH6D2k3O6c42VTiAAAAAElFTkSuQmCC") + #---------------------------------------------------------------------- zoom_to_rect = PyEmbeddedImage( "iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGOfPtRkwAAACBj" @@ -176,17 +177,80 @@ "t7xuXbu94vbgcOjwnZHokdE77DtTd1PuvriXeW/h/sYH6AdFD6UeVjxSfNTws+7PbaOWo6fH" "XMf6Hwc/vj/OGn/2S8Y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Mf6Hwc/vj/OGn/2S8Yv7ycKnpCfVEyqTDZPmU2dmnafvvF05dOJZ+nPFmYKf5X+tfa5zvMf" +# "fnP8rX82YnbiBf/Fp99LXsq/PPRq2aueuYC5R69TXy/MF72Rf3P4LeNt37vwd5MLWe+x7ys/" +# "6H7o/ujz8cGn1E+f/gUDmPP8usTo0wAAAAlwSFlzAAALEgAACxIB0t1+/AAAABp0RVh0U29m" +# "dHdhcmUAUGFpbnQuTkVUIHYzLjUuMTAw9HKhAAAB3ElEQVQ4T5WTbU/aUBTH+VjEfQPdZxDZ" +# "+/p68GZB4hIVNAV1T7plU5z4EETdEqYmGoeOvRgzQZ2FTJfJ1irIQ4XWIvx3z00g1qqZJ/kn" +# "t/9z7u+etvfYcCUMw8Dq+gZejr3mWmNr8u4KWzP5eWsbnn4fPiW+InWc5Yptf+HeJsvdFhyw" +# "Gd/C2PswJFnBr3wefwpFpJUT/kx6FZrmNTeFTdM09PoGcXiaQ8/TfkyEwiaRRznvgB9Uez1s" +# "sZVVxJPf8bdYgl98jtSPnyaRd3xWQPxbErGVNSsgEByBzDYXKhUEn43j6LdsEnlKqcwOKCIw" +# "PGoFiIFh5NRzlFh7L8bfIndWMom8/HkFp2UVIjvM8gpLHz5iZ28fZU3Hm3dT0C8Mk8ijXDK1" +# "i2VWawHIsgzfkAjNqN36ESnX5xsC1VoAtVoNkYUoItFFXNbrN2o+EoXD+QhiIIhGo2Fi8Hug" +# "qipm5+bhZ51IUhp1VlRnsIMDCf5BET3eXrS1PYDL5WJymyCtm1itVtlmCZOhKTzxeLloTZ6i" +# "KHB0OWG32+F2u/H4CqQFoE6oPV3XQTASrckjZbNZdDq6LBAT4K6huQ4RBAHT4Rn8N6DZIXUi" +# "CN1o73iIBBu8ewGaEPqdmUyGz8Y/d/qJcLWhfigAAAAASUVORK5CYII=") #---------------------------------------------------------------------- scroll_left = PyEmbeddedImage( diff --git a/odmtools/common/logger.py b/odmtools/common/logger.py index 33f910c..f3552ad 100644 --- a/odmtools/common/logger.py +++ b/odmtools/common/logger.py @@ -22,24 +22,25 @@ def setupLogger(self, loggerName, logFile, m='w', level=logging.INFO): # formatter = logging.Formatter('%(asctime)s : %(message)s') formatter = logging.Formatter(self.formatString) - #logPath = os.path.abspath(os.path.dirname("../../")) - #logPath = util.resource_path("ODMTools") - logPath = user_log_dir("ODMTools", "UCHIC") - #logPath = os.path.join(user_log_dir("ODMTools", "UCHIC"), "log") - #print logPath + streamHandler = logging.StreamHandler() + streamHandler.setFormatter(formatter) + + l.setLevel(level) + #l.setLevel(20) #Set logger to 20 to hide debug statements + l.addHandler(streamHandler) + + + logPath = user_log_dir("ODMTools", "UCHIC") if not os.path.exists(logPath): os.makedirs(logPath, 0755) fileHandler = logging.FileHandler(os.path.join(logPath, logFile), mode=m) fileHandler.setFormatter(formatter) - streamHandler = logging.StreamHandler() - streamHandler.setFormatter(formatter) - l.setLevel(level) - #l.setLevel(20) #Set logger to 20 to hide debug statements + # l.setLevel(logging.ERROR) l.addHandler(fileHandler) - l.addHandler(streamHandler) + # solves issues where logging would duplicate its logging message to the root logger # https://stackoverflow.com/questions/21127360/python-2-7-log-displayed-twice-when-logging-module-is-used-in-two-python-scri diff --git a/odmtools/common/taskServer.py b/odmtools/common/taskServer.py index 66dce38..0620112 100644 --- a/odmtools/common/taskServer.py +++ b/odmtools/common/taskServer.py @@ -9,8 +9,9 @@ from odmtools.common.logger import LoggerTool -tool = LoggerTool() -logger = tool.setupLogger(__name__, __name__ + '.log', 'w', logging.DEBUG) +# tool = LoggerTool() +# logger = tool.setupLogger(__name__, __name__ + '.log', 'w', logging.DEBUG) +logger =logging.getLogger('main') class TaskServerMP: """ diff --git a/odmtools/controller/frmAddPoints.py b/odmtools/controller/frmAddPoints.py index 548d7e3..bf7a5db 100755 --- a/odmtools/controller/frmAddPoints.py +++ b/odmtools/controller/frmAddPoints.py @@ -7,6 +7,8 @@ from agw import genericmessagedialog as GMD except ImportError: import wx.lib.agw.genericmessagedialog as GMD +import logging +logger =logging.getLogger('main') # Implementing AddPoints class AddPoints(clsAddPoints.AddPoints): @@ -79,6 +81,7 @@ def onDeleteBtn(self, event): value = msg.ShowModal() if value == wx.ID_YES: self.customRemove(self.selectedObject) + #self.sb.SetStatusText("Removing %s" % self.sb.SetStatusText("Removing %s" % self.selectedObject.dataValue)) self.selectedObject = None diff --git a/odmtools/controller/frmBulkInsert.py b/odmtools/controller/frmBulkInsert.py index 581a94f..b480145 100755 --- a/odmtools/controller/frmBulkInsert.py +++ b/odmtools/controller/frmBulkInsert.py @@ -8,7 +8,8 @@ from pandas.parser import CParserError import csv import StringIO - +import logging +logger =logging.getLogger('main') __author__ = 'Jacob' @@ -63,12 +64,14 @@ def readDataFromCSV(self, filepath): 8: str.strip, 9: str.strip}) except CParserError as e: - - msg = wx.MessageDialog(None, "There was an issue trying to parse your file. " - "Please compare your csv with the template version as the file" - " you provided " - "doesn't work: %s" % e, 'Issue with csv', wx.OK | wx.ICON_WARNING | + message = "There was an issue trying to parse your file. "\ + "Please compare your csv with the template version as the file"\ + " you provided "\ + "doesn't work: %s" % e + msg = wx.MessageDialog(None,message , 'Issue with csv', wx.OK | wx.ICON_WARNING | wx.OK_DEFAULT) + + logger.info(message) value = msg.ShowModal() return False @@ -97,11 +100,13 @@ def loadIntoDataFrame(self, data): except TypeError as e: dlg.Destroy() - msg = wx.MessageDialog(None, "There was an issue trying to parse your file. " - "Please check to see if there could be more columns or" - " values than" - " the program expects", + message = "There was an issue trying to parse your file. "\ + "Please check to see if there could be more columns or"\ + " values than"\ + " the program expects" + msg = wx.MessageDialog(None, message, 'Issue with csv', wx.OK | wx.ICON_WARNING | wx.OK_DEFAULT) + logger.info(message) value = msg.ShowModal() return False diff --git a/odmtools/controller/frmDBConfig.py b/odmtools/controller/frmDBConfig.py index 46ee811..6ef3005 100755 --- a/odmtools/controller/frmDBConfig.py +++ b/odmtools/controller/frmDBConfig.py @@ -14,8 +14,9 @@ sys.path.append(directory) ''' -tool = LoggerTool() -logger = tool.setupLogger(__name__, __name__ + '.log', 'w', logging.DEBUG) +# tool = LoggerTool() +# logger = tool.setupLogger(__name__, __name__ + '.log', 'w', logging.DEBUG) +logger =logging.getLogger('main') class frmDBConfig(wx.Dialog): def __init__(self, parent, service_manager, is_main=False): @@ -54,7 +55,7 @@ def OnValueChanged(self, event): curr_dict = self.getFieldValues() if self.conn_dict == curr_dict: self.btnSave.Enable(True) - except: + except Exception as e: pass diff --git a/odmtools/controller/frmDataFilters.py b/odmtools/controller/frmDataFilters.py index 115637a..0cc754b 100644 --- a/odmtools/controller/frmDataFilters.py +++ b/odmtools/controller/frmDataFilters.py @@ -11,10 +11,9 @@ from odmtools.common.logger import LoggerTool from odmtools.view import clsDataFilters -tool = LoggerTool() -logger = tool.setupLogger(__name__, __name__ + '.log', 'w', logging.DEBUG) -# # - +# tool = LoggerTool() +# logger = tool.setupLogger(__name__, __name__ + '.log', 'w', logging.DEBUG) +logger = logging.getLogger('main') diff --git a/odmtools/controller/frmDataTable.py b/odmtools/controller/frmDataTable.py index 6efe50c..ce6f008 100644 --- a/odmtools/controller/frmDataTable.py +++ b/odmtools/controller/frmDataTable.py @@ -49,7 +49,7 @@ def onChangeSelection(self, datetime_list=None): self.olvDataTable.SetItemState(i, wx.LIST_STATE_SELECTED, wx.LIST_STATE_SELECTED) self.olvDataTable.Focus(results[0][0]) self.enableSelectDataTable = False - except: + except Exception as e : pass def clear(self): self.memDB = None diff --git a/odmtools/controller/frmSeriesSelector.py b/odmtools/controller/frmSeriesSelector.py index 02f3642..76647ad 100755 --- a/odmtools/controller/frmSeriesSelector.py +++ b/odmtools/controller/frmSeriesSelector.py @@ -10,8 +10,9 @@ from odmtools.odmdata import MemoryDatabase from odmtools.view import clsSeriesSelector -tool = LoggerTool() -logger = tool.setupLogger(__name__, __name__ + '.log', 'w', logging.DEBUG) +# tool = LoggerTool() +# logger = tool.setupLogger(__name__, __name__ + '.log', 'w', logging.DEBUG) +logger =logging.getLogger('main') __author__ = 'Jacob' @@ -105,7 +106,7 @@ def refreshSeries(self): self.series_service = self.parent.Parent.createService() #self.refreshTableSeries(self.dbservice) self.resetDB(self.series_service) - logger.debug("Repopulate Series Selector") + logger.info("Repopulate Series Selector") def initSVBoxes(self): """ @@ -366,7 +367,8 @@ def siteAndVariables(self): self.setFilter(site_code=self.site_code, var_code=self.variable_code) self.cbVariables.Enabled = True self.cbSites.Enabled = True - except IndexError: + except IndexError as i: + logger.error(i) pass def siteOnly(self): @@ -466,7 +468,7 @@ def onReadyToPlot(self, event): logger.debug("Obtain object") try: object = event.object - except: + except Exception as e : object = self.tblSeries.GetSelectedObject() if not self.tblSeries.IsChecked(object): diff --git a/odmtools/controller/logicEditTools.py b/odmtools/controller/logicEditTools.py index 93121d5..dd0f813 100644 --- a/odmtools/controller/logicEditTools.py +++ b/odmtools/controller/logicEditTools.py @@ -5,9 +5,9 @@ from odmtools.common.logger import LoggerTool -tool = LoggerTool() -logger = tool.setupLogger(__name__, __name__ + '.log', 'w', logging.DEBUG) - +# tool = LoggerTool() +# logger = tool.setupLogger(__name__, __name__ + '.log', 'w', logging.DEBUG) +logger =logging.getLogger('main') class EditTools(): # Script header (imports etc.) will be set up in Main when record is clicked. diff --git a/odmtools/controller/logicPlotOptions.py b/odmtools/controller/logicPlotOptions.py index 9da1f6f..25f69b6 100644 --- a/odmtools/controller/logicPlotOptions.py +++ b/odmtools/controller/logicPlotOptions.py @@ -12,9 +12,9 @@ import timeit -tool = LoggerTool() -logger = tool.setupLogger(__name__, __name__ + '.log', 'w', logging.DEBUG) - +# tool = LoggerTool() +# logger = tool.setupLogger(__name__, __name__ + '.log', 'w', logging.DEBUG) +logger =logging.getLogger('main') def calcSeason(x): x = int(x) @@ -176,7 +176,7 @@ def count(self): return len(self._seriesInfos) def update(self, key, isselected): - logger.debug("Begin generating plots") + logger.info("Begin generating plots") if not isselected: try: self.colorList.append(self._seriesInfos[key].color) @@ -219,7 +219,8 @@ def getSeriesById(self, seriesID): series = self.memDB.series_service.get_series_by_id(seriesID) self.memDB.series_service.reset_session() return series - except: + except Exception as e : + logger.error("Series Not Found %s"%e) return None def getSelectedSeries(self, seriesID): diff --git a/odmtools/controller/odmHighlightSTC.py b/odmtools/controller/odmHighlightSTC.py index 25a8016..d29491f 100644 --- a/odmtools/controller/odmHighlightSTC.py +++ b/odmtools/controller/odmHighlightSTC.py @@ -38,9 +38,9 @@ 'size2': 10, } -tool = LoggerTool() -logger = tool.setupLogger(__name__, __name__ + '.log', 'w', logging.DEBUG) - +# tool = LoggerTool() +# logger = tool.setupLogger(__name__, __name__ + '.log', 'w', logging.DEBUG) +logger =logging.getLogger('main') class highlightSTC(stc.StyledTextCtrl): """ diff --git a/odmtools/controller/olvDataTable.py b/odmtools/controller/olvDataTable.py index 5f4fbae..58110d1 100644 --- a/odmtools/controller/olvDataTable.py +++ b/odmtools/controller/olvDataTable.py @@ -1,11 +1,13 @@ import wx import logging -from odmtools.common.logger import LoggerTool +# from odmtools.common.logger import LoggerTool from odmtools.lib.ObjectListView import VirtualObjectListView, ObjectListView, ColumnDefn import pandas as pd -tool = LoggerTool() -logger = tool.setupLogger(__name__, __name__ + '.log', 'w', logging.DEBUG) +# tool = LoggerTool() +# logger = tool.setupLogger(__name__, __name__ + '.log', 'w', logging.DEBUG) +logger =logging.getLogger('main') + __author__ = 'jmeline' diff --git a/odmtools/controller/olvSeriesSelector.py b/odmtools/controller/olvSeriesSelector.py index d8f0ab7..f49fdb0 100644 --- a/odmtools/controller/olvSeriesSelector.py +++ b/odmtools/controller/olvSeriesSelector.py @@ -5,12 +5,13 @@ # from ObjectListView.ObjectListView import FastObjectListView, ColumnDefn from odmtools.lib.ObjectListView import FastObjectListView, ColumnDefn -from odmtools.common.logger import LoggerTool +# from odmtools.common.logger import LoggerTool from odmtools.odmdata import series -tool = LoggerTool() -logger = tool.setupLogger(__name__, __name__ + '.log', 'w', logging.DEBUG) +# tool = LoggerTool() +# logger = tool.setupLogger(__name__, __name__ + '.log', 'w', logging.DEBUG) +logger =logging.getLogger('main') OvlCheckEvent, EVT_OVL_CHECK_EVENT = wx.lib.newevent.NewEvent() diff --git a/odmtools/gui/frmFlagValues.py b/odmtools/gui/frmFlagValues.py index 022f02e..32e4286 100755 --- a/odmtools/gui/frmFlagValues.py +++ b/odmtools/gui/frmFlagValues.py @@ -101,7 +101,7 @@ def __init__(self, parent, series_service, choices, isNew=False): #len choices added in cases where ther are no flags in the database #desired functionality is to automatically select creation of new flag - if isNew or len(choices ==0): + if isNew or len(choices) ==0: self.selectedValue = NEW wx.CallAfter(self.showNewFields) else: diff --git a/odmtools/gui/frmODMTools.py b/odmtools/gui/frmODMTools.py index b96a7c8..0b00add 100755 --- a/odmtools/gui/frmODMTools.py +++ b/odmtools/gui/frmODMTools.py @@ -26,10 +26,13 @@ from odmtools.common.icons import gtk_execute from odmtools.lib.Appdirs.appdirs import user_config_dir from odmtools.odmservices import ServiceManager -from odmtools.common.logger import LoggerTool +# from odmtools.common.logger import LoggerTool +# +# tool = LoggerTool() +# # logger = tool.setupLogger(__name__, __name__ + '.log', 'w', logging.DEBUG) +# logger = tool.setupLogger('main', 'odmtools.log', 'w', logging.INFO) -tool = LoggerTool() -logger = tool.setupLogger(__name__, __name__ + '.log', 'w', logging.DEBUG) +logger =logging.getLogger('main') class frmODMToolsMain(wx.Frame): """ @@ -60,9 +63,9 @@ def __init__(self, **kwargs): self._init_sizers() self._ribbon.Realize() self.Refresh() - logger.debug("System starting ...") + logger.info("System starting ...") else: - logger.debug("System shutting down... ") + logger.info("System shutting down... ") sys.exit(0) @@ -116,7 +119,7 @@ def _init_s_Items(self, parent): parent.AddWindow(self.pnlDocking, 85, flag=wx.ALL | wx.EXPAND) def _init_database(self, quit_if_cancel=True): - logger.debug("Loading Database...") + logger.info("Loading Database...") @@ -256,7 +259,7 @@ def _init_ctrls(self, series_service): ####################grid Table View################## logger.debug("Loading DataTable ...") self.dataTable = FrmDataTable(self.pnlDocking) - # self.dataTable = pnlDataTable.pnlDataTable(self.pnlDocking) + # self.dataTable.toggleBindings() ############# Script & Console ############### logger.debug("Loading Python Console ...") @@ -277,11 +280,11 @@ def _init_ctrls(self, series_service): Publisher.subscribe(self.onExecuteScript, ("execute.script")) Publisher.subscribe(self.onChangeDBConn, ("change.dbConfig")) Publisher.subscribe(self.onSetScriptTitle, ("script.title")) - #.subscribe(self.onSetScriptTitle, ("script.title")) Publisher.subscribe(self.onClose, ("onClose")) Publisher.subscribe(self.addEdit, ("selectEdit")) Publisher.subscribe(self.stopEdit, ("stopEdit")) + def _init_aui_manager(self): ############ Docking ################### @@ -381,8 +384,9 @@ def onSetScriptTitle(self, title): def addEdit(self, event): with wx.BusyInfo("Please wait for a moment while ODMTools fetches the data and stores it in our database", parent=self): - logger.debug("Beginning editing") + isSelected, seriesID = self.pnlSelector.onReadyToEdit() + logger.info("Beginning editing seriesID: %s"%str(seriesID)) # logger.debug("Initializing DataTable") # # tasks = [("dataTable", (memDB.conn, self.dataTable.myOlv))] @@ -526,6 +530,7 @@ def onClose(self, event): elif isinstance(item, wx.Dialog): item.Destroy() item.Close() + logger.info("Closing ODMTools\n") self.Destroy() wx.GetApp().ExitMainLoop() diff --git a/odmtools/gui/mnuPlotToolbar.py b/odmtools/gui/mnuPlotToolbar.py index 1be448e..0469e06 100644 --- a/odmtools/gui/mnuPlotToolbar.py +++ b/odmtools/gui/mnuPlotToolbar.py @@ -6,14 +6,16 @@ from matplotlib import path from matplotlib import dates -from odmtools.common.logger import LoggerTool +# from odmtools.common.logger import LoggerTool from odmtools.common.icons.plotToolbar import back, filesave, select, scroll_right, \ scroll_left, zoom_data, zoom_to_rect, subplots, forward, home, move -tools = LoggerTool() -logger = tools.setupLogger(__name__, __name__ + '.log', 'w', logging.DEBUG) +# tools = LoggerTool() +# logger = tools.setupLogger(__name__, __name__ + '.log', 'w', logging.DEBUG) +logger =logging.getLogger('main') + def bind(actor,event,action,id=None): if id is not None: @@ -132,7 +134,7 @@ def __init__(self, plotCanvas, multPlots=False, allowselect=False): self.msg = wx.StaticText(self, -1, "") self.AddControl(self.msg) - + self.canvas.mpl_connect('scroll_event', self.on_scroll_zoom) self.Realize() def editSeries(self, xys, edit): @@ -248,6 +250,8 @@ def on_toggle_zoom_data_tool(self, event): self.canvas.draw() + + #must add these methods for mac functionality def release_zoom(self, event): super(self.__class__, self).release_zoom(event) @@ -264,3 +268,37 @@ def forward(self, event): def home(self, event): super(self.__class__, self).home(event) self.canvas.draw() + + + + + def on_scroll_zoom(self, event): + axes = self.canvas.figure.axes[0] + base_scale = 1.2 + # get the current x and y limits + cur_xlim = axes.get_xlim() + cur_ylim = axes.get_ylim() + cur_xrange = (cur_xlim[1] - cur_xlim[0])*.5 + cur_yrange = (cur_ylim[1] - cur_ylim[0])*.5 + xdata = event.xdata # get event x location + ydata = event.ydata # get event y location + if event.button == 'up': + # deal with zoom in + scale_factor = 1/base_scale + elif event.button == 'down': + # deal with zoom out + scale_factor = base_scale + else: + # deal with something that should never happen + scale_factor = 1 + print event.button + # set new limits + axes.set_xlim([xdata - cur_xrange*scale_factor, + xdata + cur_xrange*scale_factor]) + axes.set_ylim([ydata - cur_yrange*scale_factor, + ydata + cur_yrange*scale_factor]) + self.canvas.draw() # force re-draw + + # fig = ax.get_figure() # get the figure of interest + # attach the call back + diff --git a/odmtools/gui/mnuRibbon.py b/odmtools/gui/mnuRibbon.py index df63319..77101dd 100755 --- a/odmtools/gui/mnuRibbon.py +++ b/odmtools/gui/mnuRibbon.py @@ -21,11 +21,11 @@ # # Enable logging import logging -from odmtools.common.logger import LoggerTool - -tool = LoggerTool() -logger = tool.setupLogger(__name__, __name__ + '.log', 'w', logging.DEBUG) -## +# from odmtools.common.logger import LoggerTool +# +# tool = LoggerTool() +# logger = tool.setupLogger(__name__, __name__ + '.log', 'w', logging.DEBUG) +logger =logging.getLogger('main') [wxID_PANEL1, wxID_RIBBONPLOTTIMESERIES, wxID_RIBBONPLOTPROB, wxID_RIBBONPLOTHIST, wxID_RIBBONPLOTBOX, wxID_RIBBONPLOTSUMMARY, wxID_RIBBONPLOTTSTYPE, wxID_RIBBONPLOTTSCOLOR, wxID_RIBBONPLOTTSLEGEND, wxID_RIBBONPLOTBOXTYPE, diff --git a/odmtools/gui/pageMethod.py b/odmtools/gui/pageMethod.py index f422d4a..7b26ebc 100644 --- a/odmtools/gui/pageMethod.py +++ b/odmtools/gui/pageMethod.py @@ -10,10 +10,12 @@ wxID_PNLMETHODSRICHTEXTCTRL1, ] = [wx.NewId() for _init_ctrls in range(6)] -from odmtools.common.logger import LoggerTool +# from odmtools.common.logger import LoggerTool import logging -tool = LoggerTool() -logger = tool.setupLogger(__name__, __name__ + '.log', 'w', logging.DEBUG) +# tool = LoggerTool() +# logger = tool.setupLogger(__name__, __name__ + '.log', 'w', logging.DEBUG) +logger =logging.getLogger('main') + class pnlMethod(wx.Panel): def _init_ctrls(self, prnt): @@ -54,6 +56,7 @@ def _init_ctrls(self, prnt): self.lstMethods = wx.ListCtrl(id=wxID_PNLMETHODSLISTCTRL1, name='lstMethods', parent=self, pos=wx.Point(16, 48), size=wx.Size(392, 152), style=wx.LC_REPORT|wx.LC_SINGLE_SEL) + self.lstMethods.Bind(wx.EVT_SET_FOCUS, self.OnLstMethodSetFocus) self.lstMethods.InsertColumn(0, 'Description') @@ -62,7 +65,7 @@ def _init_ctrls(self, prnt): self.lstMethods.SetColumnWidth(0, 200) self.lstMethods.SetColumnWidth(1, 153) self.lstMethods.SetColumnWidth(2,0) - self.lstMethods.Enable(False) + # self.lstMethods.Enable(False) @@ -72,8 +75,11 @@ def __init__(self, parent, id, pos, size, style, name, sm, method): self.prev_val = method self._init_ctrls(parent) + def OnLstMethodSetFocus(self, event): + self.rbSelect.SetValue(True) + def OnRbGenerateRadiobutton(self, event): - self.lstMethods.Enable(False) + # self.lstMethods.Enable(False) self.txtMethodDescrip.Enable(False) event.Skip() @@ -85,7 +91,7 @@ def OnRbSelectRadiobutton(self, event): event.Skip() def OnRbCreateNewRadiobutton(self, event): - self.lstMethods.Enable(False) + # self.lstMethods.Enable(False) self.txtMethodDescrip.Enable(True) event.Skip() diff --git a/odmtools/gui/pageQCL.py b/odmtools/gui/pageQCL.py index af0e411..7103aea 100644 --- a/odmtools/gui/pageQCL.py +++ b/odmtools/gui/pageQCL.py @@ -9,10 +9,11 @@ wxID_PNLQCLTXTEXPLANATION, ] = [wx.NewId() for _init_ctrls in range(10)] -from odmtools.common.logger import LoggerTool +# from odmtools.common.logger import LoggerTool import logging -tool = LoggerTool() -logger = tool.setupLogger(__name__, __name__ + '.log', 'w', logging.DEBUG) +# tool = LoggerTool() +# logger = tool.setupLogger(__name__, __name__ + '.log', 'w', logging.DEBUG) +logger =logging.getLogger('main') class pnlQCL(wx.Panel): def _init_ctrls(self, prnt): diff --git a/odmtools/gui/pageVariable.py b/odmtools/gui/pageVariable.py index 95a7260..d14c90b 100644 --- a/odmtools/gui/pageVariable.py +++ b/odmtools/gui/pageVariable.py @@ -8,11 +8,11 @@ wxID_PNLVARIABLERBCURRENT, wxID_PNLVARIABLERBSELECT,wxID_PNLVARIABLETXTNEWVAR, ] = [wx.NewId() for _init_ctrls in range(6)] -from odmtools.common.logger import LoggerTool +# from odmtools.common.logger import LoggerTool import logging -tool = LoggerTool() -logger = tool.setupLogger(__name__, __name__ + '.log', 'w', logging.DEBUG) - +# tool = LoggerTool() +# logger = tool.setupLogger(__name__, __name__ + '.log', 'w', logging.DEBUG) +logger =logging.getLogger('main') class pnlVariable(wx.Panel): def _init_ctrls(self, prnt): diff --git a/odmtools/gui/plotHistogram.py b/odmtools/gui/plotHistogram.py index 219781b..beac68e 100644 --- a/odmtools/gui/plotHistogram.py +++ b/odmtools/gui/plotHistogram.py @@ -6,10 +6,12 @@ from mnuPlotToolbar import MyCustomToolbar as NavigationToolbar import logging -from odmtools.common.logger import LoggerTool +# from odmtools.common.logger import LoggerTool +# +# tool = LoggerTool() +# logger = tool.setupLogger(__name__, __name__ + '.log', 'w', logging.DEBUG) +logger =logging.getLogger('main') -tool = LoggerTool() -logger = tool.setupLogger(__name__, __name__ + '.log', 'w', logging.DEBUG) class plotHist(wx.Panel): def _init_coll_boxSizer1_Items(self, parent): diff --git a/odmtools/gui/plotSummary.py b/odmtools/gui/plotSummary.py index 0117fa5..095f342 100644 --- a/odmtools/gui/plotSummary.py +++ b/odmtools/gui/plotSummary.py @@ -10,11 +10,11 @@ ] = [wx.NewId() for _init_ctrls in range(2)] import logging -from odmtools.common.logger import LoggerTool - -tool = LoggerTool() -logger = tool.setupLogger(__name__, __name__ + '.log', 'w', logging.DEBUG) - +# from odmtools.common.logger import LoggerTool +# +# tool = LoggerTool() +# logger = tool.setupLogger(__name__, __name__ + '.log', 'w', logging.DEBUG) +logger =logging.getLogger('main') class plotSummary(wx.Panel): def __init__(self, parent, id, pos, size, style, name): diff --git a/odmtools/gui/plotTimeSeries.py b/odmtools/gui/plotTimeSeries.py index b996ab4..f146f7d 100755 --- a/odmtools/gui/plotTimeSeries.py +++ b/odmtools/gui/plotTimeSeries.py @@ -24,11 +24,11 @@ ## Enable logging import logging -from odmtools.common.logger import LoggerTool - -tool = LoggerTool() -logger = tool.setupLogger(__name__, __name__ + '.log', 'w', logging.DEBUG) - +# from odmtools.common.logger import LoggerTool +# +# tool = LoggerTool() +# logger = tool.setupLogger(__name__, __name__ + '.log', 'w', logging.DEBUG) +logger =logging.getLogger('main') class plotTimeSeries(wx.Panel): def __init__(self, parent, id, pos, size, style, name): @@ -278,6 +278,9 @@ def drawEditPlot(self, oneSeries): curraxis.set_xlabel('Date') convertedDates = matplotlib.dates.date2num(dates) + + # scale = 1.5 + # f = zoom_factory(curraxis , base_scale = scale) self.xys = zip(convertedDates, oneSeries.dataTable['DataValue']) self.toolbar.editSeries(self.xys, self.editCurve) self.pointPick = self.canvas.mpl_connect('pick_event', self._onPick) @@ -531,7 +534,9 @@ def updateCursor(self, selectedObject=None, deselectedObject=None): self.deactivateCursor(deselectedObject) except AttributeError as e: - print "Ignoring Attribute Error", e + message= "Ignoring Attribute Error", e + print message + logger.error (message) def deactivateCursor(self, deselectedObject=None): # Remove an object if supplied @@ -611,7 +616,7 @@ def _onMotion(self, event): self.toolbar.msg.SetForegroundColour((66, 66, 66)) else: self.toolbar.msg.SetLabelText("") - except ValueError: + except ValueError : pass def _onPick(self, event): @@ -696,3 +701,6 @@ def __call__(self, event): self.toolbar.msg.SetLabelText("X= %s, Y= %.4f (%s)" % (xValue, y, self.name)) self.toolbar.msg.SetForegroundColour((66, 66, 66)) #logger.debug('{n}: ({x}, {y:0.2f})'.format(n=self.name, x=xValue.strftime("%Y-%m-%d %H:%M:%S"), y=y)) + + + diff --git a/odmtools/gui/pnlDataTable.py b/odmtools/gui/pnlDataTable.py index 6b0551e..81bbc2a 100644 --- a/odmtools/gui/pnlDataTable.py +++ b/odmtools/gui/pnlDataTable.py @@ -10,10 +10,11 @@ import timeit -from odmtools.common.logger import LoggerTool - -tool = LoggerTool() -logger = tool.setupLogger(__name__, __name__ + '.log', 'w', logging.DEBUG) +# from odmtools.common.logger import LoggerTool +# +# tool = LoggerTool() +# logger = tool.setupLogger(__name__, __name__ + '.log', 'w', logging.DEBUG) +logger =logging.getLogger('main') [wxID_PNLDATATABLE, wxID_PNLDATATABLEDATAGRID, ] = [wx.NewId() for _init_ctrls in range(2)] diff --git a/odmtools/gui/pnlPlot.py b/odmtools/gui/pnlPlot.py index 230c8b6..69abe06 100644 --- a/odmtools/gui/pnlPlot.py +++ b/odmtools/gui/pnlPlot.py @@ -19,10 +19,11 @@ from odmtools.controller.logicPlotOptions import SeriesPlotInfo import logging -from odmtools.common.logger import LoggerTool - -tool = LoggerTool() -logger = tool.setupLogger(__name__, __name__ + '.log', 'w', logging.DEBUG) +# from odmtools.common.logger import LoggerTool +# +# tool = LoggerTool() +# logger = tool.setupLogger(__name__, __name__ + '.log', 'w', logging.DEBUG) +logger =logging.getLogger('main') [wxID_PANEL1, wxID_PAGEBOX, wxID_PAGEHIST, wxID_PAGEPROB, wxID_PAGESUMMARY, wxID_PAGETIMESERIES, wxID_TABPLOTS diff --git a/odmtools/gui/pnlScript.py b/odmtools/gui/pnlScript.py index 4c05274..4982bac 100644 --- a/odmtools/gui/pnlScript.py +++ b/odmtools/gui/pnlScript.py @@ -165,7 +165,7 @@ def runCommand(self, text): # get ahold of record service and turn it off do i need a publisher command? self.parent.record_service.toggle_record(False) - for line in text.split("\n"): + for line in text.splitlines():#("\n"): self.console.shell.run(line) #self.console.shell.run("\n") self.parent.record_service.toggle_record(True) @@ -174,8 +174,18 @@ def runCommand(self, text): def OnExecute(self, e): self.runCommand(self.control.GetText()) + # l1 = len(self.control.GetText().split('\n')) + # l2 = len(self.control.GetText().split('\r')) + # + # print("length by '\\n': %s \n length by '\\r': %s"%(l1,l2)) + # for l in self.control.GetText().split('\n'): + # self.runCommand(l) + + def OnExecuteSelection(self, e): self.runCommand(self.control.GetSelectedTextRaw()) + # for l in self.control.GetSelectedTextRaw().split('\n'): + # self.runCommand(l) def OnExecuteLine(self, e): text = self.control.GetSelectedTextRaw() diff --git a/odmtools/gui/wizSave.py b/odmtools/gui/wizSave.py index 5986cc1..d36bf16 100644 --- a/odmtools/gui/wizSave.py +++ b/odmtools/gui/wizSave.py @@ -18,8 +18,9 @@ from odmtools.common.logger import LoggerTool import logging -tool = LoggerTool() -logger = tool.setupLogger(__name__, __name__ + '.log', 'w', logging.DEBUG) +# tool = LoggerTool() +# logger = tool.setupLogger(__name__, __name__ + '.log', 'w', logging.DEBUG) +logger =logging.getLogger('main') ######################################################################## @@ -318,7 +319,7 @@ def on_wizard_finished(self, event): 'Are you Sure?', wx.YES_NO | wx.ICON_QUESTION) if val == 2: - logger.debug("User selected yes to save a level 0 dataset") + logger.info("User selected yes to save a level 0 dataset") val_2 = wx.MessageBox("This action cannot be undone.\nAre you sure you are sure?\n", 'Are you REALLY sure?', wx.YES_NO | wx.ICON_QUESTION) @@ -393,7 +394,9 @@ def on_wizard_finished(self, event): #self.page1.pnlIntroduction.rb except Exception as e: - wx.MessageBox("Save was unsuccessful %s" % e.message, "Error!", wx.ICON_ERROR | wx.ICON_EXCLAMATION) + message = "Save was unsuccessful %s" % e.message + logger.error(message) + wx.MessageBox(message, "Error!", wx.ICON_ERROR | wx.ICON_EXCLAMATION) event.Skip() self.Close() diff --git a/odmtools/odmdata/memory_database.py b/odmtools/odmdata/memory_database.py index 39f3544..37a6b7e 100644 --- a/odmtools/odmdata/memory_database.py +++ b/odmtools/odmdata/memory_database.py @@ -7,9 +7,9 @@ from odmtools.common.taskServer import TaskServerMP from multiprocessing import cpu_count, freeze_support -tool = LoggerTool() -logger = tool.setupLogger(__name__, __name__ + '.log', 'w', logging.DEBUG) - +# tool = LoggerTool() +# logger = tool.setupLogger(__name__, __name__ + '.log', 'w', logging.DEBUG) +logger =logging.getLogger('main') class MemoryDatabase(object): ### this code should be changed to work with the database abstract layer so that sql queries are not in the code diff --git a/odmtools/odmservices/edit_service.py b/odmtools/odmservices/edit_service.py index f6a87ee3..5dc5127 100644 --- a/odmtools/odmservices/edit_service.py +++ b/odmtools/odmservices/edit_service.py @@ -13,9 +13,9 @@ import logging from odmtools.common.logger import LoggerTool -tool = LoggerTool() -logger = tool.setupLogger(__name__, __name__ + '.log', 'w', logging.DEBUG) - +# tool = LoggerTool() +# logger = tool.setupLogger(__name__, __name__ + '.log', 'w', logging.DEBUG) +logger =logging.getLogger('main') class EditService(): # Mutual exclusion: cursor, or connection_string diff --git a/odmtools/odmservices/series_service.py b/odmtools/odmservices/series_service.py index c843fa7..1798545 100644 --- a/odmtools/odmservices/series_service.py +++ b/odmtools/odmservices/series_service.py @@ -19,9 +19,9 @@ from odmtools.common.logger import LoggerTool import pandas as pd -tool = LoggerTool() -logger = tool.setupLogger(__name__, __name__ + '.log', 'w', logging.DEBUG) - +# tool = LoggerTool() +# logger = tool.setupLogger(__name__, __name__ + '.log', 'w', logging.DEBUG) +logger =logging.getLogger('main') class SeriesService(): # Accepts a string for creating a SessionFactory, default uses odmdata/connection.cfg @@ -483,7 +483,7 @@ def save_series(self, series, dvs): except Exception as e: self._edit_session.rollback() raise e - logger.debug("Existing File was overwritten with new information") + logger.info("Existing File was overwritten with new information") return True else: logger.debug("There wasn't an existing file to overwrite, please select 'Save As' first") @@ -500,7 +500,7 @@ def save_new_series(self, series, dvs): # Save As case if self.series_exists(series): msg = "There is already an existing file with this information. Please select 'Save' or 'Save Existing' to overwrite" - logger.debug(msg) + logger.info(msg) raise Exception(msg) else: try: @@ -512,7 +512,7 @@ def save_new_series(self, series, dvs): self._edit_session.rollback() raise e - logger.debug("A new series was added to the database, series id: "+str(series.id)) + logger.info("A new series was added to the database, series id: "+str(series.id)) return True def save_values(self, values): @@ -661,11 +661,17 @@ def delete_series(self, series): :param series: :return: """ - self.delete_values_by_series(series) + try: + self.delete_values_by_series(series) - delete_series = self._edit_session.merge(series) - self._edit_session.delete(delete_series) - self._edit_session.commit() + delete_series = self._edit_session.merge(series) + self._edit_session.delete(delete_series) + self._edit_session.commit() + except Exception as e: + message = "series was not successfully deleted: %s" % e + print message + logger.error(message) + raise e def delete_values_by_series(self, series, startdate = None): @@ -675,31 +681,36 @@ def delete_values_by_series(self, series, startdate = None): :return: """ try: - if startdate is not None: - #start date indicates what day you should start deleting values. the values will delete to the end of the series - return self._edit_session.query(DataValue).filter_by(site_id = series.site_id, + q= self._edit_session.query(DataValue).filter_by(site_id = series.site_id, variable_id = series.variable_id, method_id = series.method_id, source_id = series.source_id, - quality_control_level_id = series.quality_control_level_id)\ - .filter(DataValue.local_date_time >= startdate).delete() + quality_control_level_id = series.quality_control_level_id) + if startdate is not None: + #start date indicates what day you should start deleting values. the values will delete to the end of the series + return q.filter(DataValue.local_date_time >= startdate).delete() else: - return self._edit_session.query(DataValue).filter_by(site_id = series.site_id, - variable_id = series.variable_id, - method_id = series.method_id, - source_id = series.source_id, - quality_control_level_id = series.quality_control_level_id).delete() + return q.delete() - except: - return None + except Exception as ex: + message = "Values were not successfully deleted: %s" % ex + print message + logger.error(message) + raise ex def delete_dvs(self, id_list): """ - :param id_list: list of ids + :param id_list: list of datetimes :return: """ - self._edit_session.query(DataValue).filter(DataValue.local_date_time.in_(id_list)).delete(False) + try: + self._edit_session.query(DataValue).filter(DataValue.local_date_time.in_(id_list)).delete(False) + except Exception as ex: + message = "Values were not successfully deleted: %s" % ex + print message + logger.error(message) + raise ex ##################### # diff --git a/odmtools/odmservices/service_manager.py b/odmtools/odmservices/service_manager.py index 2ba80b8..28757ac 100755 --- a/odmtools/odmservices/service_manager.py +++ b/odmtools/odmservices/service_manager.py @@ -16,9 +16,9 @@ from odmtools.odmdata.session_factory import SessionFactory -tool = LoggerTool() -logger = tool.setupLogger(__name__, __name__ + '.log', 'w', logging.DEBUG) - +# tool = LoggerTool() +# logger = tool.setupLogger(__name__, __name__ + '.log', 'w', logging.DEBUG) +logger =logging.getLogger('main') class ServiceManager(): def __init__(self, debug=False): @@ -186,25 +186,47 @@ def _get_file(self, mode): return config_file def _build_connection_string(self, conn_dict): - driver = "" - connformat= self._connection_format + + self._connection_format = "%s+%s://%s:%s@%s/%s" + if conn_dict['engine'] == 'mssql' and sys.platform != 'win32': driver = "pyodbc" - quoted = urllib.quote_plus('DRIVER={FreeTDS};DSN=%s;UID=%s;PWD=%s;' % (conn_dict['address'], conn_dict['user'], conn_dict['password'])) + quoted = urllib.quote_plus('DRIVER={FreeTDS};DSN=%s;UID=%s;PWD=%s;' % (conn_dict['address'], conn_dict['user'], + conn_dict['password'])) + # quoted = urllib.quote_plus('DRIVER={FreeTDS};DSN=%s;UID=%s;PWD=%s;DATABASE=%s' % + # (conn_dict['address'], conn_dict['user'], conn_dict['password'],conn_dict['db'], + # )) conn_string = 'mssql+pyodbc:///?odbc_connect={}'.format(quoted) - else: if conn_dict['engine'] == 'mssql': driver = "pyodbc" - connformat=self._connection_format = "%s+%s://%s:%s@%s/%s?driver=SQL+Server+Native+Client+10.0" + conn = "%s+%s://%s:%s@%s/%s?driver=SQL+Server" + if "sqlncli11.dll" in os.listdir("C:\\Windows\\System32"): + conn = "%s+%s://%s:%s@%s/%s?driver=SQL+Server+Native+Client+11.0" + self._connection_format = conn + conn_string = self._connection_format % ( + conn_dict['engine'], driver, conn_dict['user'], conn_dict['password'], conn_dict['address'], + conn_dict['db']) elif conn_dict['engine'] == 'mysql': driver = "pymysql" + conn_string = self.constringBuilder(conn_dict, driver) elif conn_dict['engine'] == 'postgresql': driver = "psycopg2" + conn_string = self.constringBuilder(conn_dict, driver) else: driver = "None" + conn_string = self.constringBuilder(conn_dict, driver) - conn_string = connformat % ( + # print "******", conn_string + return conn_string + + def constringBuilder(self, conn_dict, driver): + if conn_dict['password'] is None or not conn_dict['password']: + conn_string = self._connection_format_nopassword % ( + conn_dict['engine'], driver, conn_dict['user'], conn_dict['address'], + conn_dict['db']) + else: + conn_string = self._connection_format % ( conn_dict['engine'], driver, conn_dict['user'], conn_dict['password'], conn_dict['address'], conn_dict['db']) return conn_string diff --git a/setup/Mac/ODMTools.packproj b/setup/Mac/ODMTools.packproj index cdf1d3d..2d25764 100644 --- a/setup/Mac/ODMTools.packproj +++ b/setup/Mac/ODMTools.packproj @@ -566,9 +566,9 @@ IFPkgDescriptionDescription IFPkgDescriptionTitle - ODMTools_v1.2.3 + ODMTools_v1.2.4 IFPkgDescriptionVersion - 1.2.3 Beta + 1.2.4 Beta Display Information @@ -619,7 +619,7 @@ IFPkgFlagPackageSelection 0 Name - ODMTools_v1.2.3-beta_Mac_installer + ODMTools_v1.2.4-beta_Mac_installer Status 1 Type diff --git a/setup/Windows/odmtools_console.iss b/setup/Windows/odmtools_console.iss index b3b464e..b477759 100644 --- a/setup/Windows/odmtools_console.iss +++ b/setup/Windows/odmtools_console.iss @@ -2,8 +2,10 @@ ; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES! #define MyAppName "ODMTools" -#define MyAppInstallName "ODMTools_1.2.3_Beta_win32_x86_64_console.exe" -#define MyAppVersion "1.2.3_Beta" + +#define MyAppVersion "1.2.5_Beta" +#define MyAppExeLongName "ODMTools_1.2.5_Beta_win32_x86_64_console.exe" + #define MyAppPublisher "ODM2" #define MyAppURL "https://github.com/ODM2/ODMToolsPython" #define MyAppExeName "ODMTools.exe" diff --git a/setup/Windows/odmtools_no_console.iss b/setup/Windows/odmtools_no_console.iss index b031365..a6d9128 100644 --- a/setup/Windows/odmtools_no_console.iss +++ b/setup/Windows/odmtools_no_console.iss @@ -3,8 +3,10 @@ #define MyAppName "ODMTools" -#define MyAppInstallName "ODMTools_1.2.3_Beta_win32_x86_64.exe" -#define MyAppVersion "1.2.3_Beta" + +#define MyAppExeLongName "ODMTools_1.2.5_Beta_win32_x86_64.exe" +#define MyAppVersion "1.2.5_Beta" + #define MyAppPublisher "ODM2" #define MyAppURL "https://github.com/ODM2/ODMToolsPython" #define MyAppExeName "ODMTools.exe" diff --git a/setup/Windows/odmtools_setup.iss b/setup/Windows/odmtools_setup.iss index 7eda934..ae139d9 100644 --- a/setup/Windows/odmtools_setup.iss +++ b/setup/Windows/odmtools_setup.iss @@ -2,7 +2,7 @@ ; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES! #define MyAppName "ODMTools" -#define MyAppVersion "1.2.3_Beta" +#define MyAppVersion "1.2.4_Beta" #define MyAppPublisher "ODM2" #define MyAppURL "https://github.com/ODM2/ODMToolsPython" #define MyAppExeName "ODMTools.exe" From 4997af459a8062c6f8c3eef5924c31b42ed955e1 Mon Sep 17 00:00:00 2001 From: sreeder Date: Fri, 3 Jun 2016 16:58:03 -0600 Subject: [PATCH 17/36] update logging message --- odmtools/common/logger.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/odmtools/common/logger.py b/odmtools/common/logger.py index f3552ad..0952488 100644 --- a/odmtools/common/logger.py +++ b/odmtools/common/logger.py @@ -15,12 +15,13 @@ class LoggerTool(): def __init__(self): self.formatString = '%(asctime)s - %(levelname)s - %(name)s.%(funcName)s() (%(lineno)d): %(message)s' - self.formatString1 = '%(asctime)s (%(levelname)s) %(module)s:%(funcName)s.%(name)s(%(lineno)d) - %(message)s' + self.formatString1 = '%(asctime)s (%(levelname)s) %(module)s:%(funcName)s(%(lineno)d) - %(message)s' + self.formatString2 ='%(asctime)s - %(levelname)s - %(module)s - %(message)s' def setupLogger(self, loggerName, logFile, m='w', level=logging.INFO): l = logging.getLogger(loggerName) # formatter = logging.Formatter('%(asctime)s : %(message)s') - formatter = logging.Formatter(self.formatString) + formatter = logging.Formatter(self.formatString1) streamHandler = logging.StreamHandler() From c864c76fb897ebfbfe8f39c21c398f4fd94a7b16 Mon Sep 17 00:00:00 2001 From: stephanie Date: Tue, 7 Jun 2016 16:52:01 -0600 Subject: [PATCH 18/36] update tests add fix for wizSave Method error --- odmtools/controller/pageExisting.py | 4 +- odmtools/gui/pageMethod.py | 13 ++-- odmtools/gui/pageQCL.py | 4 +- odmtools/gui/pageSummary.py | 4 +- odmtools/gui/wizSave.py | 51 ++++++++------ odmtools/odmservices/edit_service.py | 3 +- odmtools/odmservices/series_service.py | 1 + odmtools/odmservices/service_manager.py | 43 ++++++------ odmtools/view/clsCreateVariable.py | 2 +- tests/test_gui/test_wizSave.py | 63 +++++++++++++++++ .../test_odmservices/test_service_manager.py | 68 +++++++++++++++++++ 11 files changed, 200 insertions(+), 56 deletions(-) create mode 100644 tests/test_gui/test_wizSave.py create mode 100644 tests/test_odmservices/test_service_manager.py diff --git a/odmtools/controller/pageExisting.py b/odmtools/controller/pageExisting.py index efbcb6c..0544cfe 100644 --- a/odmtools/controller/pageExisting.py +++ b/odmtools/controller/pageExisting.py @@ -13,7 +13,7 @@ ######################################################################## class pageExisting(wiz.WizardPageSimple): - def __init__(self, parent, title, service_man, site): + def __init__(self, parent, title, series_service , site): """Constructor""" wiz.WizardPageSimple.__init__(self, parent) @@ -30,7 +30,7 @@ def __init__(self, parent, title, service_man, site): #pos=wx.Point(536, 285), size=wx.Size(439, 357), #style=wx.TAB_TRAVERSAL)#, sm = service_man, series = series) self.sizer.Add(self.pnlExisting, 85, wx.ALL, 5) - self._init_data(service_man.get_series_service(), site.id) + self._init_data(series_service, site.id) self.pnlExisting.olvSeriesList.Bind(wx.EVT_LIST_ITEM_SELECTED, self.OnOLVItemSelected) diff --git a/odmtools/gui/pageMethod.py b/odmtools/gui/pageMethod.py index f422d4a..abff010 100644 --- a/odmtools/gui/pageMethod.py +++ b/odmtools/gui/pageMethod.py @@ -67,8 +67,8 @@ def _init_ctrls(self, prnt): - def __init__(self, parent, id, pos, size, style, name, sm, method): - self.series_service = sm.get_series_service() + def __init__(self, parent, id, pos, size, style, name, ss, method): + self.series_service = ss self.prev_val = method self._init_ctrls(parent) @@ -108,10 +108,10 @@ def getMethod(self): m = Method() if self.rbGenerate.Value: genmethod = "Values derived from ODM Tools Python" - - try: - m= self.series_service.get_method_by_description(genmethod) - except: + m= self.series_service.get_method_by_description(genmethod) + if m is None: + logger.debug("assigning new method description") + m = Method() m.description = genmethod elif self.rbSelect.Value: @@ -124,5 +124,6 @@ def getMethod(self): elif self.rbCreateNew.Value: + logger.debug("assigning new method description") m.description = self.txtMethodDescrip.GetValue() return m \ No newline at end of file diff --git a/odmtools/gui/pageQCL.py b/odmtools/gui/pageQCL.py index af0e411..359c611 100644 --- a/odmtools/gui/pageQCL.py +++ b/odmtools/gui/pageQCL.py @@ -84,8 +84,8 @@ def _init_ctrls(self, prnt): label=u'Explanation:', name=u'lblExplanation', parent=self, pos=wx.Point(16, 248), size=wx.Size(61, 13), style=0) - def __init__(self, parent, id, pos, size, style, name, sm, qcl): - self.series_service = sm.get_series_service() + def __init__(self, parent, id, pos, size, style, name, ss, qcl): + self.series_service = ss self.prev_val = qcl self._init_ctrls(parent) diff --git a/odmtools/gui/pageSummary.py b/odmtools/gui/pageSummary.py index 5822eb1..a9a9be2 100644 --- a/odmtools/gui/pageSummary.py +++ b/odmtools/gui/pageSummary.py @@ -35,8 +35,8 @@ def _init_ctrls(self, prnt): self._init_sizers() - def __init__(self, parent, id, size, style, name, sm, pos= (0,0)): - self.series_service = sm.get_series_service() + def __init__(self, parent, id, size, style, name, ss, pos= (0,0)): + self.series_service = ss self._init_ctrls(parent) diff --git a/odmtools/gui/wizSave.py b/odmtools/gui/wizSave.py index 5986cc1..ffd96ad 100644 --- a/odmtools/gui/wizSave.py +++ b/odmtools/gui/wizSave.py @@ -24,7 +24,7 @@ ######################################################################## class QCLPage(wiz.WizardPageSimple): - def __init__(self, parent, title, service_man, qcl): + def __init__(self, parent, title, series_service, qcl): """Constructor""" wiz.WizardPageSimple.__init__(self, parent) @@ -39,10 +39,10 @@ def __init__(self, parent, title, service_man, qcl): sizer.Add(wx.StaticLine(self, -1), 5, wx.EXPAND | wx.ALL, 5) self.panel = pageQCL.pnlQCL(self, id=wxID_PNLQCL, name=u'pnlQCL', pos=wx.Point(536, 285), size=wx.Size(439, 357), - style=wx.TAB_TRAVERSAL, sm=service_man, qcl=qcl) + style=wx.TAB_TRAVERSAL, ss=series_service, qcl=qcl) self.sizer.Add(self.panel, 85, wx.ALL, 5) - series_service = service_man.get_series_service() - self._init_data(series_service) + + self._init_data(self.panel.series_service) def _init_data(self, series): qcl = series.get_all_qcls() @@ -61,7 +61,7 @@ def _init_data(self, series): ######################################################################## class VariablePage(wiz.WizardPageSimple): - def __init__(self, parent, title, service_man, var): + def __init__(self, parent, title, service_manager, var): """Constructor""" wiz.WizardPageSimple.__init__(self, parent) @@ -76,10 +76,10 @@ def __init__(self, parent, title, service_man, var): sizer.Add(wx.StaticLine(self, -1), 5, wx.EXPAND | wx.ALL, 5) self.panel = pageVariable.pnlVariable(self, id=wxID_PNLVARIABLE, name=u'pnlVariable', pos=wx.Point(536, 285), size=wx.Size(439, 357), - style=wx.TAB_TRAVERSAL, sm=service_man, var=var) + style=wx.TAB_TRAVERSAL, sm=service_manager, var=var) self.sizer.Add(self.panel, 85, wx.ALL, 5) - series_service = service_man.get_series_service() - self._init_data(series_service) + + self._init_data(self.panel.series_service) def _init_data(self, series_service): vars = series_service.get_all_variables() @@ -108,7 +108,7 @@ def _init_data(self, series_service): ######################################################################## class MethodPage(wiz.WizardPageSimple): - def __init__(self, parent, title, service_man, method): + def __init__(self, parent, title, series_service, method): """Constructor""" wiz.WizardPageSimple.__init__(self, parent) @@ -123,10 +123,10 @@ def __init__(self, parent, title, service_man, method): sizer.Add(wx.StaticLine(self, -1), 5, wx.EXPAND | wx.ALL, 5) self.panel = pageMethod.pnlMethod(self, id=wxID_PNLMETHOD, name=u'pnlMethod', pos=wx.Point(536, 285), size=wx.Size(439, 357), - style=wx.TAB_TRAVERSAL, sm=service_man, method=method) + style=wx.TAB_TRAVERSAL, ss=series_service, method=method) self.sizer.Add(self.panel, 85, wx.ALL, 5) - series_service = service_man.get_series_service() - self._init_data(series_service) + + self._init_data(self.panel.series_service) def _init_data(self, series): meth = series.get_all_methods() @@ -146,7 +146,7 @@ def _init_data(self, series): ######################################################################## class SummaryPage(wiz.WizardPageSimple): - def __init__(self, parent, title, service_man): + def __init__(self, parent, title, series_service): """Constructor""" wiz.WizardPageSimple.__init__(self, parent) self.parent = parent @@ -160,7 +160,7 @@ def __init__(self, parent, title, service_man): sizer.Add(wx.StaticLine(self, -1), 5, wx.EXPAND | wx.ALL, 5) self.panel = pageSummary.pnlSummary(self, id=wxID_PNLSUMMARY, name=u'pnlSummary', pos=wx.Point(536, 285), size=wx.Size(439, 357), - style=wx.TAB_TRAVERSAL, sm=service_man) + style=wx.TAB_TRAVERSAL, ss=series_service) self.sizer.Add(self.panel, 85, wx.ALL, 5) @@ -215,34 +215,41 @@ def _init_ctrls(self, prnt): def get_metadata(self): if self.pgIntro.pnlIntroduction.rbSaveAs.GetValue(): + logger.debug("SaveAs") method = self.pgMethod.panel.getMethod() qcl = self.pgQCL.panel.getQCL() variable = self.pgVariable.panel.getVariable() elif self.pgIntro.pnlIntroduction.rbSave.GetValue(): + logger.debug("Save") method = self.currSeries.method qcl = self.currSeries.quality_control_level variable = self.currSeries.variable elif self.pgIntro.pnlIntroduction.rbSaveExisting.GetValue(): + logger.debug("Existing") method, qcl, variable = self.pgExisting.getSeries() site = self.currSeries.site source = self.currSeries.source logger.debug("site: %s, variable: %s, method: %s, source: %s, qcl: %s" % ( - site.id, variable.id, method.id, source.id, qcl.id)) + str(site), str(variable), str(method), str(source), str(qcl))) return site, variable, method, source, qcl - def __init__(self, parent, service_man, record_service): + def __init__(self, parent, service_manager, record_service): self._init_ctrls(parent) - self.series_service = service_man.get_series_service() + try: + self.series_service = record_service._edit_service.memDB.series_service #service_man.get_series_service() + except: + #for testing + self.series_service = record_service.memDB.series_service self.record_service = record_service # self.is_changing_series = False self.currSeries = record_service.get_series() self.pgIntro = pageIntro.pageIntro(self, "Intro") - self.pgMethod = MethodPage(self, "Method", service_man, self.currSeries.method) - self.pgQCL = QCLPage(self, "Quality Control Level", service_man, self.currSeries.quality_control_level) - self.pgVariable = VariablePage(self, "Variable", service_man, self.currSeries.variable) - self.pgExisting = pageExisting.pageExisting(self, "Existing Series", service_man, self.currSeries.site) - self.pgSummary = SummaryPage(self, "Summary", service_man) + self.pgMethod = MethodPage(self, "Method", self.series_service, self.currSeries.method) + self.pgQCL = QCLPage(self, "Quality Control Level", self.series_service, self.currSeries.quality_control_level) + self.pgVariable = VariablePage(self, "Variable", service_manager, self.currSeries.variable) + self.pgExisting = pageExisting.pageExisting(self, "Existing Series", self.series_service, self.currSeries.site) + self.pgSummary = SummaryPage(self, "Summary", self.series_service) self.FitToPage(self.pgIntro) diff --git a/odmtools/odmservices/edit_service.py b/odmtools/odmservices/edit_service.py index f6a87ee3..63bee34 100644 --- a/odmtools/odmservices/edit_service.py +++ b/odmtools/odmservices/edit_service.py @@ -35,11 +35,10 @@ def __init__(self, series_id, connection=None, connection_string="", debug=False if connection_string is "" and connection is not None: self.memDB= connection - #self._series_service = self.memDB.series_service#SeriesService(connection_string, debug) elif connection_string is not "" and connection is None: from odmtools.odmdata import MemoryDatabase - self.memDB= MemoryDatabase()#(series_service) + self.memDB= MemoryDatabase() self.memDB.set_series_service(SeriesService(connection_string, False)) diff --git a/odmtools/odmservices/series_service.py b/odmtools/odmservices/series_service.py index c843fa7..d3db139 100644 --- a/odmtools/odmservices/series_service.py +++ b/odmtools/odmservices/series_service.py @@ -233,6 +233,7 @@ def get_method_by_description(self, method_code): result = self._edit_session.query(Method).filter_by(description=method_code).first() except: result = None + logger.error("method not found") return result def get_offset_types_by_series_id(self, series_id): diff --git a/odmtools/odmservices/service_manager.py b/odmtools/odmservices/service_manager.py index 2ba80b8..19d7449 100755 --- a/odmtools/odmservices/service_manager.py +++ b/odmtools/odmservices/service_manager.py @@ -21,7 +21,7 @@ class ServiceManager(): - def __init__(self, debug=False): + def __init__(self, debug=False, conn_dict = None): self.debug = debug f = self._get_file('r') self._conn_dicts = [] @@ -29,23 +29,26 @@ def __init__(self, debug=False): self._connection_format = "%s+%s://%s:%s@%s/%s" # Read all lines (connections) in the connection.cfg file - while True: - line = f.readline() - if not line: - break - else: - line = line.split() - #logger.debug(line) - - if len(line) >= 5: - line_dict = {} - - line_dict['engine'] = line[0] - line_dict['user'] = line[1] - line_dict['password'] = line[2] - line_dict['address'] = line[3] - line_dict['db'] = line[4] - self._conn_dicts.append(line_dict) + if conn_dict is None: + while True: + line = f.readline() + if not line: + break + else: + line = line.split() + #logger.debug(line) + + if len(line) >= 5: + line_dict = {} + + line_dict['engine'] = line[0] + line_dict['user'] = line[1] + line_dict['password'] = line[2] + line_dict['address'] = line[3] + line_dict['db'] = line[4] + self._conn_dicts.append(line_dict) + else: + self._conn_dicts.append(conn_dict) if len(self._conn_dicts) is not 0: # The current connection defaults to the most recent (i.e. the last written to the file) @@ -192,7 +195,9 @@ def _build_connection_string(self, conn_dict): driver = "pyodbc" quoted = urllib.quote_plus('DRIVER={FreeTDS};DSN=%s;UID=%s;PWD=%s;' % (conn_dict['address'], conn_dict['user'], conn_dict['password'])) conn_string = 'mssql+pyodbc:///?odbc_connect={}'.format(quoted) - + elif conn_dict['engine']=='sqlite': + connformat = "%s:///%s" + conn_string = connformat%(conn_dict['engine'], conn_dict['address']) else: if conn_dict['engine'] == 'mssql': driver = "pyodbc" diff --git a/odmtools/view/clsCreateVariable.py b/odmtools/view/clsCreateVariable.py index 50de13e..17615eb 100644 --- a/odmtools/view/clsCreateVariable.py +++ b/odmtools/view/clsCreateVariable.py @@ -127,7 +127,7 @@ def __init__(self, parent): #fgSizer6.Add(self.txtGenCat, 0, wx.ALL | wx.EXPAND, 5) cbGenCatChoices = [] - self.cbGenCat = wx.ComboBox( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, cbGenCatChoices, wx.CB_READONLY|wx.CB_SORT ) + self.cbGenCat = wx.ComboBox( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, cbGenCatChoices, wx.CB_READONLY)#|wx.CB_SORT )#sort not supported by mac fgSizer6.Add( self.cbGenCat, 0, wx.ALL|wx.EXPAND, 5 ) self.stNoDV = wx.StaticText(self, wx.ID_ANY, u"NoDataValue:", wx.DefaultPosition, wx.DefaultSize, 0) diff --git a/tests/test_gui/test_wizSave.py b/tests/test_gui/test_wizSave.py new file mode 100644 index 0000000..038faee --- /dev/null +++ b/tests/test_gui/test_wizSave.py @@ -0,0 +1,63 @@ +from unittest import TestCase + +__author__ = 'stephanie' + +from odmtools.gui.wizSave import wizSave +from odmtools.odmdata import MemoryDatabase +from odmtools.odmservices import ServiceManager +from odmtools.odmservices import SeriesService + +from tests import test_util +import wx + + + + +class TestWizSave: + def setup(self): + conn_dict = {'engine': 'sqlite', 'address': ':memory:'} + self.sm = ServiceManager(conn_dict=conn_dict) + # set up remote Database + # self.connection_string = "sqlite:///:memory:" + + self.series_service = self.sm.get_series_service() # SeriesService(connection_string=self.connection_string, debug=False) + self.session = self.series_service._session_factory.get_session() + engine = self.series_service._session_factory.engine + test_util.build_db(engine) + + self.dvs_size = 100 + self.series = test_util.add_series_bulk_data(self.session, dvs_size=self.dvs_size) + assert self.series + assert len(self.series.data_values) == self.dvs_size + + self.memory_database = MemoryDatabase() + self.memory_database.set_series_service(self.series_service) + # self.memory_database.initEditValues(self.series.id) + + self.app = wx.App() + self.frame = wx.Frame(None) + self.wizard = wizSave(self.frame,self.sm, self.sm.get_edit_service(self.series.id, self.memory_database)) +#TODO get wizard tests working + # def test___init__(self): + # assert self.frame + # assert self.wizard + # self.wizard.init(self, self.sm, self.memory_database) + # + # + # def test__init_ctrls(self): + # self.fail() + # + # def test_get_metadata(self): + # self.fail() + # + # def test_on_page_changed(self): + # self.fail() + # + # def test_on_page_changing(self): + # self.fail() + # + # def test_on_wizard_finishedtest(self): + # self.fail() + # + # def test_on_wizard_finished(self): + # self.fail() diff --git a/tests/test_odmservices/test_service_manager.py b/tests/test_odmservices/test_service_manager.py new file mode 100644 index 0000000..ed7c0b3 --- /dev/null +++ b/tests/test_odmservices/test_service_manager.py @@ -0,0 +1,68 @@ +__author__ = 'stephanie' + +#TODO implement service_manager tests + + + + +class TestServiceManager(): + def setup(self): + pass + + def test__init(self, debug=False): + pass + + def test_get_all_conn_dicts(self): + pass + + def test_is_valid_connection(self): + pass + + def test_get_current_conn_dict(self): + pass + + def test_set_current_conn_dict(self): + pass + + def test_add_connection(self): + pass + + def test_testEngine(self): + pass + + def test_test_connection(self): + pass + + def test_delete_connection(self): + pass + + def test_get_db_version_dict(self): + pass + + def test_get_db_version(self): + pass + + def test_get_series_service(self): + pass + + def test_get_cv_service(self): + pass + + def test_get_edit_service(self): + pass + + def test_get_record_service(self): + pass + + def test_get_export_service(self): + pass + + def test_get_file(self): + pass + + def test_build_connection_string(self): + pass + + def test_save_connections(self): + pass + From bcb502c7115198ae44227942c04102b51813e4c4 Mon Sep 17 00:00:00 2001 From: sreeder Date: Wed, 8 Jun 2016 11:12:52 -0600 Subject: [PATCH 19/36] funkiness with git --- odmtools/controller/frmSeriesSelector.py | 19 +++++++++-- odmtools/gui/frmODMTools.py | 1 + odmtools/gui/mnuPlotToolbar.py | 42 +++--------------------- 3 files changed, 22 insertions(+), 40 deletions(-) diff --git a/odmtools/controller/frmSeriesSelector.py b/odmtools/controller/frmSeriesSelector.py index 02f3642..cff28ca 100755 --- a/odmtools/controller/frmSeriesSelector.py +++ b/odmtools/controller/frmSeriesSelector.py @@ -84,6 +84,9 @@ def refreshTableSeries(self, db): :return: """ + chcklist= self.tblSeries.GetCheckedObjects() + + self.memDB.set_series_service(db) object = self.series_service.get_all_series() #checkedObjs = self.tblSeries.GetCheckedObjects() @@ -93,6 +96,11 @@ def refreshTableSeries(self, db): if x.id not in idList: self.tblSeries.AddObject(x) + + for c in chcklist: + self.tblSeries.SetCheckState(c, True) + + #for x in checkedObjs: # super(FastObjectListView, self.tblSeries).SetCheckState(x, True) @@ -555,14 +563,21 @@ def onReadyToEdit(self): def stopEdit(self): """When edit button is untoggled, the editing feature closes - :return: """ + self.isEditing = False + if self.tblSeries.editingObject in self.tblSeries.GetCheckedObjects(): + ischecked =True + else: + ischecked = False self.tblSeries.RefreshObject(self.tblSeries.editingObject) - self.tblSeries.editingObject = None + if ischecked and self.tblSeries.editingObject not in self.tblSeries.GetCheckedObjects(): + self.tblSeries.ToggleCheck(self.tblSeries.editingObject) + self.memDB.stopEdit() + def isEditing(self): """ diff --git a/odmtools/gui/frmODMTools.py b/odmtools/gui/frmODMTools.py index b96a7c8..798350c 100755 --- a/odmtools/gui/frmODMTools.py +++ b/odmtools/gui/frmODMTools.py @@ -442,6 +442,7 @@ def stopEdit(self, event): self.dataTable.stopEdit() self.pnlPlot.stopEdit() Publisher.sendMessage("toggleEdit", checked=False) + self.memDB.reset_edit() self.record_service = None self._ribbon.toggleEditButtons(False) diff --git a/odmtools/gui/mnuPlotToolbar.py b/odmtools/gui/mnuPlotToolbar.py index 527d425..985d603 100644 --- a/odmtools/gui/mnuPlotToolbar.py +++ b/odmtools/gui/mnuPlotToolbar.py @@ -132,7 +132,7 @@ def __init__(self, plotCanvas, multPlots=False, allowselect=False): self.msg = wx.StaticText(self, -1, "") self.AddControl(self.msg) - self.canvas.mpl_connect('scroll_event', self.on_scroll_zoom) + self.Realize() def editSeries(self, xys, edit): @@ -149,6 +149,8 @@ def stopEdit(self): self.xys = None self.editCurve = None self.lassoAction = None + # untoggle select button + self.ToggleTool(self.select_tool.Id, False) # disable select button self.select_tool.Enable(False) self.zoom_to_data.Enable(False) @@ -157,7 +159,7 @@ def stopEdit(self): #self.ToggleTool(self.select_tool.Id, False) - # pan the graph to the left + # pan the graph to the left def _on_custom_pan_left(self, evt): ONE_SCREEN = 7 # we default to 1 week axes = self.canvas.figure.axes[0] @@ -248,8 +250,6 @@ def on_toggle_zoom_data_tool(self, event): self.canvas.draw() - - #must add these methods for mac functionality def release_zoom(self, event): super(self.__class__, self).release_zoom(event) @@ -266,37 +266,3 @@ def forward(self, event): def home(self, event): super(self.__class__, self).home(event) self.canvas.draw() - - - - - def on_scroll_zoom(self, event): - axes = self.canvas.figure.axes[0] - base_scale = 1.2 - # get the current x and y limits - cur_xlim = axes.get_xlim() - cur_ylim = axes.get_ylim() - cur_xrange = (cur_xlim[1] - cur_xlim[0])*.5 - cur_yrange = (cur_ylim[1] - cur_ylim[0])*.5 - xdata = event.xdata # get event x location - ydata = event.ydata # get event y location - if event.button == 'up': - # deal with zoom in - scale_factor = 1/base_scale - elif event.button == 'down': - # deal with zoom out - scale_factor = base_scale - else: - # deal with something that should never happen - scale_factor = 1 - print event.button - # set new limits - axes.set_xlim([xdata - cur_xrange*scale_factor, - xdata + cur_xrange*scale_factor]) - axes.set_ylim([ydata - cur_yrange*scale_factor, - ydata + cur_yrange*scale_factor]) - self.canvas.draw() # force re-draw - - # fig = ax.get_figure() # get the figure of interest - # attach the call back - From 611900dd2f95af23fdc94f6d92b03fe73e0b54bf Mon Sep 17 00:00:00 2001 From: sreeder Date: Wed, 8 Jun 2016 11:42:26 -0600 Subject: [PATCH 20/36] fix issue #274, fixed reoccurance of issue #264 --- odmtools/controller/frmSeriesSelector.py | 19 +++++++++++++------ odmtools/odmdata/series.py | 17 +++++++++++++++++ odmtools/odmservices/edit_service.py | 2 +- 3 files changed, 31 insertions(+), 7 deletions(-) diff --git a/odmtools/controller/frmSeriesSelector.py b/odmtools/controller/frmSeriesSelector.py index cff28ca..7852965 100755 --- a/odmtools/controller/frmSeriesSelector.py +++ b/odmtools/controller/frmSeriesSelector.py @@ -109,12 +109,21 @@ def refreshSeries(self): :return: """ + chcklist= self.tblSeries.GetCheckedObjects() self.series_service = None + self.series_service = self.parent.Parent.createService() #self.refreshTableSeries(self.dbservice) self.resetDB(self.series_service) + for c in chcklist: + for val in self.tblSeries.GetObjects(): + if c == val: + self.tblSeries.SetCheckState(val, True) + break + logger.debug("Repopulate Series Selector") + def initSVBoxes(self): """ @@ -567,13 +576,11 @@ def stopEdit(self): """ self.isEditing = False - if self.tblSeries.editingObject in self.tblSeries.GetCheckedObjects(): - ischecked =True - else: - ischecked = False + chcklist= self.tblSeries.GetCheckedObjects() + self.tblSeries.RefreshObject(self.tblSeries.editingObject) - if ischecked and self.tblSeries.editingObject not in self.tblSeries.GetCheckedObjects(): - self.tblSeries.ToggleCheck(self.tblSeries.editingObject) + for c in chcklist: + self.tblSeries.SetCheckState(c, True) self.memDB.stopEdit() diff --git a/odmtools/odmdata/series.py b/odmtools/odmdata/series.py index 3510dbf..cae849c 100644 --- a/odmtools/odmdata/series.py +++ b/odmtools/odmdata/series.py @@ -96,6 +96,23 @@ class Series(Base): def __repr__(self): return "" % (self.id, self.site_name, self.variable_code, self.variable_name) + def __eq__(self, other) : + # return self.__dict__ == other.__dict__ + return [self.id, self.site_id, self.site_code, self.site_name, self.variable_id, self.variable_code, + self.variable_name, self.speciation, self.variable_units_id, self.variable_units_name, + self.sample_medium, self.value_type, self.time_support, self.time_units_id, self.time_units_name, + self.data_type, self.general_category, self.method_id, self.method_description, + self.source_id, self.source_description, self.organization, self.citation, + self.quality_control_level_id, self.quality_control_level_code, self.begin_date_time, + self.end_date_time, self.begin_date_time_utc, self.end_date_time_utc, self.value_count] ==\ + [other.id, other.site_id, other.site_code, other.site_name, other.variable_id, other.variable_code, + other.variable_name, other.speciation, other.variable_units_id, other.variable_units_name, + other.sample_medium, other.value_type, other.time_support, other.time_units_id, other.time_units_name, + other.data_type, other.general_category, other.method_id, other.method_description, + other.source_id, other.source_description, other.organization, other.citation, + other.quality_control_level_id, other.quality_control_level_code, other.begin_date_time, + other.end_date_time, other.begin_date_time_utc, other.end_date_time_utc, other.value_count] + def get_table_columns(self): return self.__table__.columns.keys() diff --git a/odmtools/odmservices/edit_service.py b/odmtools/odmservices/edit_service.py index 63bee34..cb65fce 100644 --- a/odmtools/odmservices/edit_service.py +++ b/odmtools/odmservices/edit_service.py @@ -504,7 +504,7 @@ def updateSeries(self, var=None, method=None, qcl=None, is_new_series=False, ove #if series end date is after dvs startdate dbend = series.end_date_time dfstart = datetime.datetime.strptime(str(np.min(dvs["LocalDateTime"])), form) - overlap = dbend> dfstart + overlap = dbend>= dfstart #leave series start dates to those previously set series.end_date_time = datetime.datetime.strptime(str(np.max(dvs["LocalDateTime"])), form) series.end_date_time_utc = datetime.datetime.strptime(str(np.max(dvs["DateTimeUTC"])), form) From 00aa734463aa8b76de24bd919cb9c7822ef4d3b1 Mon Sep 17 00:00:00 2001 From: stephanie Date: Wed, 8 Jun 2016 12:40:06 -0600 Subject: [PATCH 21/36] fix qualifier issue: --- odmtools/controller/frmAddPoints.py | 4 +- odmtools/controller/logicCellEdit.py | 4 +- odmtools/odmservices/cv_service.py | 2 - odmtools/odmservices/series_service.py | 8 ++ odmtools/odmservices/service_manager.py | 111 +++++------------- tests/test_odmservices/test_series_service.py | 12 +- 6 files changed, 54 insertions(+), 87 deletions(-) diff --git a/odmtools/controller/frmAddPoints.py b/odmtools/controller/frmAddPoints.py index 548d7e3..d14a64a 100755 --- a/odmtools/controller/frmAddPoints.py +++ b/odmtools/controller/frmAddPoints.py @@ -239,7 +239,9 @@ def parseTable(self): if i.offSetType != "NULL": row[6] = i.offSetType if i.qualifierCode != "NULL": - row[8] = i.qualifierCode + code = i.qualifierCode.split(':')[0] + q=self.recordService._edit_service.memDB.series_service.get_qualifier_by_code(code=code) + row[8] = q.id if i.labSampleCode != "NULL": row[9] = i.labSampleCode diff --git a/odmtools/controller/logicCellEdit.py b/odmtools/controller/logicCellEdit.py index e7de1a8..f2b11ed 100755 --- a/odmtools/controller/logicCellEdit.py +++ b/odmtools/controller/logicCellEdit.py @@ -34,7 +34,7 @@ def __init__(self, parent, serviceManager, recordService): self.censorCodeChoices = [NULL] + [x.term for x in self.cv_service.get_censor_code_cvs()] self.labSampleChoices = [NULL] + labChoices.keys() - self.qualifierChoices = OrderedDict((x.code + '-' + x.description, x.id) + self.qualifierChoices = OrderedDict((x.code + ':' + x.description, x.id) for x in self.series_service.get_all_qualifiers() if x.code and x.description) self.qualifierCodeChoices = [NULL] + self.qualifierChoices.keys() + [NEW] @@ -375,7 +375,7 @@ def cbHandler(event): #dlg.Destroy() try: - self.qualifierChoices = OrderedDict((x.code + '-' + x.description, x.id) + self.qualifierChoices = OrderedDict((x.code + ':' + x.description, x.id) for x in self.cv_service.get_all_qualifiers() if x.code and x.description) self.qualifierCodeChoices = [NULL] + self.qualifierChoices.keys() + [NEW] except: diff --git a/odmtools/odmservices/cv_service.py b/odmtools/odmservices/cv_service.py index 0e92b7c..24b5e81 100644 --- a/odmtools/odmservices/cv_service.py +++ b/odmtools/odmservices/cv_service.py @@ -36,8 +36,6 @@ def get_samples(self): result = self._edit_session.query(Sample).order_by(Sample.lab_sample_code).all() return result - - def get_site_type_cvs(self): result = self._edit_session.query(SiteTypeCV).order_by(SiteTypeCV.term).all() return result diff --git a/odmtools/odmservices/series_service.py b/odmtools/odmservices/series_service.py index 891faae..fe42592 100644 --- a/odmtools/odmservices/series_service.py +++ b/odmtools/odmservices/series_service.py @@ -191,6 +191,14 @@ def get_all_qualifiers(self): result = self._edit_session.query(Qualifier).order_by(Qualifier.code).all() return result + def get_qualifier_by_code(self, code): + """ + + :return: Qualifiers + """ + result = self._edit_session.query(Qualifier).filter(Qualifier.code==code).first() + return result + def get_qualifiers_by_series_id(self, series_id): """ diff --git a/odmtools/odmservices/service_manager.py b/odmtools/odmservices/service_manager.py index bb5afd8..0224163 100755 --- a/odmtools/odmservices/service_manager.py +++ b/odmtools/odmservices/service_manager.py @@ -21,7 +21,7 @@ class ServiceManager(): - def __init__(self, debug=False): + def __init__(self, debug=False, conn_dict = None): self.debug = debug f = self._get_file('r') self._conn_dicts = [] @@ -29,23 +29,26 @@ def __init__(self, debug=False): self._connection_format = "%s+%s://%s:%s@%s/%s" # Read all lines (connections) in the connection.cfg file - while True: - line = f.readline() - if not line: - break - else: - line = line.split() - #logger.debug(line) - - if len(line) >= 5: - line_dict = {} - - line_dict['engine'] = line[0] - line_dict['user'] = line[1] - line_dict['password'] = line[2] - line_dict['address'] = line[3] - line_dict['db'] = line[4] - self._conn_dicts.append(line_dict) + if conn_dict is None: + while True: + line = f.readline() + if not line: + break + else: + line = line.split() + #logger.debug(line) + + if len(line) >= 5: + line_dict = {} + + line_dict['engine'] = line[0] + line_dict['user'] = line[1] + line_dict['password'] = line[2] + line_dict['address'] = line[3] + line_dict['db'] = line[4] + self._conn_dicts.append(line_dict) + else: + self._conn_dicts.append(conn_dict) if len(self._conn_dicts) is not 0: # The current connection defaults to the most recent (i.e. the last written to the file) @@ -152,7 +155,7 @@ def get_cv_service(self): return CVService(conn_string, self.debug) def get_edit_service(self, series_id, connection): - + return EditService(series_id, connection=connection, debug=self.debug) def get_record_service(self, script, series_id, connection): @@ -186,81 +189,27 @@ def _get_file(self, mode): return config_file def _build_connection_string(self, conn_dict): -<<<<<<< Updated upstream - # driver = "" - # connformat= self._connection_format - # if conn_dict['engine'] == 'mssql' and sys.platform != 'win32': - # driver = "pyodbc" - # quoted = urllib.quote_plus('DRIVER={FreeTDS};DSN=%s;UID=%s;PWD=%s;' % (conn_dict['address'], conn_dict['user'], conn_dict['password'])) - # conn_string = 'mssql+pyodbc:///?odbc_connect={}'.format(quoted) - # - # else: - # if conn_dict['engine'] == 'mssql': - # driver = "pyodbc" - # connformat=self._connection_format = "%s+%s://%s:%s@%s/%s?driver=SQL+Server+Native+Client+10.0" - # elif conn_dict['engine'] == 'mysql': - # driver = "pymysql" - # elif conn_dict['engine'] == 'postgresql': - # driver = "psycopg2" - # else: - # driver = "None" - # - # conn_string = connformat % ( - # conn_dict['engine'], driver, conn_dict['user'], conn_dict['password'], conn_dict['address'], - # conn_dict['db']) - # return conn_string - # driver = "" - # print "****", conn_dict -======= - self._connection_format = "%s+%s://%s:%s@%s/%s" ->>>>>>> Stashed changes + driver = "" + connformat= self._connection_format if conn_dict['engine'] == 'mssql' and sys.platform != 'win32': driver = "pyodbc" - quoted = urllib.quote_plus('DRIVER={FreeTDS};DSN=%s;UID=%s;PWD=%s;' % (conn_dict['address'], conn_dict['user'], - conn_dict['password'])) - # quoted = urllib.quote_plus('DRIVER={FreeTDS};DSN=%s;UID=%s;PWD=%s;DATABASE=%s' % - # (conn_dict['address'], conn_dict['user'], conn_dict['password'],conn_dict['db'], - # )) + quoted = urllib.quote_plus('DRIVER={FreeTDS};DSN=%s;UID=%s;PWD=%s;' % (conn_dict['address'], conn_dict['user'], conn_dict['password'])) conn_string = 'mssql+pyodbc:///?odbc_connect={}'.format(quoted) + elif conn_dict['engine']=='sqlite': + connformat = "%s:///%s" + conn_string = connformat%(conn_dict['engine'], conn_dict['address']) else: if conn_dict['engine'] == 'mssql': driver = "pyodbc" - conn = "%s+%s://%s:%s@%s/%s?driver=SQL+Server" - if "sqlncli11.dll" in os.listdir("C:\\Windows\\System32"): - conn = "%s+%s://%s:%s@%s/%s?driver=SQL+Server+Native+Client+11.0" - self._connection_format = conn - conn_string = self._connection_format % ( - conn_dict['engine'], driver, conn_dict['user'], conn_dict['password'], conn_dict['address'], - conn_dict['db']) + connformat=self._connection_format = "%s+%s://%s:%s@%s/%s?driver=SQL+Server+Native+Client+10.0" elif conn_dict['engine'] == 'mysql': driver = "pymysql" - conn_string = self.constringBuilder(conn_dict, driver) elif conn_dict['engine'] == 'postgresql': driver = "psycopg2" - conn_string = self.constringBuilder(conn_dict, driver) else: driver = "None" - conn_string = self.constringBuilder(conn_dict, driver) -<<<<<<< Updated upstream - - # print "******", conn_string - return conn_string - -======= - - - # print "******", conn_string - return conn_string - ->>>>>>> Stashed changes - def constringBuilder(self, conn_dict, driver): - if conn_dict['password'] is None or not conn_dict['password']: - conn_string = self._connection_format_nopassword % ( - conn_dict['engine'], driver, conn_dict['user'], conn_dict['address'], - conn_dict['db']) - else: - conn_string = self._connection_format % ( + conn_string = connformat % ( conn_dict['engine'], driver, conn_dict['user'], conn_dict['password'], conn_dict['address'], conn_dict['db']) return conn_string diff --git a/tests/test_odmservices/test_series_service.py b/tests/test_odmservices/test_series_service.py index 9672f6c..64e1e86 100644 --- a/tests/test_odmservices/test_series_service.py +++ b/tests/test_odmservices/test_series_service.py @@ -70,6 +70,15 @@ def test_create_qualifier(self): assert qual.id is not None + def test_get_qualifier_by_code(self): + assert self.series_service.get_all_qualifiers() == [] + + qual= self.series_service.create_qualifier("ABC123","This is a test") + + db_qual = self.series_service.get_qualifier_by_code("ABC123") + + assert qual.id == db_qual.id + def test_get_qualifiers(self): assert self.series_service.get_all_qualifiers() == [] @@ -383,4 +392,5 @@ def test_variable_exists(self): assert self.series_service.variable_exists(variable) variable.code = "00000" variable.name = "A new name" - assert not self.series_service.variable_exists(variable) \ No newline at end of file + assert not self.series_service.variable_exists(variable) + From ccfd530fcf7a4d6a0b5e2d545484d6c1a7210942 Mon Sep 17 00:00:00 2001 From: stephanie Date: Thu, 9 Jun 2016 16:48:22 -0600 Subject: [PATCH 22/36] fix connection --- odmtools/odmdata/memory_database.py | 5 ++++ odmtools/odmservices/service_manager.py | 35 +++++++++++++++++++++---- 2 files changed, 35 insertions(+), 5 deletions(-) diff --git a/odmtools/odmdata/memory_database.py b/odmtools/odmdata/memory_database.py index 39f3544..2469f5d 100644 --- a/odmtools/odmdata/memory_database.py +++ b/odmtools/odmdata/memory_database.py @@ -90,6 +90,11 @@ def rollback(self): # self.mem_service._session_factory.engine.connect().connection.rollback() #self.updateDF() + #TODO is there a way to do a single rollback + def rollbacksingle(self): + pass + + def update(self, updates): ''' updates : list of dictionary that contains 2 items, id and value diff --git a/odmtools/odmservices/service_manager.py b/odmtools/odmservices/service_manager.py index 0224163..53306c4 100755 --- a/odmtools/odmservices/service_manager.py +++ b/odmtools/odmservices/service_manager.py @@ -189,27 +189,52 @@ def _get_file(self, mode): return config_file def _build_connection_string(self, conn_dict): - driver = "" - connformat= self._connection_format + + self._connection_format = "%s+%s://%s:%s@%s/%s" + if conn_dict['engine'] == 'mssql' and sys.platform != 'win32': driver = "pyodbc" - quoted = urllib.quote_plus('DRIVER={FreeTDS};DSN=%s;UID=%s;PWD=%s;' % (conn_dict['address'], conn_dict['user'], conn_dict['password'])) + quoted = urllib.quote_plus('DRIVER={FreeTDS};DSN=%s;UID=%s;PWD=%s;' % (conn_dict['address'], conn_dict['user'], + conn_dict['password'])) + # quoted = urllib.quote_plus('DRIVER={FreeTDS};DSN=%s;UID=%s;PWD=%s;DATABASE=%s' % + # (conn_dict['address'], conn_dict['user'], conn_dict['password'],conn_dict['db'], + # )) conn_string = 'mssql+pyodbc:///?odbc_connect={}'.format(quoted) + elif conn_dict['engine']=='sqlite': connformat = "%s:///%s" conn_string = connformat%(conn_dict['engine'], conn_dict['address']) else: if conn_dict['engine'] == 'mssql': driver = "pyodbc" - connformat=self._connection_format = "%s+%s://%s:%s@%s/%s?driver=SQL+Server+Native+Client+10.0" + conn = "%s+%s://%s:%s@%s/%s?driver=SQL+Server" + if "sqlncli11.dll" in os.listdir("C:\\Windows\\System32"): + conn = "%s+%s://%s:%s@%s/%s?driver=SQL+Server+Native+Client+11.0" + self._connection_format = conn + conn_string = self._connection_format % ( + conn_dict['engine'], driver, conn_dict['user'], conn_dict['password'], conn_dict['address'], + conn_dict['db']) elif conn_dict['engine'] == 'mysql': driver = "pymysql" + conn_string = self.constringBuilder(conn_dict, driver) elif conn_dict['engine'] == 'postgresql': driver = "psycopg2" + conn_string = self.constringBuilder(conn_dict, driver) else: driver = "None" + conn_string = self.constringBuilder(conn_dict, driver) - conn_string = connformat % ( + # print "******", conn_string + return conn_string + + + def constringBuilder(self, conn_dict, driver): + if conn_dict['password'] is None or not conn_dict['password']: + conn_string = self._connection_format_nopassword % ( + conn_dict['engine'], driver, conn_dict['user'], conn_dict['address'], + conn_dict['db']) + else: + conn_string = self._connection_format % ( conn_dict['engine'], driver, conn_dict['user'], conn_dict['password'], conn_dict['address'], conn_dict['db']) return conn_string From a585b7d610c0e2680f9dee3b8c874dbdd0d1b394 Mon Sep 17 00:00:00 2001 From: sreeder Date: Fri, 10 Jun 2016 10:19:12 -0600 Subject: [PATCH 23/36] update version numbers --- README.md | 4 ++-- odmtools/meta/data.py | 2 +- setup/Mac/ODMTools.packproj | 6 +++--- setup/Windows/odmtools_console.iss | 4 ++-- setup/Windows/odmtools_no_console.iss | 4 ++-- setup/Windows/odmtools_setup.iss | 2 +- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index a26f2f4..cbc4ef2 100644 --- a/README.md +++ b/README.md @@ -19,10 +19,10 @@ To make running ODMTools easier we have included installers. Please select the o ####Windows Recommended Release: -+ [Window v1.2.2-beta](https://github.com/ODM2/ODMToolsPython/releases/download/v1.2.2-beta/ODMTools_1.2.2_Beta_Win_Installer.exe) ++ [Window v1.2.5-beta](https://github.com/ODM2/ODMToolsPython/releases/download/v1.2.5-beta/ODMTools_1.2.5_Beta_Win_Installer.exe) ####Mac -+ [Mac v1.2.2-beta](https://github.com/ODM2/ODMToolsPython/releases/download/v1.2.2-beta/ODMTools_v1.2.2-beta_Mac_installer.pkg.zip) ++ [Mac v1.2.5-beta](https://github.com/ODM2/ODMToolsPython/releases/download/v1.2.5-beta/ODMTools_v1.2.5-beta_Mac_installer.pkg.zip) ####Linux + *Please run from source* diff --git a/odmtools/meta/data.py b/odmtools/meta/data.py index 1686672..8ef5943 100644 --- a/odmtools/meta/data.py +++ b/odmtools/meta/data.py @@ -1,5 +1,5 @@ app_name = "ODMTools" -version = "1.2.2_Beta" +version = "1.2.5_Beta" copyright = "Copyright (c) 2013 - 2015, Utah State University. All rights reserved." description = "ODMTools is a python application for managing observational data using the Observations Data Model. " \ "ODMTools allows you to query, visualize, and edit data stored in an Observations Data Model (ODM) database." \ diff --git a/setup/Mac/ODMTools.packproj b/setup/Mac/ODMTools.packproj index 2d25764..54bf28b 100644 --- a/setup/Mac/ODMTools.packproj +++ b/setup/Mac/ODMTools.packproj @@ -566,9 +566,9 @@ IFPkgDescriptionDescription IFPkgDescriptionTitle - ODMTools_v1.2.4 + ODMTools_v1.2.5 IFPkgDescriptionVersion - 1.2.4 Beta + 1.2.5 Beta Display Information @@ -619,7 +619,7 @@ IFPkgFlagPackageSelection 0 Name - ODMTools_v1.2.4-beta_Mac_installer + ODMTools_v1.2.5-beta_Mac_installer Status 1 Type diff --git a/setup/Windows/odmtools_console.iss b/setup/Windows/odmtools_console.iss index 9c453e4..908a76a 100644 --- a/setup/Windows/odmtools_console.iss +++ b/setup/Windows/odmtools_console.iss @@ -2,8 +2,8 @@ ; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES! #define MyAppName "ODMTools" -#define MyAppVersion "1.2.4_Beta" -#define MyAppExeLongName "ODMTools_1.2.4_Beta_win32_x86_64_console.exe" +#define MyAppVersion "1.2.5_Beta" +#define MyAppExeLongName "ODMTools_1.2.5_Beta_win32_x86_64_console.exe" #define MyAppPublisher "ODM2" #define MyAppURL "https://github.com/ODM2/ODMToolsPython" #define MyAppExeName "ODMTools.exe" diff --git a/setup/Windows/odmtools_no_console.iss b/setup/Windows/odmtools_no_console.iss index e7cb919..139a089 100644 --- a/setup/Windows/odmtools_no_console.iss +++ b/setup/Windows/odmtools_no_console.iss @@ -2,8 +2,8 @@ ; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES! #define MyAppName "ODMTools" -#define MyAppExeLongName "ODMTools_1.2.4_Beta_win32_x86_64.exe" -#define MyAppVersion "1.2.4_Beta" +#define MyAppExeLongName "ODMTools_1.2.5_Beta_win32_x86_64.exe" +#define MyAppVersion "1.2.5_Beta" #define MyAppPublisher "ODM2" #define MyAppURL "https://github.com/ODM2/ODMToolsPython" #define MyAppExeName "ODMTools.exe" diff --git a/setup/Windows/odmtools_setup.iss b/setup/Windows/odmtools_setup.iss index ae139d9..4da785b 100644 --- a/setup/Windows/odmtools_setup.iss +++ b/setup/Windows/odmtools_setup.iss @@ -2,7 +2,7 @@ ; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES! #define MyAppName "ODMTools" -#define MyAppVersion "1.2.4_Beta" +#define MyAppVersion "1.2.5_Beta" #define MyAppPublisher "ODM2" #define MyAppURL "https://github.com/ODM2/ODMToolsPython" #define MyAppExeName "ODMTools.exe" From b518eac56fd095ff291d3c8e38269aabb5a90c0b Mon Sep 17 00:00:00 2001 From: stephanie Date: Fri, 10 Jun 2016 12:20:27 -0600 Subject: [PATCH 24/36] add stuff for appveyor --- appveyor.yml | 170 ++++++++++++++++++++++++ odmtools/odmservices/service_manager.py | 37 +----- tests/psycopg2/bld.bat | 8 -- tests/psycopg2/build.sh | 9 -- tests/psycopg2/meta.yaml | 60 --------- 5 files changed, 172 insertions(+), 112 deletions(-) create mode 100644 appveyor.yml delete mode 100644 tests/psycopg2/bld.bat delete mode 100644 tests/psycopg2/build.sh delete mode 100644 tests/psycopg2/meta.yaml diff --git a/appveyor.yml b/appveyor.yml new file mode 100644 index 0000000..f1ee7cf --- /dev/null +++ b/appveyor.yml @@ -0,0 +1,170 @@ +environment: +# patterned after: https://github.com/ogrisel/python-appveyor-demo/blob/master/appveyor.yml + global: + # SDK v7.0 MSVC Express 2008's SetEnv.cmd script will fail if the + # /E:ON and /V:ON options are not enabled in the batch script intepreter + # See: http://stackoverflow.com/a/13751649/163740 + CMD_IN_ENV: "cmd /E:ON /V:ON /C .\\appveyor\\run_with_env.cmd" + # postgres + POSTGRES_PORT: tcp://localhost:5432 + POSTGRES_ENV_POSTGRES_USER: postgres + POSTGRES_ENV_POSTGRES_PASSWORD: Password12! + POSTGRES_ENV_POSTGRES_DB: odm + POSTGRES_PATH: C:\Program Files\PostgreSQL\9.4 + PGUSER: postgres + PGPASSWORD: Password12! + # mysql + MYSQL_PORT: tcp://localhost:3306 + MYSQL_ENV_MYSQL_USER: root + MYSQL_ENV_MYSQL_PASSWORD: Password12! + MYSQL_ENV_MYSQL_DATABASE: odm + MYSQL_PATH: C:\Program Files\MySql\MySQL Server 5.6 + MYSQL_PWD: Password12! + # sql server + SQLSERVER_ENV_SQLSERVER_HOST: localhost + SQLSERVER_ENV_SQLSERVER_PORT: 1433 + SQLSERVER_ENV_SQLSERVER_USER: sa + SQLSERVER_ENV_SQLSERVER_PASSWORD: Password12! + SQLSERVER_ENV_SQLSERVER_DATABASE: odm + matrix: + + + # Pre-installed Python versions, which Appveyor may upgrade to + # a later point release. + # See: http://www.appveyor.com/docs/installed-software#python + + + matrix: + - PYTHON: "C:\\Python27-conda32" + PYTHON_VERSION: "2.7" + PYTHON_ARCH: "32" + + - PYTHON: "C:\\Python34-conda64" + PYTHON_VERSION: "3.4" + PYTHON_ARCH: "64" + +services: + - mssql2008r2sp2 + - mysql + - postgresql + +install: + # If there is a newer build queued for the same PR, cancel this one. + # The AppVeyor 'rollout builds' option is supposed to serve the same + # purpose but it is problematic because it tends to cancel builds pushed + # directly to master instead of just PR builds (or the converse). + # credits: JuliaLang developers. + - 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." } + - ECHO "Filesystem root:" + - ps: "ls \"C:/\"" + + - ECHO "Installed SDKs:" + - ps: "ls \"C:/Program Files/Microsoft SDKs/Windows\"" + + # Install Python (from the official .msi of http://python.org) and pip when + # not already installed. + - ps: if (-not(Test-Path($env:PYTHON))) { & appveyor\install.ps1 } + + # Prepend newly installed Python to the PATH of this build (this cannot be + # done from inside the powershell script as it would require to restart + # the parent CMD process). + - "SET PATH=%PYTHON%;%PYTHON%\\Scripts;%PATH%" + # add databases + - "SET PATH=%POSTGRES_PATH%\bin;%MYSQL_PATH%\bin;%PATH%" + + # Check that we have the expected version and architecture for Python + - "python --version" + - "python -c \"import struct; print(struct.calcsize('P') * 8)\"" + + # Upgrade to the latest version of pip to avoid it displaying warnings + # about it being out of date. + - "pip install --disable-pip-version-check --user --upgrade pip" + + # Install the build dependencies of the project. If some dependencies contain + # compiled extensions and are not provided as pre-built wheel packages, + # pip will build them from source using the MSVC compiler matching the + # target Python version and architecture + - "%CMD_IN_ENV% pip install -r dev-requirements.txt" + +build_script: + # Build the compiled extension + - "%CMD_IN_ENV% python setup.py build" +build_script: + # Build the compiled extension + - "%CMD_IN_ENV% python setup.py build" + build_script: + # postgres + - createdb odm + - psql -d odm -a -f spec/databases/postgresql/schema/schema.sql + # mysql + - mysql -e "drop database test; create database odm2;" --user=root + - mysql sqlectron < spec/databases/mysql/schema/schema.sql --user=root + # sqlserver + - ps: ./appveyor-sqlserver.ps1 SQL2008R2SP2 + - sqlcmd -S localhost,1433 -U sa -P Password12! -Q "CREATE DATABASE odm2" -d "master" + - sqlcmd -S localhost,1433 -U sa -P Password12! -i spec/databases/sqlserver/schema/schema.sql -d "odm" + - sqlcmd -S localhost,1433 -U sa -P Password12! -Q "select table_name from information_schema.tables" -d "odm" + +test_script: + # Run the project tests + - "%CMD_IN_ENV% python setup.py nosetests" + +language: python +python: +# - "2.6" + - "2.7" +# - "3.2" +# - "3.3" +# - "3.4" +# - "3.5" +# - "3.5-dev" # 3.5 development branch +# - "nightly" # currently points to 3.6-dev +# command to install dependencies + +before_install: +#https://github.com/sqlectron/sqlectron-core/blob/master/appveyor.yml + - mysql -e "CREATE USER 'ODM'@'localhost' IDENTIFIED BY 'odm';GRANT ALL PRIVILEGES ON *.* TO 'ODM'@'localhost';" -uroot + - mysql -e "create database IF NOT EXISTS odm;" -uroot + - mysql -e "create database IF NOT EXISTS odmtest;" -uroot + - psql -U postgres -c "create extension postgis" + - psql -c 'DROP DATABASE IF EXISTS odmtest;' -U postgres; + - psql -c 'create database odmtest;' -U postgres; +# - psql -U postgres -d odmtest -a -f ./tests/schemas/postgresql/ODM2_for_PostgreSQL.sql + - psql -c 'DROP DATABASE IF EXISTS odm;' -U postgres; + - psql -c 'create database odm;' -U postgres; + # patterned after: https://github.com/ptrv/gpx2spatialite/blob/master/.travis.yml +# - sudo apt-get install -y python-software-properties +# - sudo apt-add-repository -y ppa:git-core/ppa +# - sudo apt-add-repository -y ppa:ubuntugis/ppa +# - sudo apt-get update -qq +# - sudo apt-get install unixodbc unixodbc-dev tdsodbc +# - sudo apt-get install freetds-dev freetds-bin +# - sudo apt-get install libc6 e2fsprogs # mssql driver + # Spatialiate +# - sudo apt-get install -y libproj-dev libgeos-dev libspatialite-dev +# - sudo ln -s /usr/lib/x86_64-linux-gnu/libspatialite.so /usr/lib/libspatialite.so +# - sudo apt-get install python-scipy python-matplotlib python-pandas python-sympy python-nose +# - sudo apt-get install python-matplotlib python-pandas python-nose + - pip install pandas +install: # now just our code + - pip install geoalchemy2 + - pip install . + - pip install -r requirements_tests.txt --allow-external pyodbc --allow-unverified pyodbc + # pysqlite + - pip install pysqlite + - dir .\tests\scripts\sampledb\odm_mysql.sql .\tests\scripts\sampledb\odm_postgres.sql + - mysql --user root --verbose odm < .\tests\scripts\sampledb\odm_mysql.sql +# add -a to psql to see full log + - psql -U postgres -f .\tests\scripts\sampledb\odm_postgres.sql + +# don't forget to open up the azure mssql server to these addreses +# https://docs.travis-ci.com/user/ip-addresses/ + +# command to run tests +script: +# just the connection part + - py.test tests/test_connection.py + - py.test diff --git a/odmtools/odmservices/service_manager.py b/odmtools/odmservices/service_manager.py index bb5afd8..6105c7f 100755 --- a/odmtools/odmservices/service_manager.py +++ b/odmtools/odmservices/service_manager.py @@ -186,34 +186,9 @@ def _get_file(self, mode): return config_file def _build_connection_string(self, conn_dict): -<<<<<<< Updated upstream - # driver = "" - # connformat= self._connection_format - # if conn_dict['engine'] == 'mssql' and sys.platform != 'win32': - # driver = "pyodbc" - # quoted = urllib.quote_plus('DRIVER={FreeTDS};DSN=%s;UID=%s;PWD=%s;' % (conn_dict['address'], conn_dict['user'], conn_dict['password'])) - # conn_string = 'mssql+pyodbc:///?odbc_connect={}'.format(quoted) - # - # else: - # if conn_dict['engine'] == 'mssql': - # driver = "pyodbc" - # connformat=self._connection_format = "%s+%s://%s:%s@%s/%s?driver=SQL+Server+Native+Client+10.0" - # elif conn_dict['engine'] == 'mysql': - # driver = "pymysql" - # elif conn_dict['engine'] == 'postgresql': - # driver = "psycopg2" - # else: - # driver = "None" - # - # conn_string = connformat % ( - # conn_dict['engine'], driver, conn_dict['user'], conn_dict['password'], conn_dict['address'], - # conn_dict['db']) - # return conn_string - # driver = "" - # print "****", conn_dict -======= + self._connection_format = "%s+%s://%s:%s@%s/%s" ->>>>>>> Stashed changes + if conn_dict['engine'] == 'mssql' and sys.platform != 'win32': driver = "pyodbc" quoted = urllib.quote_plus('DRIVER={FreeTDS};DSN=%s;UID=%s;PWD=%s;' % (conn_dict['address'], conn_dict['user'], @@ -241,19 +216,11 @@ def _build_connection_string(self, conn_dict): else: driver = "None" conn_string = self.constringBuilder(conn_dict, driver) -<<<<<<< Updated upstream - - - # print "******", conn_string - return conn_string - -======= # print "******", conn_string return conn_string ->>>>>>> Stashed changes def constringBuilder(self, conn_dict, driver): if conn_dict['password'] is None or not conn_dict['password']: conn_string = self._connection_format_nopassword % ( diff --git a/tests/psycopg2/bld.bat b/tests/psycopg2/bld.bat deleted file mode 100644 index 87b1481..0000000 --- a/tests/psycopg2/bld.bat +++ /dev/null @@ -1,8 +0,0 @@ -"%PYTHON%" setup.py install -if errorlevel 1 exit 1 - -:: Add more build steps here, if they are necessary. - -:: See -:: http://docs.continuum.io/conda/build.html -:: for a list of environment variables that are set during the build process. diff --git a/tests/psycopg2/build.sh b/tests/psycopg2/build.sh deleted file mode 100644 index 4d7fc03..0000000 --- a/tests/psycopg2/build.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash - -$PYTHON setup.py install - -# Add more build steps here, if they are necessary. - -# See -# http://docs.continuum.io/conda/build.html -# for a list of environment variables that are set during the build process. diff --git a/tests/psycopg2/meta.yaml b/tests/psycopg2/meta.yaml deleted file mode 100644 index 8f0dc61..0000000 --- a/tests/psycopg2/meta.yaml +++ /dev/null @@ -1,60 +0,0 @@ -package: - name: psycopg2 - version: "2.6.1" - -source: - fn: psycopg2-2.6.1.tar.gz - url: https://pypi.python.org/packages/86/fd/cc8315be63a41fe000cce20482a917e874cdc1151e62cb0141f5e55f711e/psycopg2-2.6.1.tar.gz - md5: 842b44f8c95517ed5b792081a2370da1 -# patches: - # List any patch files here - # - fix.patch - -# build: - # preserve_egg_dir: True - # entry_points: - # Put any entry points (scripts to be generated automatically) here. The - # syntax is module:function. For example - # - # - psycopg2 = psycopg2:main - # - # Would create an entry point called psycopg2 that calls psycopg2.main() - - - # If this is a new build for the same version, increment the build - # number. If you do not include this key, it defaults to 0. - # number: 1 - -requirements: - build: - - python - - run: - - python - -test: - # Python imports - imports: - - psycopg2 - - psycopg2.tests - - # commands: - # You can put test commands to be run here. Use this to test that the - # entry points work. - - - # You can also put a file called run_test.py in the recipe that will be run - # at test time. - - # requires: - # Put any additional test requirements here. For example - # - nose - -about: - home: http://initd.org/psycopg/ - license: GNU Library or Lesser General Public License (LGPL) or Zope Public License - summary: 'psycopg2 - Python-PostgreSQL Database Adapter' - -# See -# http://docs.continuum.io/conda/build.html for -# more information about meta.yaml From a3f93c07d0ff15f6c9d02dc924698dbb71515306 Mon Sep 17 00:00:00 2001 From: stephanie Date: Fri, 10 Jun 2016 14:09:29 -0600 Subject: [PATCH 25/36] debug statement for histogram issue --- odmtools/gui/plotHistogram.py | 1 + odmtools/gui/pnlPlot.py | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/odmtools/gui/plotHistogram.py b/odmtools/gui/plotHistogram.py index 219781b..c6698ed 100644 --- a/odmtools/gui/plotHistogram.py +++ b/odmtools/gui/plotHistogram.py @@ -99,6 +99,7 @@ def _createPlot(self, oneSeries, rows, cols, index): ax = self.figure.add_subplot(repr(rows) + repr(cols) + repr(index)) logger.debug("HISTOGRAM: %s"% ax) + logger.debut("rows: %s cols: %s, index: %s"%(rows, cols, index)) # oneSeries.filteredData.hist(ax= ax, color='k', alpha=0.5, bins=50) diff --git a/odmtools/gui/pnlPlot.py b/odmtools/gui/pnlPlot.py index 230c8b6..9788b7c 100644 --- a/odmtools/gui/pnlPlot.py +++ b/odmtools/gui/pnlPlot.py @@ -164,11 +164,12 @@ def redrawPlots(self): logger.debug("Plot Boxwhisker") self.pltBox.Plot(self._seriesPlotInfo) + logger.debug("Plot Timeseries") + self.pltTS.Plot(self._seriesPlotInfo) + logger.debug("Plot Histogram") self.pltHist.Plot(self._seriesPlotInfo) - logger.debug("Plot Timeseries") - self.pltTS.Plot(self._seriesPlotInfo) self.onShowLegend(event=None, isVisible=self.legendVisible) maxStart, maxEnd, currStart, currEnd = self._seriesPlotInfo.getDates() From ab8ca688bc5ae7be76cee80e91fb01a460ae5d8e Mon Sep 17 00:00:00 2001 From: stephanie Date: Mon, 13 Jun 2016 11:05:04 -0600 Subject: [PATCH 26/36] update appveyor.yml --- appveyor.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index f1ee7cf..dbe904b 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -87,7 +87,8 @@ install: # compiled extensions and are not provided as pre-built wheel packages, # pip will build them from source using the MSVC compiler matching the # target Python version and architecture - - "%CMD_IN_ENV% pip install -r dev-requirements.txt" + #- "%CMD_IN_ENV% pip install -r dev-requirements.txt" + - "%CMD_IN_ENV% pip install -r requirements_tests.txt" build_script: # Build the compiled extension @@ -95,7 +96,7 @@ build_script: build_script: # Build the compiled extension - "%CMD_IN_ENV% python setup.py build" - build_script: +build_script: # postgres - createdb odm - psql -d odm -a -f spec/databases/postgresql/schema/schema.sql From 93069b672b8dece74b28efa940847ed8c9e87acc Mon Sep 17 00:00:00 2001 From: stephanie Date: Mon, 13 Jun 2016 11:56:30 -0600 Subject: [PATCH 27/36] update appveyor.yml --- appveyor.yml | 58 +++++++++++++++++++++++++++++----------------------- 1 file changed, 32 insertions(+), 26 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index dbe904b..0f3026f 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -4,6 +4,11 @@ environment: # SDK v7.0 MSVC Express 2008's SetEnv.cmd script will fail if the # /E:ON and /V:ON options are not enabled in the batch script intepreter # See: http://stackoverflow.com/a/13751649/163740 + PYTHON: "C:\\conda" + MINICONDA_VERSION: "latest" + CONDA_DEPENDENCIES: "numpy matplotlib pandas pymysql scipy sqlite sqlalchemy psycopg2 wxpython" + PIP_DEPENDENCIES: "geoalchemy pyodbc" + CMD_IN_ENV: "cmd /E:ON /V:ON /C .\\appveyor\\run_with_env.cmd" # postgres POSTGRES_PORT: tcp://localhost:5432 @@ -38,10 +43,21 @@ environment: - PYTHON: "C:\\Python27-conda32" PYTHON_VERSION: "2.7" PYTHON_ARCH: "32" +# CONDA_PY: "27" +# CONDA_NPY: "18" + NUMPY_VERSION: "stable" - - PYTHON: "C:\\Python34-conda64" - PYTHON_VERSION: "3.4" + - PYTHON: "C:\\Python27-conda64" + PYTHON_VERSION: "2.7" PYTHON_ARCH: "64" + NUMPY_VERSION: "stable" +# CONDA_PY: "27" +# CONDA_NPY: "18" + + +# - PYTHON: "C:\\Python34-conda64" +# PYTHON_VERSION: "3.4" +# PYTHON_ARCH: "64" services: - mssql2008r2sp2 @@ -66,7 +82,9 @@ install: # Install Python (from the official .msi of http://python.org) and pip when # not already installed. - - ps: if (-not(Test-Path($env:PYTHON))) { & appveyor\install.ps1 } +# - ps: if (-not(Test-Path($env:PYTHON))) { & appveyor\install.ps1 } + - "powershell ci-helpers/appveyor/install-miniconda.ps1" + # Prepend newly installed Python to the PATH of this build (this cannot be # done from inside the powershell script as it would require to restart @@ -88,20 +106,18 @@ install: # pip will build them from source using the MSVC compiler matching the # target Python version and architecture #- "%CMD_IN_ENV% pip install -r dev-requirements.txt" - - "%CMD_IN_ENV% pip install -r requirements_tests.txt" +# - "%CMD_IN_ENV% pip install -r requirements_tests.txt" -build_script: - # Build the compiled extension - - "%CMD_IN_ENV% python setup.py build" -build_script: - # Build the compiled extension - - "%CMD_IN_ENV% python setup.py build" + +#build_script: +# # Build the compiled extension +# - "%CMD_IN_ENV% python setup.py build" build_script: # postgres - createdb odm - psql -d odm -a -f spec/databases/postgresql/schema/schema.sql # mysql - - mysql -e "drop database test; create database odm2;" --user=root + - mysql -e "drop database test; create database odm;" --user=root - mysql sqlectron < spec/databases/mysql/schema/schema.sql --user=root # sqlserver - ps: ./appveyor-sqlserver.ps1 SQL2008R2SP2 @@ -113,6 +129,7 @@ test_script: # Run the project tests - "%CMD_IN_ENV% python setup.py nosetests" + language: python python: # - "2.6" @@ -137,23 +154,12 @@ before_install: - psql -c 'DROP DATABASE IF EXISTS odm;' -U postgres; - psql -c 'create database odm;' -U postgres; # patterned after: https://github.com/ptrv/gpx2spatialite/blob/master/.travis.yml -# - sudo apt-get install -y python-software-properties -# - sudo apt-add-repository -y ppa:git-core/ppa -# - sudo apt-add-repository -y ppa:ubuntugis/ppa -# - sudo apt-get update -qq -# - sudo apt-get install unixodbc unixodbc-dev tdsodbc -# - sudo apt-get install freetds-dev freetds-bin -# - sudo apt-get install libc6 e2fsprogs # mssql driver - # Spatialiate -# - sudo apt-get install -y libproj-dev libgeos-dev libspatialite-dev -# - sudo ln -s /usr/lib/x86_64-linux-gnu/libspatialite.so /usr/lib/libspatialite.so -# - sudo apt-get install python-scipy python-matplotlib python-pandas python-sympy python-nose -# - sudo apt-get install python-matplotlib python-pandas python-nose - - pip install pandas + +# - pip install pandas install: # now just our code - - pip install geoalchemy2 +# - pip install geoalchemy2 - pip install . - - pip install -r requirements_tests.txt --allow-external pyodbc --allow-unverified pyodbc +# - pip install -r requirements_tests.txt --allow-external pyodbc --allow-unverified pyodbc # pysqlite - pip install pysqlite - dir .\tests\scripts\sampledb\odm_mysql.sql .\tests\scripts\sampledb\odm_postgres.sql From a30e2ab11baea8c30389cceb84f50a2dbacb4fc0 Mon Sep 17 00:00:00 2001 From: stephanie Date: Mon, 13 Jun 2016 11:59:17 -0600 Subject: [PATCH 28/36] fix appveyor.yml issue --- appveyor.yml | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 0f3026f..863a8a7 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -109,6 +109,19 @@ install: # - "%CMD_IN_ENV% pip install -r requirements_tests.txt" +# now just our code +# - pip install pandas +# - pip install geoalchemy2 + - pip install . +# - pip install -r requirements_tests.txt --allow-external pyodbc --allow-unverified pyodbc + # pysqlite + - pip install pysqlite + - dir .\tests\scripts\sampledb\odm_mysql.sql .\tests\scripts\sampledb\odm_postgres.sql + - mysql --user root --verbose odm < .\tests\scripts\sampledb\odm_mysql.sql +# add -a to psql to see full log + - psql -U postgres -f .\tests\scripts\sampledb\odm_postgres.sql + + #build_script: # # Build the compiled extension # - "%CMD_IN_ENV% python setup.py build" @@ -155,17 +168,7 @@ before_install: - psql -c 'create database odm;' -U postgres; # patterned after: https://github.com/ptrv/gpx2spatialite/blob/master/.travis.yml -# - pip install pandas -install: # now just our code -# - pip install geoalchemy2 - - pip install . -# - pip install -r requirements_tests.txt --allow-external pyodbc --allow-unverified pyodbc - # pysqlite - - pip install pysqlite - - dir .\tests\scripts\sampledb\odm_mysql.sql .\tests\scripts\sampledb\odm_postgres.sql - - mysql --user root --verbose odm < .\tests\scripts\sampledb\odm_mysql.sql -# add -a to psql to see full log - - psql -U postgres -f .\tests\scripts\sampledb\odm_postgres.sql + # don't forget to open up the azure mssql server to these addreses # https://docs.travis-ci.com/user/ip-addresses/ From 90967321db581e98ac0e93242da650f0756d6e17 Mon Sep 17 00:00:00 2001 From: stephanie Date: Mon, 13 Jun 2016 12:52:22 -0600 Subject: [PATCH 29/36] update appveyor and include all the necessary files, move travisci files --- .travis.yml | 6 +- appveyor.yml | 59 +++--- ci-helpers/appveyor/install-miniconda.ps1 | 192 ++++++++++++++++++ ci-helpers/appveyor/sqlserver.ps1 | 21 ++ ci-helpers/appveyor/windows_sdk.cmd | 66 ++++++ .../scripts => ci-helpers/travis}/apt-get.sh | 0 .../scripts => ci-helpers/travis}/freetds.sh | 0 .../travis}/mysql_setup.sh | 0 .../travis}/postgres_setup.sh | 0 tests/data/sampledb/odm_mssql.sql | Bin 0 -> 255270 bytes .../{scripts => data}/sampledb/odm_mysql.sql | 0 .../sampledb/odm_postgres.sql | 0 .../{scripts => data}/sampledb/odm_sqlite.sql | 0 13 files changed, 312 insertions(+), 32 deletions(-) create mode 100644 ci-helpers/appveyor/install-miniconda.ps1 create mode 100644 ci-helpers/appveyor/sqlserver.ps1 create mode 100644 ci-helpers/appveyor/windows_sdk.cmd rename {tests/scripts => ci-helpers/travis}/apt-get.sh (100%) rename {tests/scripts => ci-helpers/travis}/freetds.sh (100%) rename {tests/scripts => ci-helpers/travis}/mysql_setup.sh (100%) rename {tests/scripts => ci-helpers/travis}/postgres_setup.sh (100%) create mode 100644 tests/data/sampledb/odm_mssql.sql rename tests/{scripts => data}/sampledb/odm_mysql.sql (100%) rename tests/{scripts => data}/sampledb/odm_postgres.sql (100%) rename tests/{scripts => data}/sampledb/odm_sqlite.sql (100%) diff --git a/.travis.yml b/.travis.yml index b3df53a..c0e666e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -43,9 +43,9 @@ addons: # mariadb: '10.1' before_script: - - ./scripts/tests/mysql_setup.sh - - ./scripts/tests/postgres_setup.sh - - ./scripts/tests/freetds.sh + - ./ci-helpers/travis/mysql_setup.sh + - ./ci-helpers/travis/postgres_setup.sh + - ./ci-helpers/travis/freetds.sh before_install: # python -m pip makes the install go into the virtualenv diff --git a/appveyor.yml b/appveyor.yml index 863a8a7..0dc6b54 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -6,10 +6,12 @@ environment: # See: http://stackoverflow.com/a/13751649/163740 PYTHON: "C:\\conda" MINICONDA_VERSION: "latest" + # CMD_IN_ENV: "cmd /E:ON /V:ON /C .\\appveyor\\run_with_env.cmd" + CMD_IN_ENV: "cmd /E:ON /V:ON /C .\\ci-helpers/appveyor/windows_sdk.cmd" CONDA_DEPENDENCIES: "numpy matplotlib pandas pymysql scipy sqlite sqlalchemy psycopg2 wxpython" PIP_DEPENDENCIES: "geoalchemy pyodbc" - CMD_IN_ENV: "cmd /E:ON /V:ON /C .\\appveyor\\run_with_env.cmd" + # postgres POSTGRES_PORT: tcp://localhost:5432 POSTGRES_ENV_POSTGRES_USER: postgres @@ -31,33 +33,32 @@ environment: SQLSERVER_ENV_SQLSERVER_USER: sa SQLSERVER_ENV_SQLSERVER_PASSWORD: Password12! SQLSERVER_ENV_SQLSERVER_DATABASE: odm - matrix: + # Pre-installed Python versions, which Appveyor may upgrade to # a later point release. # See: http://www.appveyor.com/docs/installed-software#python + matrix: + - PYTHON: "C:\\Python27-conda32" + PYTHON_VERSION: "2.7" + PYTHON_ARCH: "32" + # CONDA_PY: "27" + # CONDA_NPY: "18" + NUMPY_VERSION: "stable" - matrix: - - PYTHON: "C:\\Python27-conda32" - PYTHON_VERSION: "2.7" - PYTHON_ARCH: "32" -# CONDA_PY: "27" -# CONDA_NPY: "18" - NUMPY_VERSION: "stable" - - - PYTHON: "C:\\Python27-conda64" - PYTHON_VERSION: "2.7" - PYTHON_ARCH: "64" - NUMPY_VERSION: "stable" -# CONDA_PY: "27" -# CONDA_NPY: "18" + - PYTHON: "C:\\Python27-conda64" + PYTHON_VERSION: "2.7" + PYTHON_ARCH: "64" + NUMPY_VERSION: "stable" + # CONDA_PY: "27" + # CONDA_NPY: "18" -# - PYTHON: "C:\\Python34-conda64" -# PYTHON_VERSION: "3.4" -# PYTHON_ARCH: "64" + # - PYTHON: "C:\\Python34-conda64" + # PYTHON_VERSION: "3.4" + # PYTHON_ARCH: "64" services: - mssql2008r2sp2 @@ -116,10 +117,10 @@ install: # - pip install -r requirements_tests.txt --allow-external pyodbc --allow-unverified pyodbc # pysqlite - pip install pysqlite - - dir .\tests\scripts\sampledb\odm_mysql.sql .\tests\scripts\sampledb\odm_postgres.sql - - mysql --user root --verbose odm < .\tests\scripts\sampledb\odm_mysql.sql -# add -a to psql to see full log - - psql -U postgres -f .\tests\scripts\sampledb\odm_postgres.sql +# - dir .\tests\data\sampledb\odm_mysql.sql .\tests\data\sampledb\odm_postgres.sql +# - mysql --user root --verbose odm < .\tests\data\sampledb\odm_mysql.sql +## add -a to psql to see full log +# - psql -U postgres -f .\tests\data\sampledb\odm_postgres.sql #build_script: @@ -128,14 +129,14 @@ install: build_script: # postgres - createdb odm - - psql -d odm -a -f spec/databases/postgresql/schema/schema.sql + - psql -d odm -a -f tests\data\sampledb\odm_postgres.sql # mysql - mysql -e "drop database test; create database odm;" --user=root - - mysql sqlectron < spec/databases/mysql/schema/schema.sql --user=root + - mysql odm < tests\data\sampledb\odm_mysql.sql --user=root # sqlserver - - ps: ./appveyor-sqlserver.ps1 SQL2008R2SP2 - - sqlcmd -S localhost,1433 -U sa -P Password12! -Q "CREATE DATABASE odm2" -d "master" - - sqlcmd -S localhost,1433 -U sa -P Password12! -i spec/databases/sqlserver/schema/schema.sql -d "odm" + - ps: ci-helpers\appveyor\sqlserver.ps1 SQL2008R2SP2 + - sqlcmd -S localhost,1433 -U sa -P Password12! -Q "CREATE DATABASE odm" -d "master" + - sqlcmd -S localhost,1433 -U sa -P Password12! -i tests\data\sampledb\odm_mssql.sql -d "odm" - sqlcmd -S localhost,1433 -U sa -P Password12! -Q "select table_name from information_schema.tables" -d "odm" test_script: @@ -163,7 +164,7 @@ before_install: - psql -U postgres -c "create extension postgis" - psql -c 'DROP DATABASE IF EXISTS odmtest;' -U postgres; - psql -c 'create database odmtest;' -U postgres; -# - psql -U postgres -d odmtest -a -f ./tests/schemas/postgresql/ODM2_for_PostgreSQL.sql +# - psql -U postgres -d odmtest -a -f .\tests\data\sampledb\ODM2_for_PostgreSQL.sql - psql -c 'DROP DATABASE IF EXISTS odm;' -U postgres; - psql -c 'create database odm;' -U postgres; # patterned after: https://github.com/ptrv/gpx2spatialite/blob/master/.travis.yml diff --git a/ci-helpers/appveyor/install-miniconda.ps1 b/ci-helpers/appveyor/install-miniconda.ps1 new file mode 100644 index 0000000..25c3ff2 --- /dev/null +++ b/ci-helpers/appveyor/install-miniconda.ps1 @@ -0,0 +1,192 @@ +# Sample script to install anaconda under windows +# Authors: Stuart Mumford +# Borrwed from: Olivier Grisel and Kyle Kastner +# License: BSD 3 clause + +$MINICONDA_URL = "https://repo.continuum.io/miniconda/" + +if (! $env:ASTROPY_LTS_VERSION) { + $env:ASTROPY_LTS_VERSION = "1.0" +} + +function DownloadMiniconda ($version, $platform_suffix) { + $webclient = New-Object System.Net.WebClient + $filename = "Miniconda-" + $version + "-Windows-" + $platform_suffix + ".exe" + + $url = $MINICONDA_URL + $filename + + $basedir = $pwd.Path + "\" + $filepath = $basedir + $filename + if (Test-Path $filename) { + Write-Host "Reusing" $filepath + return $filepath + } + + # Download and retry up to 3 times in case of network transient errors. + Write-Host "Downloading" $filename "from" $url + $retry_attempts = 2 + for($i=0; $i -lt $retry_attempts; $i++){ + try { + $webclient.DownloadFile($url, $filepath) + break + } + Catch [Exception]{ + Start-Sleep 1 + } + } + if (Test-Path $filepath) { + Write-Host "File saved at" $filepath + } else { + # Retry once to get the error message if any at the last try + $webclient.DownloadFile($url, $filepath) + } + return $filepath +} + +function InstallMiniconda ($miniconda_version, $architecture, $python_home) { + Write-Host "Installing miniconda" $miniconda_version "for" $architecture "bit architecture to" $python_home + if (Test-Path $python_home) { + Write-Host $python_home "already exists, skipping." + return $false + } + if ($architecture -eq "x86") { + $platform_suffix = "x86" + } else { + $platform_suffix = "x86_64" + } + $filepath = DownloadMiniconda $miniconda_version $platform_suffix + Write-Host "Installing" $filepath "to" $python_home + $args = "/InstallationType=AllUsers /S /AddToPath=1 /RegisterPython=1 /D=" + $python_home + Write-Host $filepath $args + Start-Process -FilePath $filepath -ArgumentList $args -Wait -Passthru + #Start-Sleep -s 15 + if (Test-Path $python_home) { + Write-Host "Miniconda $miniconda_version ($architecture) installation complete" + } else { + Write-Host "Failed to install Python in $python_home" + Exit 1 + } +} + +# Install miniconda, if no version is given use the latest +if (! $env:MINICONDA_VERSION) { + $env:MINICONDA_VERSION="latest" +} + +InstallMiniconda $env:MINICONDA_VERSION $env:PLATFORM $env:PYTHON + +# Set environment variables +$env:PATH = "${env:PYTHON};${env:PYTHON}\Scripts;" + $env:PATH + +# Conda config +conda config --set always_yes true + +if (! $env:CONDA_CHANNELS) { + $CONDA_CHANNELS=@("astropy", "astropy-ci-extras", "openastronomy") +} else { + $CONDA_CHANNELS=$env:CONDA_CHANNELS.split(" ") +} +foreach ($CONDA_CHANNEL in $CONDA_CHANNELS) { + conda config --add channels $CONDA_CHANNEL +} + +# Install the build and runtime dependencies of the project. +conda update -q conda + +# Create a conda environment using the astropy bonus packages +conda create -q -n test python=$env:PYTHON_VERSION +activate test + +# Set environment variables for environment (activate test doesn't seem to do the trick) +$env:PATH = "${env:PYTHON}\envs\test;${env:PYTHON}\envs\test\Scripts;${env:PYTHON}\envs\test\Library\bin;" + $env:PATH + +# Check that we have the expected version of Python +python --version + +# Check whether a specific version of Numpy is required +if ($env:NUMPY_VERSION) { + if($env:NUMPY_VERSION -match "stable") { + $NUMPY_OPTION = "numpy" + } elseif($env:NUMPY_VERSION -match "dev") { + $NUMPY_OPTION = "Cython pip".Split(" ") + } else { + $NUMPY_OPTION = "numpy=" + $env:NUMPY_VERSION + } +} else { + $NUMPY_OPTION = "" +} + +# Check whether a specific version of Astropy is required +if ($env:ASTROPY_VERSION) { + if($env:ASTROPY_VERSION -match "stable") { + $ASTROPY_OPTION = "astropy" + } elseif($env:ASTROPY_VERSION -match "dev") { + $ASTROPY_OPTION = "Cython pip jinja2".Split(" ") + } elseif($env:ASTROPY_VERSION -match "lts") { + $ASTROPY_OPTION = "astropy=" + $env:ASTROPY_LTS_VERSION + } else { + $ASTROPY_OPTION = "astropy=" + $env:ASTROPY_VERSION + } +} else { + $ASTROPY_OPTION = "" +} + +# Install the specified versions of numpy and other dependencies +if ($env:CONDA_DEPENDENCIES) { + $CONDA_DEPENDENCIES = $env:CONDA_DEPENDENCIES.split(" ") +} else { + $CONDA_DEPENDENCIES = "" +} + +# Due to scipy DLL issues with mkl 11.3.3, and as there is no nomkl option +# for windows, we should use mkl 11.3.1 for now as a workaround see discussion +# in https://github.com/astropy/astropy/pull/4907#issuecomment-219200964 + +if ($NUMPY_OPTION -ne "") { + $NUMPY_OPTION_mkl = "mkl=11.3.1 " + $NUMPY_OPTION + echo $NUMPY_OPTION_mkl + $NUMPY_OPTION = $NUMPY_OPTION_mkl.Split(" ") +} + +# We have to fix the version of the vs2015_runtime on Python 3.5 to avoid +# issues. See https://github.com/astropy/ci-helpers/issues/92 for more details. + +if ($env:PYTHON_VERSION -match "3.5") { + conda install -n test -q vs2015_runtime=14.00.23026.0=0 +} + +conda install -n test -q pytest $NUMPY_OPTION $ASTROPY_OPTION $CONDA_DEPENDENCIES + +# Check whether the developer version of Numpy is required and if yes install it +if ($env:NUMPY_VERSION -match "dev") { + Invoke-Expression "${env:CMD_IN_ENV} pip install git+https://github.com/numpy/numpy.git#egg=numpy --upgrade --no-deps" +} + +# Check whether the developer version of Astropy is required and if yes install +# it. We need to include --no-deps to make sure that Numpy doesn't get upgraded. +if ($env:ASTROPY_VERSION -match "dev") { + Invoke-Expression "${env:CMD_IN_ENV} pip install git+https://github.com/astropy/astropy.git#egg=astropy --upgrade --no-deps" +} + +# We finally install the dependencies listed in PIP_DEPENDENCIES. We do this +# after installing the Numpy versions of Numpy or Astropy. If we didn't do this, +# then calling pip earlier could result in the stable version of astropy getting +# installed, and then overritten later by the dev version (which would waste +# build time) + +if ($env:PIP_FLAGS) { + $PIP_FLAGS = $env:PIP_FLAGS +} else { + $PIP_FLAGS = "" +} + +if ($env:PIP_DEPENDENCIES) { + $PIP_DEPENDENCIES = $env:PIP_DEPENDENCIES +} else { + $PIP_DEPENDENCIES = "" +} + +if ($env:PIP_DEPENDENCIES) { + pip install $PIP_DEPENDENCIES $PIP_FLAGS +} + diff --git a/ci-helpers/appveyor/sqlserver.ps1 b/ci-helpers/appveyor/sqlserver.ps1 new file mode 100644 index 0000000..f7a6b0a --- /dev/null +++ b/ci-helpers/appveyor/sqlserver.ps1 @@ -0,0 +1,21 @@ +[reflection.assembly]::LoadWithPartialName("Microsoft.SqlServer.Smo") | Out-Null +[reflection.assembly]::LoadWithPartialName("Microsoft.SqlServer.SqlWmiManagement") | Out-Null + +$instancename = $args[0]; +$computerName = $env:COMPUTERNAME +$smo = 'Microsoft.SqlServer.Management.Smo.' +$wmi = New-Object ($smo + 'Wmi.ManagedComputer') + +$uri = "ManagedComputer[@Name='$computerName']/ ServerInstance[@Name='$instancename']/ServerProtocol[@Name='Tcp']" +$Tcp = $wmi.GetSmoObject($uri) +foreach ($ipAddress in $Tcp.IPAddresses) +{ + $ipAddress.IPAddressProperties["TcpDynamicPorts"].Value = "" + $ipAddress.IPAddressProperties["TcpPort"].Value = "1433" +} +$Tcp.Alter() + +Stop-Service SQLBrowser +Stop-Service "MSSQL`$$instancename" +Start-Service SQLBrowser +Start-Service "MSSQL`$$instancename" \ No newline at end of file diff --git a/ci-helpers/appveyor/windows_sdk.cmd b/ci-helpers/appveyor/windows_sdk.cmd new file mode 100644 index 0000000..951b0c7 --- /dev/null +++ b/ci-helpers/appveyor/windows_sdk.cmd @@ -0,0 +1,66 @@ +:: To build extensions for 64 bit Python 3.5 or later no special environment needs +:: to be configured. +:: +:: To build extensions for 64 bit Python 3.4 or earlier, we need to configure environment +:: variables to use the MSVC 2010 C++ compilers from GRMSDKX_EN_DVD.iso of: +:: MS Windows SDK for Windows 7 and .NET Framework 4 (SDK v7.1) +:: +:: To build extensions for 64 bit Python 2, we need to configure environment +:: variables to use the MSVC 2008 C++ compilers from GRMSDKX_EN_DVD.iso of: +:: MS Windows SDK for Windows 7 and .NET Framework 3.5 (SDK v7.0) +:: +:: 32 bit builds do not require specific environment configurations. +:: +:: Note: this script needs to be run with the /E:ON and /V:ON flags for the +:: cmd interpreter, at least for (SDK v7.0) +:: +:: More details at: +:: https://github.com/cython/cython/wiki/64BitCythonExtensionsOnWindows +:: https://stackoverflow.com/a/13751649/163740 +:: +:: Original Author: Olivier Grisel +:: License: CC0 1.0 Universal: https://creativecommons.org/publicdomain/zero/1.0/ +:: This version based on updates for python 3.5 by Phil Elson at: +:: https://github.com/pelson/Obvious-CI/tree/master/scripts + +@ECHO OFF + +SET COMMAND_TO_RUN=%* +SET WIN_SDK_ROOT=C:\Program Files\Microsoft SDKs\Windows + +SET MAJOR_PYTHON_VERSION="%PYTHON_VERSION:~0,1%" +SET MINOR_PYTHON_VERSION=%PYTHON_VERSION:~2,1% +IF %MAJOR_PYTHON_VERSION% == "2" ( + SET WINDOWS_SDK_VERSION="v7.0" + SET SET_SDK_64=Y +) ELSE IF %MAJOR_PYTHON_VERSION% == "3" ( + SET WINDOWS_SDK_VERSION="v7.1" + IF %MINOR_PYTHON_VERSION% LEQ 4 ( + SET SET_SDK_64=Y + ) ELSE ( + SET SET_SDK_64=N + ) +) ELSE ( + ECHO Unsupported Python version: "%MAJOR_PYTHON_VERSION%" + EXIT 1 +) + +IF "%PYTHON_ARCH%"=="64" ( + IF %SET_SDK_64% == Y ( + ECHO Configuring Windows SDK %WINDOWS_SDK_VERSION% for Python %MAJOR_PYTHON_VERSION% on a 64 bit architecture + SET DISTUTILS_USE_SDK=1 + SET MSSdk=1 + "%WIN_SDK_ROOT%\%WINDOWS_SDK_VERSION%\Setup\WindowsSdkVer.exe" -q -version:%WINDOWS_SDK_VERSION% + "%WIN_SDK_ROOT%\%WINDOWS_SDK_VERSION%\Bin\SetEnv.cmd" /x64 /release + ECHO Executing: %COMMAND_TO_RUN% + call %COMMAND_TO_RUN% || EXIT 1 + ) ELSE ( + ECHO Using default MSVC build environment for 64 bit architecture + ECHO Executing: %COMMAND_TO_RUN% + call %COMMAND_TO_RUN% || EXIT 1 + ) +) ELSE ( + ECHO Using default MSVC build environment for 32 bit architecture + ECHO Executing: %COMMAND_TO_RUN% + call %COMMAND_TO_RUN% || EXIT 1 +) \ No newline at end of file diff --git a/tests/scripts/apt-get.sh b/ci-helpers/travis/apt-get.sh similarity index 100% rename from tests/scripts/apt-get.sh rename to ci-helpers/travis/apt-get.sh diff --git a/tests/scripts/freetds.sh b/ci-helpers/travis/freetds.sh similarity index 100% rename from tests/scripts/freetds.sh rename to ci-helpers/travis/freetds.sh diff --git a/tests/scripts/mysql_setup.sh b/ci-helpers/travis/mysql_setup.sh similarity index 100% rename from tests/scripts/mysql_setup.sh rename to ci-helpers/travis/mysql_setup.sh diff --git a/tests/scripts/postgres_setup.sh b/ci-helpers/travis/postgres_setup.sh similarity index 100% rename from tests/scripts/postgres_setup.sh rename to ci-helpers/travis/postgres_setup.sh diff --git a/tests/data/sampledb/odm_mssql.sql b/tests/data/sampledb/odm_mssql.sql new file mode 100644 index 0000000000000000000000000000000000000000..1ffa32383c66990719544a7768b8a8f3c04d0ccb GIT binary patch literal 255270 zcmeHw%Wqyuo7dUSXhtIzEN1sE_~i6QcRJ3c=Szzowc|Kx(}|sqo%C%Q%ZcAkd&Y6{ z*-pCiNgyF15E~?RY?#%sL2M8b8I zwShitydP^--*&Sd)XLf)XWM9D1HZq;|D?zj{NBNnhpOh!)PHNB$K7l#`w;)#Lx~6Y zto+Vh^!m@x{#W>%BPW&Ls-I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6T(Wj|zc25-Rrw~x0T zRpTtz G&i@BIXJ_pI literal 0 HcmV?d00001 diff --git a/tests/scripts/sampledb/odm_mysql.sql b/tests/data/sampledb/odm_mysql.sql similarity index 100% rename from tests/scripts/sampledb/odm_mysql.sql rename to tests/data/sampledb/odm_mysql.sql diff --git a/tests/scripts/sampledb/odm_postgres.sql b/tests/data/sampledb/odm_postgres.sql similarity index 100% rename from tests/scripts/sampledb/odm_postgres.sql rename to tests/data/sampledb/odm_postgres.sql diff --git a/tests/scripts/sampledb/odm_sqlite.sql b/tests/data/sampledb/odm_sqlite.sql similarity index 100% rename from tests/scripts/sampledb/odm_sqlite.sql rename to tests/data/sampledb/odm_sqlite.sql From e35d2e159080f0a3f6e6a9e7237106cb48af1777 Mon Sep 17 00:00:00 2001 From: stephanie Date: Mon, 13 Jun 2016 13:08:30 -0600 Subject: [PATCH 30/36] update appveyor.yml --- appveyor.yml | 74 +++++++++--------------------- tests/data/sampledb/odm_mssql.sql | Bin 255270 -> 254650 bytes 2 files changed, 21 insertions(+), 53 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 0dc6b54..c029fe0 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -9,7 +9,8 @@ environment: # CMD_IN_ENV: "cmd /E:ON /V:ON /C .\\appveyor\\run_with_env.cmd" CMD_IN_ENV: "cmd /E:ON /V:ON /C .\\ci-helpers/appveyor/windows_sdk.cmd" CONDA_DEPENDENCIES: "numpy matplotlib pandas pymysql scipy sqlite sqlalchemy psycopg2 wxpython" - PIP_DEPENDENCIES: "geoalchemy pyodbc" + PIP_DEPENDENCIES: "geoalchemy pyodbc pytest" + # postgres @@ -44,16 +45,12 @@ environment: - PYTHON: "C:\\Python27-conda32" PYTHON_VERSION: "2.7" PYTHON_ARCH: "32" - # CONDA_PY: "27" - # CONDA_NPY: "18" NUMPY_VERSION: "stable" - PYTHON: "C:\\Python27-conda64" PYTHON_VERSION: "2.7" PYTHON_ARCH: "64" NUMPY_VERSION: "stable" - # CONDA_PY: "27" - # CONDA_NPY: "18" # - PYTHON: "C:\\Python34-conda64" @@ -84,7 +81,7 @@ install: # Install Python (from the official .msi of http://python.org) and pip when # not already installed. # - ps: if (-not(Test-Path($env:PYTHON))) { & appveyor\install.ps1 } - - "powershell ci-helpers/appveyor/install-miniconda.ps1" + - ps: ci-helpers/appveyor/install-miniconda.ps1 # Prepend newly installed Python to the PATH of this build (this cannot be @@ -93,6 +90,7 @@ install: - "SET PATH=%PYTHON%;%PYTHON%\\Scripts;%PATH%" # add databases - "SET PATH=%POSTGRES_PATH%\bin;%MYSQL_PATH%\bin;%PATH%" + - "activate test" # Check that we have the expected version and architecture for Python - "python --version" @@ -110,22 +108,6 @@ install: # - "%CMD_IN_ENV% pip install -r requirements_tests.txt" -# now just our code -# - pip install pandas -# - pip install geoalchemy2 - - pip install . -# - pip install -r requirements_tests.txt --allow-external pyodbc --allow-unverified pyodbc - # pysqlite - - pip install pysqlite -# - dir .\tests\data\sampledb\odm_mysql.sql .\tests\data\sampledb\odm_postgres.sql -# - mysql --user root --verbose odm < .\tests\data\sampledb\odm_mysql.sql -## add -a to psql to see full log -# - psql -U postgres -f .\tests\data\sampledb\odm_postgres.sql - - -#build_script: -# # Build the compiled extension -# - "%CMD_IN_ENV% python setup.py build" build_script: # postgres - createdb odm @@ -139,35 +121,21 @@ build_script: - sqlcmd -S localhost,1433 -U sa -P Password12! -i tests\data\sampledb\odm_mssql.sql -d "odm" - sqlcmd -S localhost,1433 -U sa -P Password12! -Q "select table_name from information_schema.tables" -d "odm" -test_script: - # Run the project tests - - "%CMD_IN_ENV% python setup.py nosetests" - - -language: python -python: -# - "2.6" - - "2.7" -# - "3.2" -# - "3.3" -# - "3.4" -# - "3.5" -# - "3.5-dev" # 3.5 development branch -# - "nightly" # currently points to 3.6-dev -# command to install dependencies - -before_install: -#https://github.com/sqlectron/sqlectron-core/blob/master/appveyor.yml - - mysql -e "CREATE USER 'ODM'@'localhost' IDENTIFIED BY 'odm';GRANT ALL PRIVILEGES ON *.* TO 'ODM'@'localhost';" -uroot - - mysql -e "create database IF NOT EXISTS odm;" -uroot - - mysql -e "create database IF NOT EXISTS odmtest;" -uroot - - psql -U postgres -c "create extension postgis" - - psql -c 'DROP DATABASE IF EXISTS odmtest;' -U postgres; - - psql -c 'create database odmtest;' -U postgres; -# - psql -U postgres -d odmtest -a -f .\tests\data\sampledb\ODM2_for_PostgreSQL.sql - - psql -c 'DROP DATABASE IF EXISTS odm;' -U postgres; - - psql -c 'create database odm;' -U postgres; - # patterned after: https://github.com/ptrv/gpx2spatialite/blob/master/.travis.yml + + + +#before_install: +##https://github.com/sqlectron/sqlectron-core/blob/master/appveyor.yml +# - mysql -e "CREATE USER 'ODM'@'localhost' IDENTIFIED BY 'odm';GRANT ALL PRIVILEGES ON *.* TO 'ODM'@'localhost';" -uroot +# - mysql -e "create database IF NOT EXISTS odm;" -uroot +# - mysql -e "create database IF NOT EXISTS odmtest;" -uroot +# - psql -U postgres -c "create extension postgis" +# - psql -c 'DROP DATABASE IF EXISTS odmtest;' -U postgres; +# - psql -c 'create database odmtest;' -U postgres; +## - psql -U postgres -d odmtest -a -f .\tests\data\sampledb\ODM2_for_PostgreSQL.sql +# - psql -c 'DROP DATABASE IF EXISTS odm;' -U postgres; +# - psql -c 'create database odm;' -U postgres; +# # patterned after: https://github.com/ptrv/gpx2spatialite/blob/master/.travis.yml @@ -177,5 +145,5 @@ before_install: # command to run tests script: # just the connection part - - py.test tests/test_connection.py - - py.test + - "%CMD_IN_ENV% python setup.py tests" + diff --git a/tests/data/sampledb/odm_mssql.sql b/tests/data/sampledb/odm_mssql.sql index 1ffa32383c66990719544a7768b8a8f3c04d0ccb..d11b2dafed5166494246532cd4b5f8919c2d8cb0 100644 GIT binary patch delta 541 zcmZ2>ihtKpe&PTBLK%V?Tp1J?q8aiTQW$a>VkaL=(4Xib!V2b2W)w@Fd`FOP;uDwv zKcnfUoWBB^=L zAw78lryP>VXHI7%UNx5`h{p*H4hDtE6UFq=Twlr!Rs(g%XKrmI{UBFW@t7freC6>+ z;&t*OtNzLBiX_*}XN|;T=0|o{H@`ZP+;@IuBwoCLDH89tfcEshC(L5(NHIFOPKc+u lNU*&~kP(QPwigL9=Uj%kfBM%a%*s5x3|tKE4E_ut8UVF;kw^dl delta 640 zcmdmWlz-VNey0EbraL`iR+*?^HhB?~2(uxB;bcYr!ii@@KwMrRmm!uxfx(}_k3nIw zpo{P(#sVg|!cyj|aJE0oY&d%(tN3IEdydI`tP+e0lNGsj(Pa2o-5A_}=Ap{yVo|Hc zhHgSWn Date: Mon, 13 Jun 2016 13:12:23 -0600 Subject: [PATCH 31/36] appveyor.yml update --- appveyor.yml | 34 ++++++++++------------------------ 1 file changed, 10 insertions(+), 24 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index c029fe0..2f8b36f 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -8,7 +8,7 @@ environment: MINICONDA_VERSION: "latest" # CMD_IN_ENV: "cmd /E:ON /V:ON /C .\\appveyor\\run_with_env.cmd" CMD_IN_ENV: "cmd /E:ON /V:ON /C .\\ci-helpers/appveyor/windows_sdk.cmd" - CONDA_DEPENDENCIES: "numpy matplotlib pandas pymysql scipy sqlite sqlalchemy psycopg2 wxpython" + CONDA_DEPENDENCIES: "numpy matplotlib pandas pymysql scipy sqlite sqlalchemy psycopg2 wxpython pip" PIP_DEPENDENCIES: "geoalchemy pyodbc pytest" @@ -45,12 +45,16 @@ environment: - PYTHON: "C:\\Python27-conda32" PYTHON_VERSION: "2.7" PYTHON_ARCH: "32" + # CONDA_PY: "27" + # CONDA_NPY: "18" NUMPY_VERSION: "stable" - PYTHON: "C:\\Python27-conda64" PYTHON_VERSION: "2.7" PYTHON_ARCH: "64" NUMPY_VERSION: "stable" + # CONDA_PY: "27" + # CONDA_NPY: "18" # - PYTHON: "C:\\Python34-conda64" @@ -98,7 +102,7 @@ install: # Upgrade to the latest version of pip to avoid it displaying warnings # about it being out of date. - - "pip install --disable-pip-version-check --user --upgrade pip" +# - "pip install --disable-pip-version-check --user --upgrade pip" # Install the build dependencies of the project. If some dependencies contain # compiled extensions and are not provided as pre-built wheel packages, @@ -109,6 +113,7 @@ install: build_script: +##https://github.com/sqlectron/sqlectron-core/blob/master/appveyor.yml # postgres - createdb odm - psql -d odm -a -f tests\data\sampledb\odm_postgres.sql @@ -121,29 +126,10 @@ build_script: - sqlcmd -S localhost,1433 -U sa -P Password12! -i tests\data\sampledb\odm_mssql.sql -d "odm" - sqlcmd -S localhost,1433 -U sa -P Password12! -Q "select table_name from information_schema.tables" -d "odm" +test_script: + # Run the project tests + - "%CMD_IN_ENV% python setup.py tests" -#before_install: -##https://github.com/sqlectron/sqlectron-core/blob/master/appveyor.yml -# - mysql -e "CREATE USER 'ODM'@'localhost' IDENTIFIED BY 'odm';GRANT ALL PRIVILEGES ON *.* TO 'ODM'@'localhost';" -uroot -# - mysql -e "create database IF NOT EXISTS odm;" -uroot -# - mysql -e "create database IF NOT EXISTS odmtest;" -uroot -# - psql -U postgres -c "create extension postgis" -# - psql -c 'DROP DATABASE IF EXISTS odmtest;' -U postgres; -# - psql -c 'create database odmtest;' -U postgres; -## - psql -U postgres -d odmtest -a -f .\tests\data\sampledb\ODM2_for_PostgreSQL.sql -# - psql -c 'DROP DATABASE IF EXISTS odm;' -U postgres; -# - psql -c 'create database odm;' -U postgres; -# # patterned after: https://github.com/ptrv/gpx2spatialite/blob/master/.travis.yml - - - -# don't forget to open up the azure mssql server to these addreses -# https://docs.travis-ci.com/user/ip-addresses/ - -# command to run tests -script: -# just the connection part - - "%CMD_IN_ENV% python setup.py tests" From 118bbf9f9234ea38d2cf1420b40ec5d13de0ac47 Mon Sep 17 00:00:00 2001 From: stephanie Date: Mon, 13 Jun 2016 13:19:20 -0600 Subject: [PATCH 32/36] update script for pip dependencies and postgres db creation- appveyor --- appveyor.yml | 6 +++--- ci-helpers/appveyor/install-miniconda.ps1 | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 2f8b36f..40d9ccb 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -8,8 +8,8 @@ environment: MINICONDA_VERSION: "latest" # CMD_IN_ENV: "cmd /E:ON /V:ON /C .\\appveyor\\run_with_env.cmd" CMD_IN_ENV: "cmd /E:ON /V:ON /C .\\ci-helpers/appveyor/windows_sdk.cmd" - CONDA_DEPENDENCIES: "numpy matplotlib pandas pymysql scipy sqlite sqlalchemy psycopg2 wxpython pip" - PIP_DEPENDENCIES: "geoalchemy pyodbc pytest" + CONDA_DEPENDENCIES: "numpy matplotlib pandas pymysql scipy sqlite sqlalchemy wxpython pip" + PIP_DEPENDENCIES: "geoalchemy pyodbc pytest psycopg2" @@ -115,7 +115,7 @@ install: build_script: ##https://github.com/sqlectron/sqlectron-core/blob/master/appveyor.yml # postgres - - createdb odm + - psql createdb odm - psql -d odm -a -f tests\data\sampledb\odm_postgres.sql # mysql - mysql -e "drop database test; create database odm;" --user=root diff --git a/ci-helpers/appveyor/install-miniconda.ps1 b/ci-helpers/appveyor/install-miniconda.ps1 index 25c3ff2..f0017cd 100644 --- a/ci-helpers/appveyor/install-miniconda.ps1 +++ b/ci-helpers/appveyor/install-miniconda.ps1 @@ -181,7 +181,7 @@ if ($env:PIP_FLAGS) { } if ($env:PIP_DEPENDENCIES) { - $PIP_DEPENDENCIES = $env:PIP_DEPENDENCIES + $PIP_DEPENDENCIES = $env:PIP_DEPENDENCIES.split(" ") } else { $PIP_DEPENDENCIES = "" } From 18d77ea870ba8bbd26d626c15ded67983cb4c549 Mon Sep 17 00:00:00 2001 From: stephanie Date: Mon, 13 Jun 2016 13:28:59 -0600 Subject: [PATCH 33/36] update path to mysql and psql --- appveyor.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 40d9ccb..1f57074 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -18,7 +18,7 @@ environment: POSTGRES_ENV_POSTGRES_USER: postgres POSTGRES_ENV_POSTGRES_PASSWORD: Password12! POSTGRES_ENV_POSTGRES_DB: odm - POSTGRES_PATH: C:\Program Files\PostgreSQL\9.4 + POSTGRES_PATH: C:\Program Files\PostgreSQL\9.4\bin PGUSER: postgres PGPASSWORD: Password12! # mysql @@ -26,7 +26,7 @@ environment: MYSQL_ENV_MYSQL_USER: root MYSQL_ENV_MYSQL_PASSWORD: Password12! MYSQL_ENV_MYSQL_DATABASE: odm - MYSQL_PATH: C:\Program Files\MySql\MySQL Server 5.6 + MYSQL_PATH: C:\Program Files\MySql\MySQL Server 5.6\bin MYSQL_PWD: Password12! # sql server SQLSERVER_ENV_SQLSERVER_HOST: localhost From 462e9243a239571ad7900b1c122cf16349b535cf Mon Sep 17 00:00:00 2001 From: stephanie Date: Mon, 13 Jun 2016 13:33:58 -0600 Subject: [PATCH 34/36] appveyor switch to only using mssql --- appveyor.yml | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 1f57074..bd39a1a 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -114,17 +114,18 @@ install: build_script: ##https://github.com/sqlectron/sqlectron-core/blob/master/appveyor.yml - # postgres - - psql createdb odm - - psql -d odm -a -f tests\data\sampledb\odm_postgres.sql - # mysql - - mysql -e "drop database test; create database odm;" --user=root - - mysql odm < tests\data\sampledb\odm_mysql.sql --user=root + # sqlserver - ps: ci-helpers\appveyor\sqlserver.ps1 SQL2008R2SP2 - sqlcmd -S localhost,1433 -U sa -P Password12! -Q "CREATE DATABASE odm" -d "master" - sqlcmd -S localhost,1433 -U sa -P Password12! -i tests\data\sampledb\odm_mssql.sql -d "odm" - sqlcmd -S localhost,1433 -U sa -P Password12! -Q "select table_name from information_schema.tables" -d "odm" +# # postgres +# - psql createdb odm +# - psql -d odm -a -f tests\data\sampledb\odm_postgres.sql +# # mysql +# - mysql -e "drop database test; create database odm;" --user=root +# - mysql odm < tests\data\sampledb\odm_mysql.sql --user=root test_script: # Run the project tests From 234d9813102e85420f71de5569e27b53df958896 Mon Sep 17 00:00:00 2001 From: stephanie Date: Mon, 13 Jun 2016 13:48:58 -0600 Subject: [PATCH 35/36] update script to run py.test - appveyor --- appveyor.yml | 2 +- tests/data/sampledb/odm_mssql.sql | Bin 254650 -> 253526 bytes 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index bd39a1a..38b701b 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -129,7 +129,7 @@ build_script: test_script: # Run the project tests - - "%CMD_IN_ENV% python setup.py tests" + - "py.test" diff --git a/tests/data/sampledb/odm_mssql.sql b/tests/data/sampledb/odm_mssql.sql index d11b2dafed5166494246532cd4b5f8919c2d8cb0..a83bdfdeb20939c012f4dfca6afb3f52a2471933 100644 GIT binary patch delta 43 ycmdmWl>gcuey0EbraL`iR@taVkaj`>TmQ|#Wy)mQb{gbgAb794ixi4l2c%C0b1zB;0RRX z15_0cbbvEZk1K;OP|OzSkQ9a_pku%e5kz)?KTxMHy7gc|u;p$*%Ro*-wlo?j2GoS& zI3gV|dE-uL`yilxA87c1oD~mrSUE!;I7~nub_AO40;GMx&UXTmD1ibp!xPht6oy2G z5+E)Dnv)3hE+~X4H?16KN+!@;5=^tjbQ^L01BWWeckY-bkm@_QS$INVY YCkJejYWCr8_u*#*Vy5jr{LEbE0S;x4!2kdN From 2bb8c9e4dccccea17a72969c67fbd0000c386bea Mon Sep 17 00:00:00 2001 From: stephanie Date: Mon, 13 Jun 2016 14:24:58 -0600 Subject: [PATCH 36/36] comment out freetds test --- appveyor.yml | 10 ---------- tests/test_odmdata/test_FreeTDS.py | 4 ++-- 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 38b701b..7c426ab 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -100,16 +100,6 @@ install: - "python --version" - "python -c \"import struct; print(struct.calcsize('P') * 8)\"" - # Upgrade to the latest version of pip to avoid it displaying warnings - # about it being out of date. -# - "pip install --disable-pip-version-check --user --upgrade pip" - - # Install the build dependencies of the project. If some dependencies contain - # compiled extensions and are not provided as pre-built wheel packages, - # pip will build them from source using the MSVC compiler matching the - # target Python version and architecture - #- "%CMD_IN_ENV% pip install -r dev-requirements.txt" -# - "%CMD_IN_ENV% pip install -r requirements_tests.txt" build_script: diff --git a/tests/test_odmdata/test_FreeTDS.py b/tests/test_odmdata/test_FreeTDS.py index c98164d..ab597cc 100644 --- a/tests/test_odmdata/test_FreeTDS.py +++ b/tests/test_odmdata/test_FreeTDS.py @@ -36,5 +36,5 @@ def setup(self): print engine - def test_connection(self): - pass + # def test_connection(self): + # pass