0

I'm writing an emacs package for Pipenv and the spike solution uses sync shell calls, which is not desirable for general usage. I'm now changing calls to be async (make-process) and for output to go to a dedicated buffer. This is all good and works. However, I now want to update my test suite. I'm not sure on the best (practice) way to:

  1. Wait on the output of make-process for testing purposes. I am using accept-process-output but it does not return the actual output, only t.
  2. Related, perhaps provide a custom filter for use in testing that collects the output into a value I can return and do assertions against.

What is the best way to test output that is normally sent to a buffer via an async shell command call?

1
  • 1
    If you want to use make-process you need a process-filter or/and process-sentinel. You should look at other packages how this is done. I would suggest to use xref. You have to set a filter/sentinel for a process and they receive the process and the output as arguments. It's really convenient to look at the output of a process this way.
    – bertfred
    Dec 19, 2017 at 15:22

1 Answer 1

0

I've found that the best way to do this is to use a custom filter for tests. This custom filter sets the process output in a variable. Using accept-process-output I can ensure the process has run, and then do test assertions against the variable.

1
  • 3
    If possible, please add an example of your solution to your answer, so that it will be helpful to other people who find your question.
    – phils
    Dec 11, 2019 at 20:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.