Skip to content
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

Running tests yields "buttercup requires `lexical-binding' to be t" #74

Open
rndusr opened this issue Jul 5, 2024 · 10 comments
Open

Running tests yields "buttercup requires `lexical-binding' to be t" #74

rndusr opened this issue Jul 5, 2024 · 10 comments

Comments

@rndusr
Copy link
Collaborator

rndusr commented Jul 5, 2024

I'm trying to run the tests with make test, and most of then run fine, but
there seems to be something wrong with these three files:

File failed to load correctly: ./tests/test-subed-mpv.el

Traceback (most recent call last):
  load("./tests/test-subed-mpv.el" nil t nil nil)
  load-with-code-conversion("/home/ich/.emacs.d/elpa/subed-1.2.11/tests/test...
  internal-macroexpand-for-load((describe "Starting mpv" (it "passes argumen...
  error("Eager macro-expansion failure: %S" (buttercup-dynamic-binding-error...
FAILED: Eager macro-expansion failure: (buttercup-dynamic-binding-error . "buttercup requires `lexical-binding' to be t")

========================================
File failed to load correctly: ./tests/test-subed-srt.el

Traceback (most recent call last):
  load("./tests/test-subed-srt.el" nil t nil nil)
  load-with-code-conversion("/home/ich/.emacs.d/elpa/subed-1.2.11/tests/test...
  internal-macroexpand-for-load((describe "SRT" (describe "Getting" (describ...
  error("Eager macro-expansion failure: %S" (buttercup-dynamic-binding-error...
FAILED: Eager macro-expansion failure: (buttercup-dynamic-binding-error . "buttercup requires `lexical-binding' to be t")

========================================
File failed to load correctly: ./tests/test-subed-tsv.el

Traceback (most recent call last):
  load("./tests/test-subed-tsv.el" nil t nil nil)
  load-with-code-conversion("/home/ich/.emacs.d/elpa/subed-1.2.11/tests/test...
  internal-macroexpand-for-load((describe "TSV" (describe "Getting" (describ...
  error("Eager macro-expansion failure: %S" (buttercup-dynamic-binding-error...
FAILED: Eager macro-expansion failure: (buttercup-dynamic-binding-error . "buttercup requires `lexical-binding' to be t")

Ran 481 specs, 3 failed, in 208.57ms.

The first line of these files contains the -*- lexical-binding: t; -*- like
all the other files that don't have this issue.

This happens with and without undercover and package-lint installed.

@rodrigomorales1
Copy link

rodrigomorales1 commented Jul 7, 2024

The first line of these files contains the -- lexical-binding: t; -- like all the other files that don't have this issue.

@rndusr Those files didn't have the -*- lexical-binding: t; -*- like the other test files.

I am working on a branch related to #68 . I just made a commit to solve the issue that you mentioned. See rodrigomorales1@d03067e

This issue should be solved when my changes get merged.

@rndusr
Copy link
Collaborator Author

rndusr commented Jul 7, 2024 via email

@rodrigomorales1
Copy link

@rndusr I'm not getting those errors with the commit I just made in my branch. See proof below.

$ git log -n 1
commit d03067e580d88c8563eee8f3e42ec75cc93d9757 (HEAD -> waveform-long-cue, origin/waveform-long-cue)
Author: Rodrigo Morales <[email protected]>
Date:   Sun Jul 7 00:21:42 2024 -0500

    Set lexical-binding: t in tests/* files
$ make test && echo Exit code: $?
emacs --quick --batch --eval "(progn (setq generated-autoload-file (expand-file-name \"subed-autoloads.el\" \"subed\") backup-inhibited t) \
(update-directory-autoloads \"./subed\"))"
Package autoload is deprecated
  INFO     Scraping files for subed-autoloads.el...
  INFO     Scraping files for subed-autoloads.el...done
mkdir -p coverage
UNDERCOVER_FORCE=true emacs -batch -L . -f package-initialize -f buttercup-run-discover

(... omitted lines ...)

Loading /my-storage/miscellaneous/subed-fix/fork/tests/undercover-init.el (source)...
Loading /my-storage/miscellaneous/subed-fix/fork/tests/undercover-init.el (source)...
Loading /my-storage/miscellaneous/subed-fix/fork/tests/undercover-init.el (source)...
Loading /my-storage/miscellaneous/subed-fix/fork/tests/undercover-init.el (source)...
Loading /my-storage/miscellaneous/subed-fix/fork/tests/undercover-init.el (source)...
Running 700 specs.

ASS
  Getting
    the subtitle start/stop time
      returns the time in milliseconds. (7.57ms)
      returns nil if time can't be found. (0.14ms)
    the subtitle text
      when text is empty
        and at the beginning with a trailing newline. (0.16ms)
    when text is not empty
      and has no linebreaks. (0.11ms)

(... omitted lines ...)

  Font-locking
    recognizes VTT syntax. (0.17ms)
  with cues
    parses properly. (0.35ms)
  conversion
    creates TXT. (0.33ms)
    includes comments in TXT if requested. (0.35ms)
  iterating over subtitles
    forwards
      handles headers. (0.15ms)
    backwards
      handles headers. (0.14ms)
      handles empty lines. (0.13ms)

Ran 700 specs, 0 failed, in 289.17ms.

(... omitted lines ...)

Exit code: 0

@rndusr
Copy link
Collaborator Author

rndusr commented Jul 8, 2024

I can't figure out which branch the commit you linked belongs to. My guess would
be it's in the waveform-long-cue branch? I see this branch on the GitHub
website, but I can't see it on my computer. I tried git fetch https://github.com/sachac/subed/ waveform-long-cue, which worked, but the
waveform-long-cue branch is still invisible.

Not sure if there is something weird going on or it's just me being a git with
git.

If I make the changes in your commit manually, which is easy enough, there is no
improvement on my side.

Anyway, my main reason for running the tests was to work on #71, but that seems
to have been fixed by sachac, so I'm ok with closing this issue if I'm the only
one having trouble running the tests.

sachac added a commit that referenced this issue Jul 11, 2024
subed-waveform should now handle the case where
the stop time + subed-waveform-preview-msecs-after
might extend past the end of the file.

* subed/subed-waveform.el (subed-waveform-ffprobe-executable): New.
(subed-waveform-file-duration-ms-cache): New.
(subed-waveform-ffprobe-duration-ms): New,
calculates duration.
(subed-waveform-file-duration-ms): New function
for caching the duration.
(subed-waveform-clear-file-duration-ms-cache): New.
(subed-mpv): Add advice around
subed-mpv-play-from-file for now;
ideally change this to a hook later on.
(subed-waveform--image-parameters): Move to a separate
function for easier testing.
(subed-waveform--make-overlay): Do the
calculations in subed-waveform--image-parameters.
(subed-waveform--update-bars): Use the actual stop
time if needed.
* tests/test-subed-waveform.el: New.
* Set lexical-binding: t in tests/* files

Thanks to rodrigomorales1 and rndusr for bug
reports and pull requests!

Related:
- #68
- #75
- #74
@sachac
Copy link
Owner

sachac commented Jul 11, 2024

Great, does rodrigomorales1's fix make the main branch work for you now?

@rndusr
Copy link
Collaborator Author

rndusr commented Jul 11, 2024 via email

@rodrigomorales1
Copy link

@rndusr Could you execute this one-liner and post the output in a new comment?

$ rm -rf /tmp/subed && cd /tmp && git clone --branch main --depth 1 'https://github.com/sachac/subed' && cd /tmp/subed && make test

I executed that command on my system and the tests run successfully, some warnings were shown and an error was thrown because I uninstalled package-lint (just to see what happens), but the tests still run successfully. See code block below.

$ rm -rf /tmp/subed && cd /tmp && git clone --branch main --depth 1 'https://github.com/sachac/subed' && cd /tmp/subed && make test
Cloning into 'subed'...
remote: Enumerating objects: 47, done.
remote: Counting objects: 100% (47/47), done.
remote: Compressing objects: 100% (42/42), done.
remote: Total 47 (delta 9), reused 26 (delta 4), pack-reused 0
Receiving objects: 100% (47/47), 219.17 KiB | 1.12 MiB/s, done.
Resolving deltas: 100% (9/9), done.
emacs --quick --batch --eval "(progn (setq generated-autoload-file (expand-file-name \"subed-autoloads.el\" \"subed\") backup-inhibited t) \
(update-directory-autoloads \"./subed\"))"
Package autoload is deprecated
  INFO     Scraping files for subed-autoloads.el...
  INFO     Scraping files for subed-autoloads.el...done
mkdir -p coverage
UNDERCOVER_FORCE=true emacs -batch -L . -f package-initialize -f buttercup-run-discover
Unable to activate package ‘closql’.
Required package ‘emacsql-sqlite-3.0.0’ is unavailable
Unable to activate package ‘org-roam’.
Required package ‘emacsql-sqlite-1.0.0’ is unavailable
Unable to activate package ‘magit’.
Required package ‘git-commit-20230101’ is unavailable
Unable to activate package ‘orgit’.
Required package ‘magit-3.3.0’ is unavailable
Unable to activate package ‘magit’.
Required package ‘git-commit-20230101’ is unavailable
Unable to activate package ‘hydra’.
Required package ‘lv-0’ is unavailable
Unable to activate package ‘hydra’.
Required package ‘lv-0’ is unavailable
Unable to activate package ‘treemacs’.
Required package ‘hydra-0.13.2’ is unavailable
Unable to activate package ‘helm’.
Required package ‘helm-core-3.9.9’ is unavailable
Loading /tmp/subed/tests/undercover-init.el (source)...
Loading /tmp/subed/tests/undercover-init.el (source)...
Loading /tmp/subed/tests/undercover-init.el (source)...
Loading /tmp/subed/tests/undercover-init.el (source)...
Loading /tmp/subed/tests/undercover-init.el (source)...
Running 717 specs.

ASS
  Getting
    the subtitle start/stop time
      returns the time in milliseconds. (8.12ms)

(... omitted lines ...)

Get duration in milliseconds of a file with 1 video and 1 audio stream
    extension .mkv (217.80ms)
    extension .mp4 (212.89ms)
    extension .webm (575.76ms)
    extension .avi (192.16ms)
    extension .ts (179.63ms)
    extension .ogv (311.78ms)

Ran 717 specs, 0 failed, in 3.56s.
Error in kill-emacs-hook (subed-mpv-kill): (error "Process mock client process does not exist")
emacs --no-init-file -f package-initialize --batch \
          --eval "(require 'package-lint)" \
      --file package-lint-batch-and-exit \
      ./subed/subed.el
Unable to activate package ‘closql’.
Required package ‘emacsql-sqlite-3.0.0’ is unavailable
Unable to activate package ‘org-roam’.
Required package ‘emacsql-sqlite-1.0.0’ is unavailable
Unable to activate package ‘magit’.
Required package ‘git-commit-20230101’ is unavailable
Unable to activate package ‘orgit’.
Required package ‘magit-3.3.0’ is unavailable
Unable to activate package ‘magit’.
Required package ‘git-commit-20230101’ is unavailable
Unable to activate package ‘hydra’.
Required package ‘lv-0’ is unavailable
Unable to activate package ‘hydra’.
Required package ‘lv-0’ is unavailable
Unable to activate package ‘treemacs’.
Required package ‘hydra-0.13.2’ is unavailable
Unable to activate package ‘helm’.
Required package ‘helm-core-3.9.9’ is unavailable

Error: file-missing ("Cannot open load file" "No such file or directory" "package-lint")
  mapbacktrace(#f(compiled-function (evald func args flags) #<bytecode 0x1d146c0931aef185>))
  debug-early-backtrace()
  debug-early(error (file-missing "Cannot open load file" "No such file or directory" "package-lint"))
  require(package-lint)
  command-line-1(("-f" "package-initialize" "--eval" "(require 'package-lint)" "--file" "package-lint-batch-and-exit" "./subed/subed.el"))
  command-line()
  normal-top-level()
Cannot open load file: No such file or directory, package-lint
make: *** [Makefile:23: package-lint] Error 255
$ echo $?
2

I'd be happy to find the root cause that is making your system have a different behavior.

@rndusr
Copy link
Collaborator Author

rndusr commented Jul 11, 2024 via email

@sachac
Copy link
Owner

sachac commented Oct 18, 2024

Hmm... @rndusr, is this still happening for you? (No rush, please check when it's convenient for you.) Sorry about it!

@rndusr
Copy link
Collaborator Author

rndusr commented Oct 25, 2024 via email

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

3 participants