Thanks to visit codestin.com
Credit goes to github.com

Skip to content

https://github.com/AndreaCrotti/yasnippet-snippets/pull/509 breaks python-mode #517

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
dcermak opened this issue May 7, 2025 · 2 comments

Comments

@dcermak
Copy link

dcermak commented May 7, 2025

#509 introduced tests for python yasnippets, but at least on my box running Emacs 30, ert is not automatically loaded and that results in the following ugly backtrace:

Debugger entered--Lisp error: (void-function ert-set-test)
  ert-set-test(test-split #s(ert-test test-split "For starters, only test a single string for expected output." #[0 "\300C\3011\23\0\302\303!\304\305\306\307FD0\202\36\0\1\310\240\210\211@\1AD\262\1\311C\312C\313\314\2\4\6\6\6\10%\216\1\315\5\242\5\"\240)\204<\0\316\1\242!\210\312\207" [equal (error) python-split-args "_foo='this', bar: int = 2, baz: Optional[My_Type], foobar" ("_foo" nil "'this'") ("bar" "int" "2") ("baz" "Optional[My_Type]" nil) ("foobar" nil nil) signal ert-form-evaluation-aborted-3 nil make-closure #[0 "\300\304\305\303\242\302BE\301\242\306=?\205\24\0\307\301\242D\244\301\242\306=?\205,\0\310\311!\211\205*\0\312\313\2\302\"D\262\1\244\240\210\314\300\242!\207" [V0 V1 V2 V3 (should (equal (python-split-args "_foo='this', bar: int = 2, baz: Optional[My_Type], foobar") (list ... ... ... ...))) :form ert-form-evaluation-aborted-3 :value ert--get-explainer equal :explanation apply ert--signal-should-execution] 7] apply ert-fail] 11] nil :passed nil "/home/dan/.emacs.d/elpa/yasnippet-snippets-20250507.834/snippets/python-mode/.yas-setup.el"))
  byte-code("\300\301\302\303\304\301\305\4\306\307\306\310&\10\262\1\"\210\300\311\312\303\304\311\313\4\306\307\306\310&\10\262\1\"\207" [ert-set-test test-split #f(compiled-function () #<bytecode -0x156571f17b848243>) record ert-test "For starters, only test a single string for expected output." nil :passed "/home/dan/.emacs.d/elpa/yasnippet-snippets-20250507.834/snippets/python-mode/.yas-setup.el" test-argument-self #f(compiled-function () #<bytecode 0x680c65d26890c07>) "If an argument is called `self`, it must be omitted"] 12)
  yas--load-yas-setup-file("/home/dan/.emacs.d/elpa/yasnippet-snippets-20250507.834/snippets/python-mode/.yas-setup")
  yas--load-directory-2("/home/dan/.emacs.d/elpa/yasnippet-snippets-20250507.834/snippets/python-mode" python-mode)
  yas--load-directory-1("/home/dan/.emacs.d/elpa/yasnippet-snippets-20250507.834/snippets/python-mode" python-mode)
  apply(yas--load-directory-1 ("/home/dan/.emacs.d/elpa/yasnippet-snippets-20250507.834/snippets/python-mode" python-mode))
  #f(compiled-function (&rest args2) #<bytecode -0x8922459b7ee3dd9>)()
  yas--load-pending-jits()
  yas-minor-mode()
  run-hooks(change-major-mode-after-body-hook prog-mode-hook python-base-mode-hook python-mode-hook)
  apply(run-hooks change-major-mode-after-body-hook (prog-mode-hook python-base-mode-hook python-mode-hook))
  run-mode-hooks(python-mode-hook)
  python-mode()
  set-auto-mode-0(python-mode nil)
  set-auto-mode--apply-alist((("^yang\\.settings$" . jsonc-mode) ("\\.tf\\'" . terraform-mode) ("Dockerfile\\'" . dockerfile-mode) ("dune-project" . dune-mode) ("dune" . dune-mode) ("\\.mlp$\\'" . tuareg-mode) ("\\.mli$\\'" . tuareg-mode) ("\\.ml$\\'" . tuareg-mode) ("_service\\'" . nxml-mode) ("^_link\\'" . nxml-mode) ("\\.rng\\'" . nxml-mode) ("\\.xsd\\'" . nxml-mode) ("\\.xml\\'" . nxml-mode) ("config\\'" . i3wm-config-mode) ("\\.asciidoc\\'" . adoc-mode) ("\\.adoc\\'" . adoc-mode) ("\\.sls$\\'" . salt-mode) ("meson.build'" . meson-mode) ("\\.org$" . org-mode) ("\\.json?\\'" . json-mode) ("\\.js\\'" . js-mode) ("\\.ts\\'" . typescript-mode) ("\\.html?\\'" . web-mode) ("\\.rest$" . rst-mode) ("\\.rst$" . rst-mode) ("\\.spec'" . rpm-spec-mode) ("\\.gitlab-ci\\.yml\\'" . gitlab-ci-mode) ("\\.yml\\'" . yaml-mode) ("\\.markdown\\'" . markdown-mode) ("\\.md\\'" . markdown-mode) ("README\\.md\\'" . gfm-mode) ("\\.tex\\'" . LaTeX-mode) ("CMakeCompiler\\.txt\\'" . cmake-mode) ("CMakeGlobals\\.txt\\'" . cmake-mode) ("SConscript" . python-mode) ("SConstruct" . python-mode) ("\\.py\\'" . python-mode) ("\\.hrl\\'" . erlang-mode) ("\\.erl\\'" . erlang-mode) ("\\.desktop\\(\\.in\\)?$" . desktop-entry-mode) ("CMakeLists\\.txt\\'" . cmake-mode) ("\\.cmake\\'" . cmake-mode) (".at'" . autotest-mode) ("\\.a\\(?:scii\\)?doc\\'" . adoc-mode) ("\\.hva\\'" . LaTeX-mode) ("\\.bats\\'" . bats-mode) ("\\.cmake\\'" . cmake-mode) ("CMakeLists\\.txt\\'" . cmake-mode) ("\\.dockerfile\\'" . dockerfile-mode) ("[/\\]\\(?:Containerfile\\|Dockerfile\\)\\(?:\\.[^/\\]*\\)?\\'" . dockerfile-mode) ...) nil nil)
  set-auto-mode()
  normal-mode(t)
  after-find-file(nil t)
  find-file-noselect-1(#<buffer api_cve.py> "~/suse/gitlab.suse.de/packtrack/packtrack/packtrack/client/api/api_cve.py" nil nil "~/suse/gitlab.suse.de/packtrack/packtrack/packtrack/client/api/api_cve.py" (3456764 42))
  find-file-noselect("/home/dan/suse/gitlab.suse.de/packtrack/packtrack/packtrack/client/api/api_cve.py" nil nil nil)
  find-file("/home/dan/suse/gitlab.suse.de/packtrack/packtrack/packtrack/client/api/api_cve.py")
  projectile--find-file(nil)
  projectile-find-file(nil)
  funcall-interactively(projectile-find-file nil)
  command-execute(projectile-find-file)

The issue can be worked around by adding a (require 'ert) at the top of snippets/python-mode/.yas-setup.el, but I'm unsure if that isn't overkill.

@AndreaCrotti
Copy link
Owner

Ah right sorry about that, I just commented out the tests until I find a better solution.
Thanks

@dcermak
Copy link
Author

dcermak commented May 8, 2025

Thanks for the quick fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants