Skip to content

Commit

Permalink
debug
Browse files Browse the repository at this point in the history
  • Loading branch information
nnicandro committed Oct 10, 2024
1 parent 376f679 commit 541a6ef
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 33 deletions.
4 changes: 4 additions & 0 deletions jupyter-rest-api.el
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,10 @@ If the maximum number of redirects are reached a
(json-false nil)
(resp (when (and (equal url-http-content-type "application/json")
(not (eobp)))
(when jupyter--debug
(message "Jupyter: Status %s: JSON Received: %S"
url-http-response-status
(buffer-substring (point) (point-max))))
(json-read))))
(cond
((>= url-http-response-status 400)
Expand Down
67 changes: 34 additions & 33 deletions test/jupyter-tramp-test.el
Original file line number Diff line number Diff line change
Expand Up @@ -199,39 +199,40 @@

(ert-deftest jupyter-delete-directory ()
:tags '(tramp server)
(jupyter-test-at-temporary-directory
(let* ((tfile (make-temp-file "delete-directory"))
(tdir (make-temp-file "delete-directory" 'directory))
(jpyfile (expand-file-name (file-name-nondirectory tfile) "/jpy::/"))
(jpydir (expand-file-name (file-name-nondirectory tdir) "/jpy::/")))
(should (file-exists-p tfile))
(should (file-exists-p jpyfile))
(should (file-exists-p tdir))
(should (file-exists-p jpydir))
(unwind-protect
(progn
(ert-info ("Error when attempting to delete a file")
(should-error (delete-directory jpyfile)))
(ert-info ("Delete a directory")
(let ((jpyfile2 (expand-file-name "foobar" jpydir)))
(write-region "xxx" nil jpyfile2)
(unwind-protect
(progn
(ert-info ("Error when directory contains files")
(should-error (delete-directory jpydir)))
(ert-info ("Unless recursive is specifed")
(delete-directory jpydir t)
(should-not (file-exists-p jpyfile2))
(should-not (file-directory-p tdir))))
(when (file-exists-p jpyfile2)
(delete-file jpyfile2))))
(should-not (file-exists-p tdir))
(ert-info ("Ensure cache is cleared")
(should-not (file-exists-p jpydir)))))
(when (file-exists-p tfile)
(delete-file tfile))
(when (file-exists-p tdir)
(delete-directory tdir t))))))
(let ((jupyter--debug t))
(jupyter-test-at-temporary-directory
(let* ((tfile (make-temp-file "delete-directory"))
(tdir (make-temp-file "delete-directory" 'directory))
(jpyfile (expand-file-name (file-name-nondirectory tfile) "/jpy::/"))
(jpydir (expand-file-name (file-name-nondirectory tdir) "/jpy::/")))
(should (file-exists-p tfile))
(should (file-exists-p jpyfile))
(should (file-exists-p tdir))
(should (file-exists-p jpydir))
(unwind-protect
(progn
(ert-info ("Error when attempting to delete a file")
(should-error (delete-directory jpyfile)))
(ert-info ("Delete a directory")
(let ((jpyfile2 (expand-file-name "foobar" jpydir)))
(write-region "xxx" nil jpyfile2)
(unwind-protect
(progn
(ert-info ("Error when directory contains files")
(should-error (delete-directory jpydir)))
(ert-info ("Unless recursive is specifed")
(delete-directory jpydir t)
(should-not (file-exists-p jpyfile2))
(should-not (file-directory-p tdir))))
(when (file-exists-p jpyfile2)
(delete-file jpyfile2))))
(should-not (file-exists-p tdir))
(ert-info ("Ensure cache is cleared")
(should-not (file-exists-p jpydir)))))
(when (file-exists-p tfile)
(delete-file tfile))
(when (file-exists-p tdir)
(delete-directory tdir t)))))))

(ert-deftest jupyter-tramp-file-attributes ()
:tags '(tramp server)
Expand Down

0 comments on commit 541a6ef

Please sign in to comment.