ndwarshuis / org-sql

SQL backend for Emacs Org-Mode
GNU General Public License v3.0
97 stars 9 forks source link

Running stateful tests throws error 'Lexical binding is not enabled' #24

Closed aviav closed 3 weeks ago

aviav commented 1 month ago

It's strange to me that this happens, because the top of org-sql-test-stateful.el has -*- lexical-binding: t; -*-, and because stateless tests run successfully.

The error occurs for me on current master regardless of whether I run make stateful, make compile, or make test. The Docker Compose setup is running.

The change I plan to make doesn't directly interact with the database, but in case this happens because of a regression, and not because of user error, I think it's better I write an issue.

I'd be happy to provide more details if needed.

PS: Buttercup version is 20240718.14.

Error log from make test:

➜  org-sql git:(master) ✗ make test
make stateless
make[1]: Entering directory '/home/redacted/other-peoples-code/org-sql'
/home/redacted/.emacs.d/elpa/cask-0.9.1pre/bin/cask exec buttercup -L . -l test/org-sql-test-stateless.el
Running 112 specs.

logbook entry spec
  default - none (0.75ms)
  default - state (0.84ms)
  default - refile (0.87ms)
  default - note (0.80ms)
  default - done (0.77ms)
  default - reschedule (0.85ms)
  default - delschedule (0.96ms)
  default - redeadline (0.93ms)
  default - deldeadline (0.92ms)
  custom - user (0.62ms)
  custom - user full (0.62ms)
  custom - active timestamp (0.66ms)
  custom - short timestamp (0.66ms)
  custom - short active timestamp (0.71ms)
  custom - old/new timestamps (0.75ms)

bulk insert spec
  headlines
    single (1.22ms)
    two (0.54ms)
    fancy (1.03ms)
    nested (predicate applied to parent) (0.47ms)
    nested (predicate applied to child) (0.47ms)
    nested (no predicate) (0.55ms)
    two (many nested) (0.70ms)
    archived (0.50ms)
  planning entries
    multiple (included) (0.76ms)
    multiple (exclude some) (0.74ms)
    multiple (exclude all) (0.52ms)
  tags
    multiple (included) (0.54ms)
    multiple (exclude one) (0.49ms)
    multiple (exclude all) (0.47ms)
    single (child headline) (0.51ms)
    inherited (included) (0.50ms)
    inherited (excluded) (0.47ms)
  file tags
    single (0.55ms)
    multiple (0.62ms)
  timestamp
    closed (0.61ms)
    closed (long) (0.62ms)
    deadline (repeater) (0.59ms)
    deadline (repeater + habit) (0.58ms)
    deadline (warning) (0.59ms)
    multiple content (included) (1.01ms)
    multiple content (exclude some) (0.98ms)
    multiple content (exclude all) (0.75ms)
    content (nested) (1.10ms)
    content (ranged) (1.00ms)
  links
    multiple (included) (0.90ms)
    multiple (exclude some) (0.87ms)
    multiple (exclude all) (0.77ms)
    single (nested) (0.91ms)
    with description (0.90ms)
  properties
    single (0.55ms)
    multiple (0.54ms)
    single file (0.58ms)
  logbook
    clocks
      single (closed) (0.68ms)
      single (open) (0.61ms)
      single (note - included) (0.72ms)
      single (note - excluded) (0.74ms)
      multiple (0.63ms)
    items
      multiple (0.91ms)
      note (included) (0.91ms)
      note (exclude) (0.84ms)
      state change (included) (0.75ms)
      state change (excluded) (0.73ms)
      rescheduled (included) (0.99ms)
      rescheduled (excluded) (0.74ms)
      redeadline (included) (0.83ms)
      redeadline (excluded) (0.84ms)
      delschedule (included) (0.81ms)
      delschedule (excluded) (0.76ms)
      deldeadline (included) (0.83ms)
      deldeadline (excluded) (0.78ms)
      refile (included) (0.78ms)
      refile (excluded) (0.71ms)
      done (included) (0.73ms)
      done (excluded) (0.91ms)
    mixture
      clock + non-note (0.81ms)
      clock + note + non-note (0.93ms)
      non-note + clock (0.85ms)
      non-note + clock + clock note (1.02ms)
    non-default drawer configs
      log drawer (global) (0.76ms)
      log drawer (file) (0.86ms)
      log drawer (property) (0.87ms)
      clock drawer (global) (0.63ms)
      clock drawer (property) (0.65ms)
      clock note (global) (0.75ms)
      clock note (file) (0.91ms)

type formatting spec
  boolean
    NULL (0.31ms)
    TRUE (0.28ms)
    FALSE (0.27ms)
  enum
    NULL (0.26ms)
    defined (0.26ms)
  integer
    NULL (0.26ms)
    defined (0.26ms)
  text
    NULL (0.26ms)
    plain (0.29ms)
    newlines (0.28ms)
    quotes (0.27ms)

