tumashu / pyim

一个 emacs 中文输入法,支持全拼,双拼,五笔,仓颉和Rime,pyim 是 GNU elpa 包。
891 stars 93 forks source link

tests fail for 3.9.7 with GNU Emacs 27.1 #425

Closed dogsleg closed 2 years ago

dogsleg commented 2 years ago

Hello!

I'm getting the following test failing with pyim 3.9.7, GNU Emacs 27.1 (as installed from the official Debian repository, package version is 1:27.1+1-3.1+b1:

$ emacs -batch -Q -l package --eval "(add-to-list 'package-directory-list \"/usr/share/emacs/site-lisp/elpa\")" --eval "(add-to-list 'package-directory-list \"/usr/share/emacs/site-lisp/elpa-src\")" -f package-initialize -L . -L tests -l tests/pyim-tests.el --eval (ert-run-tests-batch-and-exit)

pyim-test: fail to find dict file: ’/home/dogsleg/freedom/packaging/elpa/pyim-el/deps/pyim-basedict.pyim’. Running 40 tests (2021-12-25 09:27:17+0500, selector ‘t’) passed 1/40 pyim-tests-pyim-add-unread-command-events (0.000396 sec) passed 2/40 pyim-tests-pyim-candidates-search-buffer (0.255865 sec)

"c"

