Skip to content

Commit c93c449

Browse files
committed
Merge branch 'ci-tests'
2 parents 3de4264 + 586800e commit c93c449

File tree

8 files changed

+55
-14
lines changed

8 files changed

+55
-14
lines changed

.travis.yml

+23
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,33 @@ os:
44
- osx
55
git:
66
depth: 1
7+
8+
before_install:
9+
- if [ $TRAVIS_OS_NAME = osx ]; then brew outdated pyenv || brew upgrade pyenv ; export PYTHON_CONFIGURE_OPTS="--enable-framework" ; fi
10+
- PY=$(pyenv install --list | grep -v - |grep -v [a-z]|grep -e '^ 3\.5\..*'|tail -1)
11+
- pyenv install $PY && pyenv local $PY
712
script:
13+
- if [ $TRAVIS_OS_NAME = osx ]; then pyenv init - > pyenv.init && source pyenv.init ; fi
14+
- if [ $TRAVIS_OS_NAME = linux ]; then QLIBDIR=l64;OD=$L64; elif [ $TRAVIS_OS_NAME = osx ]; then QLIBDIR=m64;OD=$M64; else echo "unknown OS ('$TRAVIS_OS_NAME')" >&2; exit 1; fi; export QLIBDIR
15+
- mkdir q && export QHOME=$(pwd)/q && export PATH=$QHOME/$QLIBDIR:$PATH
16+
- if [[ "x$OD" != "x" ]]; then
17+
curl -o q/q.zip -L $OD;
18+
unzip -d q q/q.zip;
19+
else
20+
echo No kdb+;
21+
fi
822
- make p.so
23+
- cp [ml]64/p.so q/$QLIBDIR;
924
- echo "Preparing version $TRAVIS_BRANCH-$TRAVIS_COMMIT"
1025
- tar czf embedPy_$TRAVIS_OS_NAME-$TRAVIS_BRANCH.tgz p.q p.k test.q tests [ml]64/p.so LICENSE README.md
1126
- echo "Packaged as embedPy_$TRAVIS_OS_NAME-$TRAVIS_BRANCH.zip"
27+
- if [[ "x$QLIC_KC" != "x" ]]; then
28+
echo -n $QLIC_KC |base64 --decode > q/kc.lic;
29+
pip3 -q install -r tests/requirements.txt;
30+
q test.q -q;
31+
else
32+
echo No kdb+, no tests;
33+
fi
1234
compiler:
1335
- clang
1436
deploy:
@@ -25,6 +47,7 @@ jobs:
2547
sudo: required
2648
services:
2749
- docker
50+
before_install: skip
2851
script:
2952
- docker build -t kxsys/embedpy:latest -f docker/Dockerfile .
3053
- docker tag kxsys/embedpy:latest kxsys/embedpy:$TRAVIS_BRANCH

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Please [report issues](https://github.com/KxSystems/embedpy/issues) in this repo
1212
## Requirements
1313

1414
- kdb+ >=3.5 64-bit
15-
- Anaconda Python 3.x
15+
- Anaconda Python >=3.5.0
1616

1717
## Installation
1818
### Download

makefile

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
QHOME=$(shell echo '-1 getenv`QHOME;'|q -q)
21
CFLAGS=-ggdb3 -O2 -Wno-pointer-sign -Wno-parentheses
32
ifeq ($(shell uname),Linux)
43
LDFLAGS=-fPIC -shared

test.q

+11-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
\l p.q
2-
.t.n:0
3-
.t.e:{v:@[value;x;0b];if[not (1b~v)|(::)~v;-1 x;.t.n+:1]}
4-
system each "l ",/:$[count .z.x;.z.x;"tests/",/:string til`:tests];
5-
if[.t.n;-2"failed ",string[.t.n]," ",(neg .t.n=1)_"tests";exit 1]
2+
\d .t
3+
n:ne:nf:0
4+
pt:{-2 $[first[x]~`..err;err;fail][x;y]}
5+
i:{` sv" ",/:` vs x}
6+
ge:{v:.Q.trp[x;y;{(`..err;x,"\n",.Q.sbt 1#y)}];n+:1;if[not(1b~v)|(::)~v;pt[v](y;file)]}
7+
e:ge value;.p.e:ge .p.e
8+
err:{ne+:1;"ERROR:\n test:\n",i[y 0]," message:\n",i[x 1]," file:\n",i y 1}
9+
fail:{nf+:1;"FAIL:\n test:\n",i[y 0]," result:\n",i[.Q.s x]," file:\n",i y 1}
10+
{file::x;system"l ",x}each $[count .z.x;.z.x;"tests/",/:string u@:where(u:til`:tests)like"*.t"];
11+
tn:{`$(0-x=1)_"tests"}
12+
if[ne+nf;-2" "sv string(`failed;nf;tn nf;`errored;ne;tn ne;n;`total;tn n);exit 1]
613
\\

tests/matplotlib.t

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
/ https://github.com/JuliaPy/PyPlot.jl/issues/278
22
if[count r:@[read0;`$.p.import[`sys;`:exec_prefix;`],"/qt.conf";""];.p.import[`os;`:putenv;`QT_PLUGIN_PATH;(trim(1+r?"=")_ r:first r where r like"Prefix*"),"/plugins"]]
3+
p)import matplotlib as mpl
4+
p)mpl.use('Agg')
35
p)import matplotlib.pyplot as plt
46
.p.set[`x]x:til[50]%50
57
.p.set[`y]sin[4*x*4*atan 1]*exp -5*x

tests/memory.t

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ a:til 100;
44
.p.set[`bbb]a;
55
initmem:pmem[];
66
do[10000;.p.set[`bbb]a];
7-
initmem=pmem[]
7+
10000>abs initmem-pmem[]
88
initmem:pmem[];
99
.p.set[`bbb]{.z.s,x+y};
10-
initmem~{do[100000;.p.set[`bbb]{.z.s,x+y}];pmem[]}[]
10+
10000>abs initmem-{do[100000;.p.set[`bbb]{.z.s,x+y}];pmem[]}[]
1111
a:.p.eval"bbb(10,11)";
1212
initmem:pmem[];
13-
initmem~{do[100000;.p.eval"bbb(10,11)"];pmem[]}[]
13+
10000>abs initmem-{do[100000;.p.eval"bbb(10,11)"];pmem[]}[]
1414
do[10000;.p.q2py 1b];
1515
do[10000;.p.q2py(::)];

tests/pandas.t

+9-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
1-
df:.p.import[`pandas]`:DataFrame
2-
qt2df:{df flip x}
3-
df2qt:{flip{.p.wrap[x][`:values]`}each x[`:to_dict;"series"]`}
4-
x:([]c1:1 2 3;c2:1.5 2.5 3.5)
5-
x~df2qt qt2df x
1+
tab2df:{
2+
r:.p.import[`pandas;`:DataFrame.from_dict;flip 0!x][@;cols x];
3+
$[count k:keys x;r[`:set_index]k;r]}
4+
df2tab:{
5+
n:$[.p.isinstance[x`:index;.p.import[`pandas]`:RangeIndex]`;0;x[`:index.nlevels]`];
6+
n!raze[`$$[n;x[`:index.names]`;0#`],x[`:columns.values]`]xcols flip$[n;x[`:reset_index][];x][`:to_dict;`list]`}
7+
k:1!`c3`c2`c1 xcols x:([]c1:1 2 3;c2:("one";"two";"three");c3:1.5 2.5 3.5)
8+
x~df2tab tab2df x
9+
k~df2tab tab2df k

tests/requirements.txt

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
numpy
2+
beautifulsoup4
3+
pandas
4+
tensorflow
5+
scipy
6+
matplotlib

0 commit comments

Comments
 (0)