changeset 2178:dc126c757dbe

import test for rdfdb
author drewp@bigasterisk.com
date Fri, 19 May 2023 14:40:49 -0700
parents 9036ebf37b04
children 96e1f63202ad
files bin/rdfdb light9/rdfdb/service.py light9/rdfdb/service_test.py light9/rdfdb_setup.py
diffstat 4 files changed, 37 insertions(+), 28 deletions(-) [+]
line wrap: on
line diff
--- a/bin/rdfdb	Fri May 19 14:40:30 2023 -0700
+++ b/bin/rdfdb	Fri May 19 14:40:49 2023 -0700
@@ -1,4 +1,4 @@
 #!/bin/zsh
 #pnpm exec vite -c light9/ascoltami/vite.config.ts &
-pdm run uvicorn --port 8209 light9.rdfdb_setup:app --no-access-log
+pdm run uvicorn --port 8209 light9.rdfdb.service:app --no-access-log
 wait
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/light9/rdfdb/service.py	Fri May 19 14:40:49 2023 -0700
@@ -0,0 +1,25 @@
+import logging
+import os
+from pathlib import Path
+
+import rdfdb.service
+from rdflib import URIRef
+
+from light9 import showconfig
+from light9.run_local import log
+
+rdfRoot = Path(os.environ['LIGHT9_SHOW'].rstrip('/') + '/')
+showUri = URIRef(showconfig.showUri() + '/')
+
+app = rdfdb.service.makeApp(  #
+    dirUriMap={rdfRoot: showUri},
+    prefixes={
+        'show': showUri,
+        '': URIRef('http://light9.bigasterisk.com/'),
+        'rdf': URIRef('http://www.w3.org/1999/02/22-rdf-syntax-ns#'),
+        'rdfs': URIRef('http://www.w3.org/2000/01/rdf-schema#'),
+        'xsd': URIRef('http://www.w3.org/2001/XMLSchema#'),
+        'effect': URIRef('http://light9.bigasterisk.com/effect/'),
+        'dev': URIRef('http://light9.bigasterisk.com/theater/skyline/device/'),
+    })
+log.info('made app')
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/light9/rdfdb/service_test.py	Fri May 19 14:40:49 2023 -0700
@@ -0,0 +1,11 @@
+import asyncio
+from light9.run_local import log
+
+
+def test_import():
+
+    async def go():
+        # this sets up some watcher tasks
+        from service import app
+
+    asyncio.run(go(), debug=True)
--- a/light9/rdfdb_setup.py	Fri May 19 14:40:30 2023 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,27 +0,0 @@
-#!bin/python
-from light9.run_local import log
-import logging
-log = logging.getLogger('rdfdb_setup')
-import os
-from pathlib import Path
-
-import rdfdb.service
-from rdflib import URIRef
-
-from light9 import showconfig
-
-rdfRoot = Path(os.environ['LIGHT9_SHOW'].rstrip('/') + '/')
-showUri = URIRef(showconfig.showUri() + '/')
-
-app = rdfdb.service.makeApp(  #
-    dirUriMap={rdfRoot: showUri},
-    prefixes={
-        'show': showUri,
-        '': URIRef('http://light9.bigasterisk.com/'),
-        'rdf': URIRef('http://www.w3.org/1999/02/22-rdf-syntax-ns#'),
-        'rdfs': URIRef('http://www.w3.org/2000/01/rdf-schema#'),
-        'xsd': URIRef('http://www.w3.org/2001/XMLSchema#'),
-        'effect': URIRef('http://light9.bigasterisk.com/effect/'),
-        'dev': URIRef('http://light9.bigasterisk.com/theater/skyline/device/'),
-    })
-log.info('made app')
\ No newline at end of file