passed 3/40 pyim-tests-pyim-char-before/after-to-string (0.000274 sec) passed 4/40 pyim-tests-pyim-codes (0.000636 sec) passed 5/40 pyim-tests-pyim-cregexp (0.040721 sec) passed 6/40 pyim-tests-pyim-cstring-partition (0.000348 sec) passed 7/40 pyim-tests-pyim-cstring-split (0.140695 sec) passed 8/40 pyim-tests-pyim-cstring-substrings (0.000246 sec) passed 9/40 pyim-tests-pyim-cstring-to-pinyin (0.001681 sec) passed 10/40 pyim-tests-pyim-cstring-to-xingma (0.000569 sec) passed 11/40 pyim-tests-pyim-cstring-words-at-point (0.016324 sec) Saving file /tmp/pyim-dcache-export-NtDQqn... PYIM: 词条和词频信息导出完成。 Saving file /tmp/pyim-dcache-export-NtDQqn... PYIM: 个人词条导出完成。 passed 12/40 pyim-tests-pyim-dcache-export (0.003140 sec) Saving file /home/dogsleg/freedom/packaging/elpa/pyim-el/pyim-dcache-kEFQJz/my%2Ftest%3A1... passed 13/40 pyim-tests-pyim-dcache-handle-variable (0.001926 sec) Saving file /tmp/pyim-dcache-l8X7bM... Saving file /tmp/pyim-dcache-l8X7bM-backup-20211225092718... PYIM: 生成备份文件 "/tmp/pyim-dcache-l8X7bM-backup-20211225092718", 请检查原文件 "/tmp/pyim-dcache-l8X7bM" 是否损坏!!! Saving file /tmp/pyim-dcache-l8X7bM... passed 14/40 pyim-tests-pyim-dcache-save/read-variable-value (0.182123 sec) Saving file /tmp/pyim-dcache-eOia2d... passed 15/40 pyim-tests-pyim-dhashcache-export (0.000917 sec) Saving file /tmp/pyim-dcache-OnSoZ7... Saving file /tmp/pyim-word2code-dcache-jrnDXz... passed 16/40 pyim-tests-pyim-dhashcache-generate-file (1.560958 sec) passed 17/40 pyim-tests-pyim-dhashcache-get (0.000310 sec) passed 18/40 pyim-tests-pyim-dhashcache-get-ishortcodes (0.000283 sec) passed 19/40 pyim-tests-pyim-dhashcache-get-path (0.000234 sec) passed 20/40 pyim-tests-pyim-dhashcache-get-shortcodes (0.000228 sec) passed 21/40 pyim-tests-pyim-dhashcache-insert-word-into-icode2word (0.000167 sec) passed 22/40 pyim-tests-pyim-dhashcache-insert-word-into-ishortcode2word (0.000212 sec) passed 23/40 pyim-tests-pyim-dhashcache-put/delete (0.000216 sec) passed 24/40 pyim-tests-pyim-dhashcache-update-ishortcode2word (0.000253 sec) passed 25/40 pyim-tests-pyim-dhashcache-update-iword2count (0.000206 sec) passed 26/40 pyim-tests-pyim-dhashcache-update-shortcode2word (0.000404 sec) passed 27/40 pyim-tests-pyim-dline-parse (0.000302 sec) Test pyim-tests-pyim-dregcache-backend backtrace: signal(ert-test-failed (((should (> (length pyim-dregcache-cache) 0) ert-fail(((should (> (length pyim-dregcache-cache) 0)) :form (> 0 0) (if (unwind-protect (setq value-1154 (apply fn-1152 args-1153)) (set (let (form-description-1156) (if (unwind-protect (setq value-1154 (a (let ((value-1154 'ert-form-evaluation-aborted-1155)) (let (form-des (let ((fn-1152 #'>) (args-1153 (condition-case err (let ((signal-ho (let ((pyim-dcache-backend 'pyim-dregcache) words) (let ((fn-1147 # (closure (t) nil (let ((pyim-dcache-backend 'pyim-dregcache) words) ert--run-test-internal(#s(ert--test-execution-info :test #s(ert-test ert-run-test(#s(ert-test :name pyim-tests-pyim-dregcache-backend :do ert-run-or-rerun-test(#s(ert--stats :selector t :tests ... :test-map ert-run-tests(t #f(compiled-function (event-type &rest event-args) # ert-run-tests-batch(nil) ert-run-tests-batch-and-exit() eval-buffer(#<buffer load> nil "/home/dogsleg/freedom/packaging/e load-with-code-conversion("/home/dogsleg/freedom/packaging/elpa/pyim load("/home/dogsleg/freedom/packaging/elpa/pyim-el/tests..." nil t) command-line-1(("-l" "package" "--eval" "(add-to-list 'package-direc command-line() normal-top-level() Test pyim-tests-pyim-dregcache-backend condition: (ert-test-failed ((should (> (length pyim-dregcache-cache) 0)) :form (> 0 0) :value nil)) FAILED 28/40 pyim-tests-pyim-dregcache-backend (0.001420 sec) passed 29/40 pyim-tests-pyim-general (0.175503 sec) passed 30/40 pyim-tests-pyim-imobjs (0.001241 sec)

Ran 40 tests, 38 results as expected, 2 unexpected (2021-12-25 09:27:20+0500, 2.978613 sec)

2 unexpected results: FAILED pyim-tests-pyim-dregcache-backend PASSED pyim-tests-pyim-import-words-and-counts

tumashu commented 2 years ago

because pyim-test: fail to find dict file: ’/home/dogsleg/freedom/packaging/elpa/pyim-el/deps/pyim-basedict.pyim’.

makefile in pyim will download this file

dogsleg commented 2 years ago

But I have it installed both at

pyim-basedict-autoloads.el  pyim-basedict.el  pyim-basedict-pkg.el  pyim-basedict.pyim

and

Install.log.gz  pyim-basedict-autoloads.el  pyim-basedict.el  pyim-basedict.elc  pyim-basedict-pkg.el  pyim-basedict.pyim

So, I wonder why it cannot find it, I run tests with --eval "(add-to-list 'package-directory-list "/usr/share/emacs/site-lisp/elpa")" --eval "(add-to-list 'package-directory-list "/usr/share/emacs/site-lisp/elpa-src")" -f package-initialize.

dogsleg commented 2 years ago

Even when I copy pyim-basedit.pyim both to the source directory of pyim and to the tests directory, I still face the same failings.

dogsleg commented 2 years ago

Ahhh... yes, when it is in deps/ tests work perfectly. So now I wonder how can I make it use pyim-basedict.pyim from /usr/share/emacs/site-lisp/elpa or from /usr/share/emacs/site-lisp/elpa-src?

tumashu commented 2 years ago

maybe we should find this file from load-path first.

dogsleg commented 2 years ago

Right. Thanks! With --eval "(add-to-list 'load-path \"/usr/share/emacs/site-lisp/elpa/pyim-basedict-0.5.0\")" it works. I'm closing this issue.

tumashu commented 2 years ago

i have updated test in master, which will use pyim-basedict-enable, and i move Makefile to tests dir

在 2021-12-25 14:06:11,"Lev Lamberov" @.***> 写道:

Closed #425.

— Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android. You are receiving this because you commented.Message ID: @.***>

dogsleg commented 2 years ago

Cool! 谢谢您!