Fix the tests

This commit is contained in:
Javier Goizueta
2016-02-17 11:46:29 +01:00
parent 43aa7ac977
commit 3ded7da1d8
10 changed files with 33 additions and 9 deletions
+17
View File
@@ -59,3 +59,20 @@ the extension) with `_cdb_`.
# Python
...
## Testing
Running the Python tests:
```
nosetests python/crankdown/test
```
Installing the Python package and running the PostgreSQL tests:
```
sudo pip install python/crankdown --upgrade
cd pg
sudo make install
make installcheck
```
+2 -2
View File
@@ -1,3 +1,3 @@
test/regression.diffs
test/regression.out
regression.diffs
regression.out
test/results
+2 -2
View File
@@ -17,6 +17,6 @@ RETURNS TABLE (
)
AS $$
from crankshaft.clustering import moran_local
-- TODO: use named parameters or a dictionary
# TODO: use named parameters or a dictionary
return moran_local(t, attr, significance, num_ngbrs, permutations, geom_column, id_col, w_type)
$$ LANGUAGE plpython2u;
$$ LANGUAGE plpythonu;
@@ -1,4 +1,5 @@
-- Install dependencies
CREATE EXTENSION plpythonu;
CREATE EXTENSION postgis;
-- Install the extension
CREATE EXTENSION crankshaft;
+3 -1
View File
@@ -1,6 +1,8 @@
SELECT cdb_crankshaft.cdb_poc_xyz();
NOTICE: XYZ...
CONTEXT: PL/Python function "cdb_poc_xyz"
cdb_poc_xyz
-------------
xyz-result
83
(1 row)
@@ -1,4 +1,5 @@
-- Install dependencies
CREATE EXTENSION plpythonu;
CREATE EXTENSION postgis;
-- Install the extension
CREATE EXTENSION crankshaft;
+3 -1
View File
@@ -1,6 +1,8 @@
SELECT cdb_crankshaft.cdb_poc_xyz();
NOTICE: XYZ...
CONTEXT: PL/Python function "cdb_poc_xyz"
cdb_poc_xyz
-------------
xyz-result
83
(1 row)
+1
View File
@@ -1,5 +1,6 @@
-- Install dependencies
CREATE EXTENSION plpythonu;
CREATE EXTENSION postgis;
-- Install the extension
CREATE EXTENSION crankshaft;
+2 -2
View File
@@ -2,5 +2,5 @@ import plpy
def xyz():
plpy.notice('XYZ...')
r = plpy.execute("SELECT * FROM table")
return r[0]['x']
r = plpy.execute("select * from pg_class where relname='pg_class'")
return r[0]['reltype']
+1 -1
View File
@@ -18,6 +18,6 @@ class TestPoc(unittest.TestCase):
plpy._reset()
def test_should_have_xyz(self):
plpy._define_result('select\s+\*\s+from\s+table', [{'x': 111}])
plpy._define_result('select.*from\s+pg_class', [{'reltype': 111}])
assert crankshaft.poc.xyz() == 111
assert plpy.notices[0] == 'XYZ...'