meta-query language statement formatting spec
  bulk insert
    SQLite (0.11ms)
    Postgres (0.10ms)
    MySQL (0.10ms)
    SQL-Server (0.11ms)
  create table
    SQLite (0.11ms)
    postgres (0.11ms)
    postgres - unlogged (0.11ms)
    postgres - nonpublic (0.12ms)
    mysql (0.10ms)
    sqlserver (0.10ms)
    sqlserver - nonpublic (0.10ms)
  transaction
    sqlite (0.08ms)
    postgres (0.08ms)
    mysql (0.08ms)
    sqlserver (0.07ms)

file metadata spec
  classify file metadata (0.08ms)

Ran 112 specs, 0 failed, in 195.38ms.
make[1]: Leaving directory '/home/redacted/other-peoples-code/org-sql'
make stateful
make[1]: Entering directory '/home/redacted/other-peoples-code/org-sql'
/home/redacted/.emacs.d/elpa/cask-0.9.1pre/bin/cask exec buttercup -L . -l test/org-sql-test-stateful.el

Error: buttercup-dynamic-binding-error "buttercup requires `lexical-binding' to be t"
  mapbacktrace(#f(compiled-function (evald func args flags) #<bytecode 0x102279ea2bae8107>))
  debug-early-backtrace()
  debug-early(error (buttercup-dynamic-binding-error . "buttercup requires `lexical-binding' to be t"))
  signal(buttercup-dynamic-binding-error "buttercup requires `lexical-binding' to be t")
  #f(compiled-function (description &rest body) "Describe a test suite.\n\nDESCRIPTION is a string. BODY is a sequence of instructions,\nmainly calls to `describe', `it' and `before-each'." #<bytecode -0xb7aeb7023f0c4df>)("SQL IO Spec" (describe-io-spec "SQLite" (sqlite :path "/tmp/org-sql-test.db")) (describe-io-spec "Postgres (v13)" (postgres :database "org_sql" :port 60013 :hostname "localhost" :username "org_sql" :password "org_sql")) (describe-io-spec "Postgres (v13 - Non-Default Schema)" (postgres :schema "nonpublic" :database "org_sql" :port 60013 :hostname "localhost" :username "org_sql" :password "org_sql")) (describe-io-spec "Postgres (v13 - Unlogged tables)" (postgres :unlogged t :database "org_sql" :port 60013 :hostname "localhost" :username "org_sql" :password "org_sql")) (describe-io-spec "Postgres (v12)" (postgres :database "org_sql" :port 60012 :hostname "localhost" :username "org_sql" :password "org_sql")) (describe-io-spec "Postgres (v11)" (postgres :database "org_sql" :port 60011 :hostname "localhost" :username "org_sql" :password "org_sql")) (describe-io-spec "Postgres (v10)" (postgres :database "org_sql" :port 60010 :hostname "localhost" :username "org_sql" :password "org_sql")) (describe-io-spec "Postgres (v9)" (postgres :database "org_sql" :port 60009 :hostname "localhost" :username "org_sql" :password "org_sql")) (describe-io-spec "MariaDB (v10.5)" (mysql :database "org_sql" :port 60105 :hostname "127.0.0.1" :username "org_sql" :password "org_sql")) (describe-io-spec "MariaDB (v10.4)" (mysql :database "org_sql" :port 60104 :hostname "127.0.0.1" :username "org_sql" :password "org_sql")) (describe-io-spec "MariaDB (v10.3)" (mysql :database "org_sql" :port 60103 :hostname "127.0.0.1" :username "org_sql" :password "org_sql")) (describe-io-spec "MariaDB (v10.2)" (mysql :database "org_sql" :port 60102 :hostname "127.0.0.1" :username "org_sql" :password "org_sql")) (describe-io-spec "MySQL (v8.0)" (mysql :database "org_sql" :port 60280 :hostname "127.0.0.1" :username "org_sql" :password "org_sql")) (describe-io-spec "SQL-Server (v2019)" (sqlserver :schema "nondbo" :database "org_sql" :server "tcp:localhost,60319" :args ("-C") :username "org_sql" :password "org_sql333###")) (describe-io-spec "SQL-Server (v2017)" (sqlserver :schema "nondbo" :database "org_sql" :server "tcp:localhost,60317" :args ("-C") :username "org_sql" :password "org_sql333###")))
  (describe "SQL IO Spec" (describe-io-spec "SQLite" (sqlite :path "/tmp/org-sql-test.db")) (describe-io-spec "Postgres (v13)" (postgres :database "org_sql" :port 60013 :hostname "localhost" :username "org_sql" :password "org_sql")) (describe-io-spec "Postgres (v13 - Non-Default Schema)" (postgres :schema "nonpublic" :database "org_sql" :port 60013 :hostname "localhost" :username "org_sql" :password "org_sql")) (describe-io-spec "Postgres (v13 - Unlogged tables)" (postgres :unlogged t :database "org_sql" :port 60013 :hostname "localhost" :username "org_sql" :password "org_sql")) (describe-io-spec "Postgres (v12)" (postgres :database "org_sql" :port 60012 :hostname "localhost" :username "org_sql" :password "org_sql")) (describe-io-spec "Postgres (v11)" (postgres :database "org_sql" :port 60011 :hostname "localhost" :username "org_sql" :password "org_sql")) (describe-io-spec "Postgres (v10)" (postgres :database "org_sql" :port 60010 :hostname "localhost" :username "org_sql" :password "org_sql")) (describe-io-spec "Postgres (v9)" (postgres :database "org_sql" :port 60009 :hostname "localhost" :username "org_sql" :password "org_sql")) (describe-io-spec "MariaDB (v10.5)" (mysql :database "org_sql" :port 60105 :hostname "127.0.0.1" :username "org_sql" :password "org_sql")) (describe-io-spec "MariaDB (v10.4)" (mysql :database "org_sql" :port 60104 :hostname "127.0.0.1" :username "org_sql" :password "org_sql")) (describe-io-spec "MariaDB (v10.3)" (mysql :database "org_sql" :port 60103 :hostname "127.0.0.1" :username "org_sql" :password "org_sql")) (describe-io-spec "MariaDB (v10.2)" (mysql :database "org_sql" :port 60102 :hostname "127.0.0.1" :username "org_sql" :password "org_sql")) (describe-io-spec "MySQL (v8.0)" (mysql :database "org_sql" :port 60280 :hostname "127.0.0.1" :username "org_sql" :password "org_sql")) (describe-io-spec "SQL-Server (v2019)" (sqlserver :schema "nondbo" :database "org_sql" :server "tcp:localhost,60319" :args ("-C") :username "org_sql" :password "org_sql333###")) (describe-io-spec "SQL-Server (v2017)" (sqlserver :schema "nondbo" :database "org_sql" :server "tcp:localhost,60317" :args ("-C") :username "org_sql" :password "org_sql333###")))
  (describe-io-specs "SQLite" (sqlite :path "/tmp/org-sql-test.db") "Postgres (v13)" (postgres :database "org_sql" :port 60013 :hostname "localhost" :username "org_sql" :password "org_sql") "Postgres (v13 - Non-Default Schema)" (postgres :schema "nonpublic" :database "org_sql" :port 60013 :hostname "localhost" :username "org_sql" :password "org_sql") "Postgres (v13 - Unlogged tables)" (postgres :unlogged t :database "org_sql" :port 60013 :hostname "localhost" :username "org_sql" :password "org_sql") "Postgres (v12)" (postgres :database "org_sql" :port 60012 :hostname "localhost" :username "org_sql" :password "org_sql") "Postgres (v11)" (postgres :database "org_sql" :port 60011 :hostname "localhost" :username "org_sql" :password "org_sql") "Postgres (v10)" (postgres :database "org_sql" :port 60010 :hostname "localhost" :username "org_sql" :password "org_sql") "Postgres (v9)" (postgres :database "org_sql" :port 60009 :hostname "localhost" :username "org_sql" :password "org_sql") "MariaDB (v10.5)" (mysql :database "org_sql" :port 60105 :hostname "127.0.0.1" :username "org_sql" :password "org_sql") "MariaDB (v10.4)" (mysql :database "org_sql" :port 60104 :hostname "127.0.0.1" :username "org_sql" :password "org_sql") "MariaDB (v10.3)" (mysql :database "org_sql" :port 60103 :hostname "127.0.0.1" :username "org_sql" :password "org_sql") "MariaDB (v10.2)" (mysql :database "org_sql" :port 60102 :hostname "127.0.0.1" :username "org_sql" :password "org_sql") "MySQL (v8.0)" (mysql :database "org_sql" :port 60280 :hostname "127.0.0.1" :username "org_sql" :password "org_sql") "SQL-Server (v2019)" (sqlserver :schema "nondbo" :database "org_sql" :server "tcp:localhost,60319" :args ("-C") :username "org_sql" :password "org_sql333###") "SQL-Server (v2017)" (sqlserver :schema "nondbo" :database "org_sql" :server "tcp:localhost,60317" :args ("-C") :username "org_sql" :password "org_sql333###"))
  eval((describe-io-specs "SQLite" (sqlite :path "/tmp/org-sql-test.db") "Postgres (v13)" (postgres :database "org_sql" :port 60013 :hostname "localhost" :username "org_sql" :password "org_sql") "Postgres (v13 - Non-Default Schema)" (postgres :schema "nonpublic" :database "org_sql" :port 60013 :hostname "localhost" :username "org_sql" :password "org_sql") "Postgres (v13 - Unlogged tables)" (postgres :unlogged t :database "org_sql" :port 60013 :hostname "localhost" :username "org_sql" :password "org_sql") "Postgres (v12)" (postgres :database "org_sql" :port 60012 :hostname "localhost" :username "org_sql" :password "org_sql") "Postgres (v11)" (postgres :database "org_sql" :port 60011 :hostname "localhost" :username "org_sql" :password "org_sql") "Postgres (v10)" (postgres :database "org_sql" :port 60010 :hostname "localhost" :username "org_sql" :password "org_sql") "Postgres (v9)" (postgres :database "org_sql" :port 60009 :hostname "localhost" :username "org_sql" :password "org_sql") "MariaDB (v10.5)" (mysql :database "org_sql" :port 60105 :hostname "127.0.0.1" :username "org_sql" :password "org_sql") "MariaDB (v10.4)" (mysql :database "org_sql" :port 60104 :hostname "127.0.0.1" :username "org_sql" :password "org_sql") "MariaDB (v10.3)" (mysql :database "org_sql" :port 60103 :hostname "127.0.0.1" :username "org_sql" :password "org_sql") "MariaDB (v10.2)" (mysql :database "org_sql" :port 60102 :hostname "127.0.0.1" :username "org_sql" :password "org_sql") "MySQL (v8.0)" (mysql :database "org_sql" :port 60280 :hostname "127.0.0.1" :username "org_sql" :password "org_sql") "SQL-Server (v2019)" (sqlserver :schema "nondbo" :database "org_sql" :server "tcp:localhost,60319" :args ("-C") :username "org_sql" :password "org_sql333###") "SQL-Server (v2017)" (sqlserver :schema "nondbo" :database "org_sql" :server "tcp:localhost,60317" :args ("-C") :username "org_sql" :password "org_sql333###")))
  (let* ((sqlite (list "SQLite" (list 'sqlite ':path (f-join (temporary-file-directory) "org-sql-test.db")))) (postgres (append (funcall --cl-mk-postgres-- 13 60013) (funcall --cl-mk-postgres-- 13 60013 "Non-Default Schema" '(:schema "nonpublic")) (funcall --cl-mk-postgres-- 13 60013 "Unlogged tables" '(:unlogged t)) (funcall --cl-mk-postgres-- 12 60012) (funcall --cl-mk-postgres-- 11 60011) (funcall --cl-mk-postgres-- 10 60010) (funcall --cl-mk-postgres-- 9 60009))) (mariadb (append (funcall --cl-mk-mysql-- "MariaDB" 10.5 60105) (funcall --cl-mk-mysql-- "MariaDB" 10.4 60104) (funcall --cl-mk-mysql-- "MariaDB" 10.3 60103) (funcall --cl-mk-mysql-- "MariaDB" 10.2 60102))) (mysql (append (funcall --cl-mk-mysql-- "MySQL" 8.0 60280))) (sqlserver (append (funcall --cl-mk-sqlserver-- 2019 60319 nil '(:schema "nondbo")) (funcall --cl-mk-sqlserver-- 2017 60317 nil '(:schema "nondbo"))))) (eval (cons 'describe-io-specs (append sqlite postgres mariadb mysql sqlserver))))
  (progn (let* ((sqlite (list "SQLite" (list 'sqlite ':path (f-join (temporary-file-directory) "org-sql-test.db")))) (postgres (append (funcall --cl-mk-postgres-- 13 60013) (funcall --cl-mk-postgres-- 13 60013 "Non-Default Schema" '(:schema "nonpublic")) (funcall --cl-mk-postgres-- 13 60013 "Unlogged tables" '(:unlogged t)) (funcall --cl-mk-postgres-- 12 60012) (funcall --cl-mk-postgres-- 11 60011) (funcall --cl-mk-postgres-- 10 60010) (funcall --cl-mk-postgres-- 9 60009))) (mariadb (append (funcall --cl-mk-mysql-- "MariaDB" 10.5 60105) (funcall --cl-mk-mysql-- "MariaDB" 10.4 60104) (funcall --cl-mk-mysql-- "MariaDB" 10.3 60103) (funcall --cl-mk-mysql-- "MariaDB" 10.2 60102))) (mysql (append (funcall --cl-mk-mysql-- "MySQL" 8.0 60280))) (sqlserver (append (funcall --cl-mk-sqlserver-- 2019 60319 nil '(:schema "nondbo")) (funcall --cl-mk-sqlserver-- 2017 60317 nil '(:schema "nondbo"))))) (eval (cons 'describe-io-specs (append sqlite postgres mariadb mysql sqlserver)))))
  (let* ((--cl-mk-sqlserver-- #'(lambda (version port &optional alt-title key-vals) (funcall --cl-mk-io-spec-- "SQL-Server" 'sqlserver version alt-title (append key-vals (list :database "org_sql" :server (format "tcp:localhost,%s" port) :args '("-C") :username "org_sql" :password "org_sql333###")))))) (progn (let* ((sqlite (list "SQLite" (list 'sqlite ':path (f-join (temporary-file-directory) "org-sql-test.db")))) (postgres (append (funcall --cl-mk-postgres-- 13 60013) (funcall --cl-mk-postgres-- 13 60013 "Non-Default Schema" '(:schema "nonpublic")) (funcall --cl-mk-postgres-- 13 60013 "Unlogged tables" '(:unlogged t)) (funcall --cl-mk-postgres-- 12 60012) (funcall --cl-mk-postgres-- 11 60011) (funcall --cl-mk-postgres-- 10 60010) (funcall --cl-mk-postgres-- 9 60009))) (mariadb (append (funcall --cl-mk-mysql-- "MariaDB" 10.5 60105) (funcall --cl-mk-mysql-- "MariaDB" 10.4 60104) (funcall --cl-mk-mysql-- "MariaDB" 10.3 60103) (funcall --cl-mk-mysql-- "MariaDB" 10.2 60102))) (mysql (append (funcall --cl-mk-mysql-- "MySQL" 8.0 60280))) (sqlserver (append (funcall --cl-mk-sqlserver-- 2019 60319 nil '(:schema "nondbo")) (funcall --cl-mk-sqlserver-- 2017 60317 nil '(:schema "nondbo"))))) (eval (cons 'describe-io-specs (append sqlite postgres mariadb mysql sqlserver))))))
  (progn (let* ((--cl-mk-sqlserver-- #'(lambda (version port &optional alt-title key-vals) (funcall --cl-mk-io-spec-- "SQL-Server" 'sqlserver version alt-title (append key-vals (list :database "org_sql" :server (format "tcp:localhost,%s" port) :args '("-C") :username "org_sql" :password "org_sql333###")))))) (progn (let* ((sqlite (list "SQLite" (list 'sqlite ':path (f-join (temporary-file-directory) "org-sql-test.db")))) (postgres (append (funcall --cl-mk-postgres-- 13 60013) (funcall --cl-mk-postgres-- 13 60013 "Non-Default Schema" '(:schema "nonpublic")) (funcall --cl-mk-postgres-- 13 60013 "Unlogged tables" '(:unlogged t)) (funcall --cl-mk-postgres-- 12 60012) (funcall --cl-mk-postgres-- 11 60011) (funcall --cl-mk-postgres-- 10 60010) (funcall --cl-mk-postgres-- 9 60009))) (mariadb (append (funcall --cl-mk-mysql-- "MariaDB" 10.5 60105) (funcall --cl-mk-mysql-- "MariaDB" 10.4 60104) (funcall --cl-mk-mysql-- "MariaDB" 10.3 60103) (funcall --cl-mk-mysql-- "MariaDB" 10.2 60102))) (mysql (append (funcall --cl-mk-mysql-- "MySQL" 8.0 60280))) (sqlserver (append (funcall --cl-mk-sqlserver-- 2019 60319 nil '(:schema "nondbo")) (funcall --cl-mk-sqlserver-- 2017 60317 nil '(:schema "nondbo"))))) (eval (cons 'describe-io-specs (append sqlite postgres mariadb mysql sqlserver)))))))
  (let* ((--cl-mk-mysql-- #'(lambda (title version port &optional alt-title key-vals) (funcall --cl-mk-io-spec-- title 'mysql version alt-title (append key-vals (list :database "org_sql" :port port :hostname "127.0.0.1" :username "org_sql" :password "org_sql")))))) (progn (let* ((--cl-mk-sqlserver-- #'(lambda (version port &optional alt-title key-vals) (funcall --cl-mk-io-spec-- "SQL-Server" 'sqlserver version alt-title (append key-vals (list :database "org_sql" :server (format "tcp:localhost,%s" port) :args '("-C") :username "org_sql" :password "org_sql333###")))))) (progn (let* ((sqlite (list "SQLite" (list 'sqlite ':path (f-join (temporary-file-directory) "org-sql-test.db")))) (postgres (append (funcall --cl-mk-postgres-- 13 60013) (funcall --cl-mk-postgres-- 13 60013 "Non-Default Schema" '(:schema "nonpublic")) (funcall --cl-mk-postgres-- 13 60013 "Unlogged tables" '(:unlogged t)) (funcall --cl-mk-postgres-- 12 60012) (funcall --cl-mk-postgres-- 11 60011) (funcall --cl-mk-postgres-- 10 60010) (funcall --cl-mk-postgres-- 9 60009))) (mariadb (append (funcall --cl-mk-mysql-- "MariaDB" 10.5 60105) (funcall --cl-mk-mysql-- "MariaDB" 10.4 60104) (funcall --cl-mk-mysql-- "MariaDB" 10.3 60103) (funcall --cl-mk-mysql-- "MariaDB" 10.2 60102))) (mysql (append (funcall --cl-mk-mysql-- "MySQL" 8.0 60280))) (sqlserver (append (funcall --cl-mk-sqlserver-- 2019 60319 nil '(:schema "nondbo")) (funcall --cl-mk-sqlserver-- 2017 60317 nil '(:schema "nondbo"))))) (eval (cons 'describe-io-specs (append sqlite postgres mariadb mysql sqlserver))))))))
  (progn (let* ((--cl-mk-mysql-- #'(lambda (title version port &optional alt-title key-vals) (funcall --cl-mk-io-spec-- title 'mysql version alt-title (append key-vals (list :database "org_sql" :port port :hostname "127.0.0.1" :username "org_sql" :password "org_sql")))))) (progn (let* ((--cl-mk-sqlserver-- #'(lambda (version port &optional alt-title key-vals) (funcall --cl-mk-io-spec-- "SQL-Server" 'sqlserver version alt-title (append key-vals (list :database "org_sql" :server (format "tcp:localhost,%s" port) :args '("-C") :username "org_sql" :password "org_sql333###")))))) (progn (let* ((sqlite (list "SQLite" (list 'sqlite ':path (f-join (temporary-file-directory) "org-sql-test.db")))) (postgres (append (funcall --cl-mk-postgres-- 13 60013) (funcall --cl-mk-postgres-- 13 60013 "Non-Default Schema" '(:schema "nonpublic")) (funcall --cl-mk-postgres-- 13 60013 "Unlogged tables" '(:unlogged t)) (funcall --cl-mk-postgres-- 12 60012) (funcall --cl-mk-postgres-- 11 60011) (funcall --cl-mk-postgres-- 10 60010) (funcall --cl-mk-postgres-- 9 60009))) (mariadb (append (funcall --cl-mk-mysql-- "MariaDB" 10.5 60105) (funcall --cl-mk-mysql-- "MariaDB" 10.4 60104) (funcall --cl-mk-mysql-- "MariaDB" 10.3 60103) (funcall --cl-mk-mysql-- "MariaDB" 10.2 60102))) (mysql (append (funcall --cl-mk-mysql-- "MySQL" 8.0 60280))) (sqlserver (append (funcall --cl-mk-sqlserver-- 2019 60319 nil '(:schema "nondbo")) (funcall --cl-mk-sqlserver-- 2017 60317 nil '(:schema "nondbo"))))) (eval (cons 'describe-io-specs (append sqlite postgres mariadb mysql sqlserver)))))))))
  (let* ((--cl-mk-postgres-- #'(lambda (version port &optional alt-title key-vals) (funcall --cl-mk-io-spec-- "Postgres" 'postgres version alt-title (append key-vals (list :database "org_sql" :port port :hostname "localhost" :username "org_sql" :password "org_sql")))))) (progn (let* ((--cl-mk-mysql-- #'(lambda (title version port &optional alt-title key-vals) (funcall --cl-mk-io-spec-- title 'mysql version alt-title (append key-vals (list :database "org_sql" :port port :hostname "127.0.0.1" :username "org_sql" :password "org_sql")))))) (progn (let* ((--cl-mk-sqlserver-- #'(lambda (version port &optional alt-title key-vals) (funcall --cl-mk-io-spec-- "SQL-Server" 'sqlserver version alt-title (append key-vals (list :database "org_sql" :server (format "tcp:localhost,%s" port) :args '("-C") :username "org_sql" :password "org_sql333###")))))) (progn (let* ((sqlite (list "SQLite" (list 'sqlite ':path (f-join (temporary-file-directory) "org-sql-test.db")))) (postgres (append (funcall --cl-mk-postgres-- 13 60013) (funcall --cl-mk-postgres-- 13 60013 "Non-Default Schema" '(:schema "nonpublic")) (funcall --cl-mk-postgres-- 13 60013 "Unlogged tables" '(:unlogged t)) (funcall --cl-mk-postgres-- 12 60012) (funcall --cl-mk-postgres-- 11 60011) (funcall --cl-mk-postgres-- 10 60010) (funcall --cl-mk-postgres-- 9 60009))) (mariadb (append (funcall --cl-mk-mysql-- "MariaDB" 10.5 60105) (funcall --cl-mk-mysql-- "MariaDB" 10.4 60104) (funcall --cl-mk-mysql-- "MariaDB" 10.3 60103) (funcall --cl-mk-mysql-- "MariaDB" 10.2 60102))) (mysql (append (funcall --cl-mk-mysql-- "MySQL" 8.0 60280))) (sqlserver (append (funcall --cl-mk-sqlserver-- 2019 60319 nil '(:schema "nondbo")) (funcall --cl-mk-sqlserver-- 2017 60317 nil '(:schema "nondbo"))))) (eval (cons 'describe-io-specs (append sqlite postgres mariadb mysql sqlserver))))))))))
  (progn (let* ((--cl-mk-postgres-- #'(lambda (version port &optional alt-title key-vals) (funcall --cl-mk-io-spec-- "Postgres" 'postgres version alt-title (append key-vals (list :database "org_sql" :port port :hostname "localhost" :username "org_sql" :password "org_sql")))))) (progn (let* ((--cl-mk-mysql-- #'(lambda (title version port &optional alt-title key-vals) (funcall --cl-mk-io-spec-- title 'mysql version alt-title (append key-vals (list :database "org_sql" :port port :hostname "127.0.0.1" :username "org_sql" :password "org_sql")))))) (progn (let* ((--cl-mk-sqlserver-- #'(lambda (version port &optional alt-title key-vals) (funcall --cl-mk-io-spec-- "SQL-Server" 'sqlserver version alt-title (append key-vals (list :database "org_sql" :server (format "tcp:localhost,%s" port) :args '("-C") :username "org_sql" :password "org_sql333###")))))) (progn (let* ((sqlite (list "SQLite" (list 'sqlite ':path (f-join (temporary-file-directory) "org-sql-test.db")))) (postgres (append (funcall --cl-mk-postgres-- 13 60013) (funcall --cl-mk-postgres-- 13 60013 "Non-Default Schema" '(:schema "nonpublic")) (funcall --cl-mk-postgres-- 13 60013 "Unlogged tables" '(:unlogged t)) (funcall --cl-mk-postgres-- 12 60012) (funcall --cl-mk-postgres-- 11 60011) (funcall --cl-mk-postgres-- 10 60010) (funcall --cl-mk-postgres-- 9 60009))) (mariadb (append (funcall --cl-mk-mysql-- "MariaDB" 10.5 60105) (funcall --cl-mk-mysql-- "MariaDB" 10.4 60104) (funcall --cl-mk-mysql-- "MariaDB" 10.3 60103) (funcall --cl-mk-mysql-- "MariaDB" 10.2 60102))) (mysql (append (funcall --cl-mk-mysql-- "MySQL" 8.0 60280))) (sqlserver (append (funcall --cl-mk-sqlserver-- 2019 60319 nil '(:schema "nondbo")) (funcall --cl-mk-sqlserver-- 2017 60317 nil '(:schema "nondbo"))))) (eval (cons 'describe-io-specs (append sqlite postgres mariadb mysql sqlserver)))))))))))
  (let* ((--cl-mk-io-spec-- #'(lambda (db-name db-sym version alt-title key-vals) (list (if alt-title (format "%s (v%s - %s)" db-name version alt-title) (format "%s (v%s)" db-name version)) (cons db-sym key-vals))))) (progn (let* ((--cl-mk-postgres-- #'(lambda (version port &optional alt-title key-vals) (funcall --cl-mk-io-spec-- "Postgres" 'postgres version alt-title (append key-vals (list :database "org_sql" :port port :hostname "localhost" :username "org_sql" :password "org_sql")))))) (progn (let* ((--cl-mk-mysql-- #'(lambda (title version port &optional alt-title key-vals) (funcall --cl-mk-io-spec-- title 'mysql version alt-title (append key-vals (list :database "org_sql" :port port :hostname "127.0.0.1" :username "org_sql" :password "org_sql")))))) (progn (let* ((--cl-mk-sqlserver-- #'(lambda (version port &optional alt-title key-vals) (funcall --cl-mk-io-spec-- "SQL-Server" 'sqlserver version alt-title (append key-vals (list :database "org_sql" :server (format "tcp:localhost,%s" port) :args '("-C") :username "org_sql" :password "org_sql333###")))))) (progn (let* ((sqlite (list "SQLite" (list 'sqlite ':path (f-join (temporary-file-directory) "org-sql-test.db")))) (postgres (append (funcall --cl-mk-postgres-- 13 60013) (funcall --cl-mk-postgres-- 13 60013 "Non-Default Schema" '(:schema "nonpublic")) (funcall --cl-mk-postgres-- 13 60013 "Unlogged tables" '(:unlogged t)) (funcall --cl-mk-postgres-- 12 60012) (funcall --cl-mk-postgres-- 11 60011) (funcall --cl-mk-postgres-- 10 60010) (funcall --cl-mk-postgres-- 9 60009))) (mariadb (append (funcall --cl-mk-mysql-- "MariaDB" 10.5 60105) (funcall --cl-mk-mysql-- "MariaDB" 10.4 60104) (funcall --cl-mk-mysql-- "MariaDB" 10.3 60103) (funcall --cl-mk-mysql-- "MariaDB" 10.2 60102))) (mysql (append (funcall --cl-mk-mysql-- "MySQL" 8.0 60280))) (sqlserver (append (funcall --cl-mk-sqlserver-- 2019 60319 nil '(:schema "nondbo")) (funcall --cl-mk-sqlserver-- 2017 60317 nil '(:schema "nondbo"))))) (eval (cons 'describe-io-specs (append sqlite postgres mariadb mysql sqlserver))))))))))))
  eval-buffer(#<buffer  *load*> nil "/home/redacted/other-peoples-code/org-sql/test/org-sql-test-stateful.el" nil t)
  load-with-code-conversion("/home/redacted/other-peoples-code/org-sql/test/org-sql-test-stateful.el" "/home/redacted/other-peoples-code/org-sql/test/org-sql-test-stateful.el" nil t)
  load("/home/redacted/other-peoples-code/org-sql/test/org-sql-test-stateful.el" nil t)
  command-line-1(("-L" "." "-l" "test/org-sql-test-stateful.el" "-l" "buttercup" "-f" "buttercup-run-discover" "--"))
  command-line()
  normal-top-level()
Lexical binding is not enabled
make[1]: *** [Makefile:21: stateful] Error 255
make[1]: Leaving directory '/home/redacted/other-peoples-code/org-sql'
make: *** [Makefile:8: test] Error 2
ndwarshuis commented 1 month ago

what emacs and org version are you using?

aviav commented 1 month ago

what emacs and org version are you using?

Org mode version 9.6.15 (release_9.6.15 @ /usr/share/emacs/29.4/lisp/org/)

ndwarshuis commented 4 weeks ago

this happens because the eval at the end of the stateless tests is dynamic by default, and because buttercup became strict recently about enforcing lexical binding.

However, once you change eval to be lexical, you will (like me) probably get a boatload of errors from mariadb, mysql, and sqlserver complaining about how their commands are either missing, depreciated, have an outdated default, or format the output in such a way to break org-sql's parser.

There is actually a much broader underlying issue, which is that the elisp dependencies have almost no version control, or emacs or itself, or any of the binaries used for testing, which means things will break like this.

Tentative solution (based on my experience with another emacs package): use straight.el instead of cask, and use conda to pin the emacs version (and in this case the sql binaries). In this case docker will also be necessary to run multiple database versions at once. https://github.com/ndwarshuis/org-sql/pull/23 will also be moot if cask is removed.

aviav commented 4 weeks ago

Thanks for looking into this! Since I'm new to elisp and don't know which software versions were used to make the stateful tests pass when they did, it would seem inefficient to me if I tried to implement the switch from cask to straight.el. However, I agree with your perspective on the underlying problem.

In case there's nobody who intends to implement the switch of org-sql to straight.el for the time being, I'd appreciate it if my changes, including #23, were merged, because considering the current state of Emacs, Org Mode, and the byte compiler, I see the changes as improvements, and because they are not directly related to the stateful side of things.

In case the project that I'm currently using org-sql for turns out to be long-term useful to me, I'll re-evaluate looking into the straight.el switch and possibly I'll also re-evaluate looking into updating the ways in which org-sql interfaces with the databases, or initially just with Postgres, which is what I'm using.

ndwarshuis commented 3 weeks ago

fixed with 17cde13a3f6a8ef5adc486202c4e58970ef110d8

ndwarshuis commented 3 weeks ago

regarding cask vs straight, I left cask in root of the repo so people can still run cask install. I added some options in the readme for how best to handle this, although I'm not sure which is the best given that specifying packages manually with straight is a pain and (usually) doesn't matter.

For posterity's sake, the place where this might matter is with bleeding-edge org-mode. org-sql currently uses an older version of org-ml which will totally break on org 9.7. This will probably be fixed soon but given the centrality of org-mode to both of these packages, having reliable versioning is an advantage.

aviav commented 2 weeks ago

Thanks for the heads-up! I'll be sure to nail down the Emacs version in my container that pushes the SQL, and keep the old container around until I got 9.7 to work, around the time it hits my Emacs