Skip to content

Commit

Permalink
Merge #67
Browse files Browse the repository at this point in the history
67: Restore additional tests r=ibacher a=ibacher



Co-authored-by: Ian <ian_bacher@brown.edu>
  • Loading branch information
bors[bot] and ibacher committed Jul 26, 2019
2 parents 1e818dc + 87daac5 commit 84e0863
Show file tree
Hide file tree
Showing 8 changed files with 59 additions and 33 deletions.
31 changes: 19 additions & 12 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,35 +22,42 @@ notifications:
sudo: false

addons:
mariadb: '10.4'
# mariadb: '10.0'
homebrew:
packages:
- mariadb
update: true

script:
services:
- mysql

before_script:
- if [ "$TRAVIS_OS_NAME" == "osx" ]; then . ./ci/travis/before_install-osx.sh; fi
- export OLD_PATH=$LD_LIBRARY_PATH
- export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:`mariadb_config --libs | cut -d ' ' -f1 | sed 's/-L//'`
after_script:
- export LD_LIBRARY_PATH=$OLD_PATH
- unset OLD_PATH
- export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:`mysql_config --libs | cut -d ' ' -f1 | sed 's/-L//'`

after_success:
- julia -e 'import Pkg; Pkg.instantiate(); Pkg.add("Coverage"); using Coverage; Codecov.submit(Codecov.process_folder())'

matrix:
allow_failures:
- julia: 1.2

jobs:
- stage: tests
include:
- stage: test
os: osx
julia: 1.1
env: GROUP=Test
script:
- julia -e 'import Pkg; Pkg.build(); Pkg.test(coverage=false);'
after_success: skip
- stage: examples
- stage: example
os: linux
julia: 1.1
env: GROUP=Examples
script:
- julia -e 'import Pkg; Pkg.instantiate(); include(joinpath(@__DIR__, "examples", "runexamples.jl"))'
- stage: deploy documentation
julia: 1.1
os: linux
script:
- julia -e 'import Pkg; Pkg.instantiate(); Pkg.add("Documenter"); include(joinpath("docs", "make.jl"))'
- julia -e 'import Pkg; Pkg.instantiate(); Pkg.add("Documenter"); Pkg.add("Literate"); include(joinpath("docs", "make.jl"))'
after_success: skip
7 changes: 4 additions & 3 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "BioMedQuery"
uuid = "e96904bf-1073-5077-9b57-b0ce0ff5555a"
author = ["Brown Center for Biomedical Informatics"]
version = '0.6.4'
version = "0.6.5"

[deps]
BioServices = "a0d4ced5-b29c-5395-b614-ca030a679c4b"
Expand All @@ -19,11 +19,12 @@ SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
XMLDict = "228000da-037f-5747-90a9-8195ccbf91a5"

[compat]
julia = ">=0.7"
julia = ">=1.0"

[extras]
MbedTLS = "739be429-bea8-5141-9913-cc70e7f3736d"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
ZipFile = "a5390f91-8eb1-5f08-bee0-b1d1ffed6cea"

[targets]
test = ["Test", "ZipFile"]
test = ["MbedTLS", "Test", "ZipFile"]
10 changes: 7 additions & 3 deletions ci/travis/before_install-osx.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,12 @@ echo Running before_install-osx.sh...
echo "------------------------------------------"

# Install and start MySQL on OSX
echo ">>> brew install mariadb"
brew update
brew install mariadb
echo ">>> configure mariadb"
mkdir -p /usr/local/etc/my.cnf.d
echo "[mysqld]" > $HOME/.my.cnf
echo "secure_file_priv = \"\" ">> $HOME/.my.cnf
echo "default_authentication_plugin = mysql_native_password" >> $HOME/.my.cnf
echo "local_infile = 1" >> $HOME/.my.cnf

