get paths to test files (config and database) from source code path

This commit is contained in:
Helmut Merz 2024-06-01 10:41:28 +02:00
parent 2a29b0bd9c
commit 99b1627bfa
2 changed files with 7 additions and 4 deletions

View file

@ -2,10 +2,11 @@
;;; use: `(load "test/...")` from package scopes/test-storage ;;; use: `(load "test/...")` from package scopes/test-storage
(defparameter db-config-sqlite (defparameter db-config-sqlite
'(:backend :dbi `(:backend :dbi
:db-type :sqlite3 :db-type :sqlite3
:connect-args :connect-args
(:database-name "test/test.db") (:database-name
,(str:concat (namestring (asdf:system-source-directory :scopes)) "test/test.db"))
:options nil)) :options nil))
(setf scopes/test-storage:*db-config-test* db-config-sqlite) (setf scopes/test-storage:*db-config-test* db-config-sqlite)

View file

@ -14,19 +14,21 @@
(in-package :scopes/test-storage) (in-package :scopes/test-storage)
(defparameter *db-config-test* nil) (defparameter *db-config-test* nil)
(defparameter *config-source*
(str:concat (namestring (asdf:system-source-directory :scopes)) "test/config-"))
(defun run-all () (defun run-all ()
(run-sqlite) (run-sqlite)
(run-postgres)) (run-postgres))
(defun run-sqlite () (defun run-sqlite ()
(load "test/config-sqlite") (load (str:concat *config-source* "sqlite"))
(let ((storage:*db-config* *db-config-test*) (let ((storage:*db-config* *db-config-test*)
(t:*test-suite* (t:test-suite "sqlite"))) (t:*test-suite* (t:test-suite "sqlite")))
(run))) (run)))
(defun run-postgres () (defun run-postgres ()
(load "test/config-postgres") (load (str:concat *config-source* "postgres"))
(let ((storage:*db-config* *db-config-test*) (let ((storage:*db-config* *db-config-test*)
(t:*test-suite* (t:test-suite "postgres"))) (t:*test-suite* (t:test-suite "postgres")))
(run))) (run)))