Repository: SINTEF/dlite (language: python)

Issue:
Enabling postgresql tests
Add documentation for how to start a postgresql server and enable the tests.


Discussion / hints:

Fix patch:
diff --git a/storages/python/README.md b/storages/python/README.md
index be51e206f..afd4bc581 100644
--- a/storages/python/README.md
+++ b/storages/python/README.md
@@ -60,3 +60,70 @@ Python storage plugins provided with DLite can be found in the
 
 See the [YAML plugin](python-storage-plugins/yaml_plugin.py) for a
 simple example of a working storage plugin.
+
+
+
+Plugins
+=======
+
+yaml
+----
+Generic plugin for reading and writing to file in YAML format.
+
+
+bson
+----
+Generic plugin for reading and writing to file in BSON format.
+
+
+pyrdf
+-----
+Generic plugin for reading and writing to file in RDF format.  It uses
+rdflib. The plugin is called pyrdf to not confuse with the rdf plugin
+implemented in C (using Redland librdf).
+
+
+csv
+---
+Read and write to file in tabular CSV format.  The metadata for CSV
+files should have only one dimension shared by all properties.
+
+
+blob
+----
+Specialised plugin for reading and writing a binary blob to file.  The
+content is specified using the metadata
+http://onto-ns.com/meta/0.1/Blob (defined in the json file
+[$DLITE_SOURCE_DIR/storages/python/python-storage-plugins/blob.json](https://github.com/SINTEF/dlite/blob/master/storages/python/python-storage-plugins/blob.json)). 
+It will be installed in the default metadata search path and seamless
+accessible.
+
+
+postgresql
+----------
+Generic plugin for reading and writing to a PostgreSQL database.
+
+See https://docs.fedoraproject.org/en-US/quick-docs/postgresql/ for how to
+install and setup a postgresql server on Fedora.
+
+The test_postgresql_storage test require local configurations of the
+PostgreSQL server.  The test is only enabled if a file pgconf.h can be
+found in the [tests-c/](tests-c/) sub-directory with the following content:
+
+    #define HOST "pg_server_host"
+    #define USER "my_username"
+    #define DATABASE "my_database"
+    #define PASSWORD "my_password"
+
+Depending on how the server is set up, or if you have a ~/.pgpass
+file, PASSWORD can be left undefined.
+
+For running the tests, you may also have to run an ident server
+running.  Install it with
+
+    sudo dnf install oidentd
+
+and start it with
+
+    sudo systemctl start oidentd.service   # start now
+    sudo systemctl enable oidentd.service  # start automatically when booting


Test patch:
diff --git a/storages/python/tests-c/test_postgresql_storage.c b/storages/python/tests-c/test_postgresql_storage.c
index fb3b24fd6..8318f7514 100644
--- a/storages/python/tests-c/test_postgresql_storage.c
+++ b/storages/python/tests-c/test_postgresql_storage.c
@@ -53,11 +53,11 @@ MU_TEST(test_save)
   }
 
   n = inst->_refcount;
-  mu_assert_int_eq(2, n);
+  mu_assert_int_eq(1, n);
   for (i=0; i<n; i++) dlite_instance_decref(inst);
 
   n = meta->_refcount;
-  mu_assert_int_eq(3, n);
+  mu_assert_int_eq(2, n);
   for (i=0; i<n; i++) dlite_instance_decref(meta);
 }