echo ">>> mysql.server start"
mysql.server start
4 changes: 2 additions & 2 deletions src/DBUtils/mysql_db_utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ Create a MySQL database using the code inside mysql_code
"""
function init_mysql_database(host="127.0.0.1",
user="root", pwd="", dbname="test"; overwrite=false, opts = Dict())
user="root", pswd="", dbname="test"; overwrite=false, opts = Dict())

opts[MySQL.API.MYSQL_SET_CHARSET_NAME] = "utf8mb4"

con = MySQL.connect(host, user, pwd, opts=opts)
con = MySQL.connect(host, user, pswd, opts=opts)

init_mysql_database(con, dbname, overwrite)
end
Expand Down
2 changes: 1 addition & 1 deletion test/dbutils_mysql.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ using MySQL

dbname="pubmed_test"

conn = DBUtils.init_mysql_database("127.0.0.1", "root", "", dbname)
conn = DBUtils.init_mysql_database(MYSQL_HOST, MYSQL_USER, MYSQL_PASSWORD, dbname)
PubMed.create_tables!(conn)

println(conn)
Expand Down
6 changes: 3 additions & 3 deletions test/processes_mysql.jl
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ const verbose = false


#************************ MYSQL **********************************************
const host="127.0.0.1" #If want to hide - use enviroment variables instead
const mysql_usr="root"
const mysql_pswd=""
const host=MYSQL_HOST #If want to hide - use enviroment variables instead
const mysql_usr=MYSQL_USER
const mysql_pswd=MYSQL_PASSWORD
const dbname="pubmed_processes_test"
const dbname_pmid ="pmid_processes_test"
const medline_file = 1
Expand Down
16 changes: 8 additions & 8 deletions test/pubmed.jl
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,11 @@ import Base.parse
println("-----------------------------------------")
println(" Test Save PMID MySQL ")
dbname = "entrez_test"
host = "127.0.0.1";
user = "root"
pwd = ""
host = MYSQL_HOST
user = MYSQL_USER
pswd = MYSQL_PASSWORD

conn = DBUtils.init_mysql_database(host, user, pwd, dbname)
conn = DBUtils.init_mysql_database(host, user, pswd, dbname)
PubMed.create_pmid_table!(conn)
PubMed.save_pmids!(conn, ids)

Expand All @@ -78,11 +78,11 @@ import Base.parse
println(" Testing MySQL Saving")

dbname = "efetch_test"
host = "127.0.0.1";
user = "root"
pwd = ""
host = MYSQL_HOST
user = MYSQL_USER
pswd = MYSQL_PASSWORD

conn = DBUtils.init_mysql_database(host, user, pwd, dbname)
conn = DBUtils.init_mysql_database(host, user, pswd, dbname)
PubMed.create_tables!(conn)
@time PubMed.save_efetch!(conn, efetch_doc, false, true)

Expand Down
16 changes: 15 additions & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ using MySQL
using SQLite
using DataStreams


#For now this corresponds to JULIACIBot... since we aren't testing anywhere else
global CI = get(ENV, "CI", "false")=="true"
global TRAVIS = get(ENV, "TRAVIS", "false")=="true"
Expand All @@ -39,6 +38,21 @@ all_tests = [
("processes_df.jl", " Testing: Processes DataFrame")
]
if !CI_SKIP_MYSQL
# on MacOS host name must be localhost
if Sys.isapple()
global const MYSQL_HOST = "localhost"
else
global const MYSQL_HOST = "127.0.0.1"
end

if Sys.isapple()
global const MYSQL_USER = get(ENV, "MYSQL_USER", get(ENV, "LOGNAME", "root"))
else
global const MYSQL_USER = get(ENV, "MYSQL_USER", "root")
end

global const MYSQL_PASSWORD = get(ENV, "MYSQL_PASSWORD", "")

push!(all_tests, ("dbutils_mysql.jl", " Testing: DBUtils MySQL"))
push!(all_tests, ("processes_mysql.jl", " Testing: Processes MySQL"))
end
Expand Down

0 comments on commit 84e0863

Please sign in to comment.