Closed juergenhoetzel closed 5 years ago
ah, thank you for htis, I was wondering how to make that check.
though OTOH hand looks like this can be made python3 compatible pretty easily, do you think that's preferable?
--- a/tests/testserver.py
+++ b/tests/testserver.py
@@ -113,7 +113,7 @@ def run(port, server, **kwds):
# Pass port number to child process via envvar. This is required
# when using Flask's reloader.
os.environ['EL_REQUEST_TEST_PORT'] = str(port)
- print port
+ print (port)
sys.stdout.flush()
if server == 'flask':
@@ -125,7 +125,7 @@ def run(port, server, **kwds):
from tornado.ioloop import IOLoop
http_server = HTTPServer(WSGIContainer(app))
http_server.listen(port)
- print " * Running on", port
+ print (" * Running on", port)
IOLoop.instance().start()
though OTOH hand looks like this can be made python3 compatible pretty easily, do you think that's preferable?
Indeed that's preferable. But testing still breaks later when using the the python3 interpreter:
juergen@samson:~/elisp/emacs-request → make test
make test-3
make[1]: Verzeichnis „/home/juergen/elisp/emacs-request“ wird betreten
EL_REQUEST_TEST_SERVER=tornado make test-2
make[2]: Verzeichnis „/home/juergen/elisp/emacs-request“ wird betreten
EL_REQUEST_BACKEND=url-retrieve make EMACS=emacs CASK=cask test-1
make[3]: Verzeichnis „/home/juergen/elisp/emacs-request“ wird betreten
cask exec emacs -Q -batch \
-L . -L tests -l tests/test-request.el \
-f ert-run-tests-batch-and-exit
Warning: Unknown defun property ‘special’ in request--url-retrieve-callback
Using request-backend = url-retrieve
Using test server: tornado
Running 40 tests (2018-11-30 17:10:19+0100)
passed 1/40 request--curl-absolutify-redirects/complex
passed 2/40 request--curl-absolutify-redirects/simple
passed 3/40 request--curl-absolutify-redirects/with-port
passed 4/40 request--curl-command
passed 5/40 request--curl-preprocess/100
passed 6/40 request--curl-preprocess/200-proxy-connection-established
passed 7/40 request--curl-preprocess/no-redirects
passed 8/40 request--curl-preprocess/two-redirects
passed 9/40 request--netscape-cookie-parse
passed 10/40 request--urlencode-alist/hexified
passed 11/40 request--urlencode-alist/simple
passed 12/40 request-abort-killed-buffer
passed 13/40 request-abort-simple
REQUEST: Skip request-get-broken-redirection for backend url-retrieve.
passed 14/40 request-get-broken-redirection
passed 15/40 request-get-code-client-error
passed 16/40 request-get-code-server-error
passed 17/40 request-get-code-success
passed 18/40 request-get-parse-header-when-400
REQUEST [error] Error from parser json-read: (wrong-type-argument number-or-marker-p nil)
REQUEST [error] Error (parse-error) while connecting to http://127.0.0.1:49125/redirect/redirect/report/some-path.
Test request-get-simple-redirection backtrace:
signal(ert-test-failed (((should (string-prefix-p path (assoc-defaul
ert-fail(((should (string-prefix-p path (assoc-default 'path data)))
(if (unwind-protect (setq value-71 (apply fn-69 args-70)) (setq form
(let (form-description-73) (if (unwind-protect (setq value-71 (apply
(let ((value-71 'ert-form-evaluation-aborted-72)) (let (form-descrip
(let* ((fn-69 (function string-prefix-p)) (args-70 (condition-case e
(progn (let* ((fn-64 (function string-prefix-p)) (args-65 (condition
(if (and noninteractive (eq request-backend 'url-retrieve)) (progn (
(progn (if (and noninteractive (eq request-backend 'url-retrieve)) (
(let ((response response)) (progn (if (and noninteractive (eq reques
request-testing-assert-redirected-to(#s(request-response :status-cod
(progn (request-testing-assert-redirected-to response "some-path") (
(let ((response (request-testing-sync "redirect/redirect/report/some
(progn (fset 'message (function (lambda (&rest args) (setq messages
(unwind-protect (progn (fset 'message (function (lambda (&rest args)
(let ((orig-message (symbol-function 'message)) messages noerror) (u
(if (and noninteractive request-testing-capture-message) (let ((orig
(let (url-cookie-storage url-cookie-secure-storage url-cookie-file u
(progn (let (url-cookie-storage url-cookie-secure-storage url-cookie
(unwind-protect (progn (let (url-cookie-storage url-cookie-secure-st
(let nil (unwind-protect (progn (let (url-cookie-storage url-cookie-
(let nil (let nil (unwind-protect (progn (let (url-cookie-storage ur
(if (and 'nil (not (memq request-backend 'nil))) (message "REQUEST:
(closure (t) nil (request-testing-server) (if (and 'nil (not (memq r
ert--run-test-internal(#s(ert--test-execution-info :test #s(ert-test
ert-run-test(#s(ert-test :name request-get-simple-redirection :docum
ert-run-or-rerun-test(#s(ert--stats :selector t :tests [#s(ert-test
ert-run-tests(t #f(compiled-function (event-type &rest event-args) #
ert-run-tests-batch(nil)
ert-run-tests-batch-and-exit()
command-line-1(("-L" "." "-L" "tests" "-l" "tests/test-request.el" "
command-line()
normal-top-level()
Test request-get-simple-redirection condition:
(ert-test-failed
((should
(string-prefix-p path
(assoc-default ... data)))
:form
(string-prefix-p "some-path" nil)
:value nil))
FAILED 19/40 request-get-simple-redirection
Contacting host: 127.0.0.1:49125
...
Using python2 works fine:
juergen@samson:~/elisp/emacs-request → make test
make test-3
make[1]: Verzeichnis „/home/juergen/elisp/emacs-request“ wird betreten
EL_REQUEST_TEST_SERVER=tornado make test-2
make[2]: Verzeichnis „/home/juergen/elisp/emacs-request“ wird betreten
EL_REQUEST_BACKEND=url-retrieve make EMACS=emacs CASK=cask test-1
make[3]: Verzeichnis „/home/juergen/elisp/emacs-request“ wird betreten
cask exec emacs -Q -batch \
-L . -L tests -l tests/test-request.el \
-f ert-run-tests-batch-and-exit
Warning: Unknown defun property ‘special’ in request--url-retrieve-callback
Using request-backend = url-retrieve
Using test server: tornado
Running 40 tests (2018-11-30 17:15:05+0100)
passed 1/40 request--curl-absolutify-redirects/complex
passed 2/40 request--curl-absolutify-redirects/simple
passed 3/40 request--curl-absolutify-redirects/with-port
passed 4/40 request--curl-command
passed 5/40 request--curl-preprocess/100
passed 6/40 request--curl-preprocess/200-proxy-connection-established
passed 7/40 request--curl-preprocess/no-redirects
passed 8/40 request--curl-preprocess/two-redirects
passed 9/40 request--netscape-cookie-parse
passed 10/40 request--urlencode-alist/hexified
passed 11/40 request--urlencode-alist/simple
passed 12/40 request-abort-killed-buffer
passed 13/40 request-abort-simple
REQUEST: Skip request-get-broken-redirection for backend url-retrieve.
passed 14/40 request-get-broken-redirection
passed 15/40 request-get-code-client-error
passed 16/40 request-get-code-server-error
passed 17/40 request-get-code-success
passed 18/40 request-get-parse-header-when-400
passed 19/40 request-get-simple-redirection
passed 20/40 request-get-sync
passed 21/40 request-get-timeout
passed 22/40 request-get-with-args
passed 23/40 request-invoke-in-non-existing-directory
passed 24/40 request-multiple-cookies
passed 25/40 request-parse-error-simple
REQUEST: Skip request-post-files/simple-buffer for backend url-retrieve.
passed 26/40 request-post-files/simple-buffer
REQUEST: Skip request-post-files/simple-file for backend url-retrieve.
passed 27/40 request-post-files/simple-file
REQUEST: Skip request-post-files/standard-buffer for backend url-retrieve.
passed 28/40 request-post-files/standard-buffer
REQUEST: Skip request-post-files/standard-data for backend url-retrieve.
passed 29/40 request-post-files/standard-data
REQUEST: Skip request-post-files/standard-file for backend url-retrieve.
passed 30/40 request-post-files/standard-file
passed 31/40 request-post-multibytes
passed 32/40 request-put-simple
passed 33/40 request-put-twice
REQUEST: Skip request-session-cookie for backend url-retrieve.
passed 34/40 request-session-cookie
passed 35/40 request-simple-cookie
passed 36/40 request-simple-delete
passed 37/40 request-simple-get
passed 38/40 request-simple-post
passed 39/40 request-simple-put-json
passed 40/40 request-tfw-server
Ran 40 tests, 40 results as expected (2018-11-30 17:15:20+0100)
...
I am not familiar with flask
/tornado
:tired_face:
though OTOH hand looks like this can be made python3 compatible pretty easily, do you think that's preferable?
Indeed that's preferable. But testing still breaks later when using the the python3 interpreter:
I have added Python 3.4 to the build Matrix:
Bummer about python3 failing. All the more reason to merge this PR!
Thank you. I imagine the pool of users who both make test
this package locally and no longer have python2
on their system vanishingly small. Let us cross the python3 bridge when we get there.
Python 3 is the default on most system in these days. But testserver.py is still uses deprecated Python 2 syntax (print as keyword).
Fixes this issue on Arch Linux: