Hi,

I felt free to fix / change the python test suite to succeed a 'make
distcheck'.

Please have a look at it and feel free to comment.

Darshit, I found the test suite chdir into a temp directory (testdir).
This is not the best idea, because you have to find e.g. the certs which is
only (or cleanly) possible through the 'srcdir' environment variable - which
is relative. This is why I had to use the hard-coded '..' in here:

# step one up because test suite change directory away from $srcdir (don't do
that !!!)
CERTFILE = os.path.abspath(os.path.join('..',os.getenv('srcdir','.'), 'certs',
'wget-cert.pem'))

I did not test if abs_srcdir is exported as well... (if not, we could export
it manually in Makefile.am/AM_TESTS_ENVIRONMENT).

So either we use abs_srcdir or you change the test code to not use chdir.
What do you think ?

Tim
From bf08ac2f5c633b4adb15e1279920f6810566eecd Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tim Rühsen?= <[email protected]>
Date: Thu, 2 Oct 2014 15:54:16 +0200
Subject: [PATCH] fixed python test suite to succeed distcheck

---
 testenv/Makefile.am                | 79 ++++++++++++++------------------------
 testenv/server/http/http_server.py |  3 +-
 2 files changed, 31 insertions(+), 51 deletions(-)

diff --git a/testenv/Makefile.am b/testenv/Makefile.am
index ced19a7..a83267f 100644
--- a/testenv/Makefile.am
+++ b/testenv/Makefile.am
@@ -26,57 +26,36 @@
 # as that of the covered work.


-AUTOMAKE_OPTIONS = parallel-tests
-AM_TESTS_ENVIRONMENT = MAKE_CHECK=True; export MAKE_CHECK;
-TESTS = Test-auth-basic-fail.py             \
-    Test-auth-basic.py                      \
-    Test-auth-both.py                       \
-    Test-auth-digest.py                     \
-    Test-auth-no-challenge.py               \
-    Test-auth-no-challenge-url.py           \
-    Test-auth-retcode.py                    \
-    Test-auth-with-content-disposition.py   \
-    Test-c-full.py                          \
-    Test-Content-disposition-2.py           \
-    Test-Content-disposition.py             \
-    Test-cookie-401.py                      \
-    Test-cookie-domain-mismatch.py          \
-    Test-cookie-expires.py                  \
-    Test-cookie.py                          \
-    Test-Head.py                            \
-    Test--https.py							\
-    Test-O.py                               \
-    Test-Post.py                            \
+PY_TESTS = \
+    Test-auth-basic-fail.py \
+    Test-auth-basic.py \
+    Test-auth-both.py \
+    Test-auth-digest.py \
+    Test-auth-no-challenge.py \
+    Test-auth-no-challenge-url.py \
+    Test-auth-retcode.py \
+    Test-auth-with-content-disposition.py \
+    Test-c-full.py \
+    Test-Content-disposition-2.py \
+    Test-Content-disposition.py \
+    Test-cookie-401.py \
+    Test-cookie-domain-mismatch.py \
+    Test-cookie-expires.py \
+    Test-cookie.py \
+    Test-Head.py \
+    Test--https.py \
+    Test-O.py \
+    Test-Post.py \
     Test--spider-r.py

-XFAIL_TESTS = Test-auth-both.py
+PY_XFAIL_TESTS = Test-auth-both.py

-LOG_COMPILER = python3
+EXTRA_DIST = $(PY_TESTS) $(PY_XFAIL_TESTS) certs conf exc misc server test

-EXTRA_DIST = ColourTerm.py          \
-    FTPServer.py                \
-    HTTPServer.py               \
-    README                  \
-    Test--spider-r.py           \
-    Test--https.py				\
-    Test-Content-disposition-2.py       \
-    Test-Content-disposition.py     \
-    Test-Head.py                \
-    Test-O.py               \
-    Test-Parallel-Proto.py          \
-    Test-Post.py                \
-    Test-Proto.py               \
-    Test-auth-basic-fail.py         \
-    Test-auth-basic.py          \
-    Test-auth-both.py           \
-    Test-auth-digest.py         \
-    Test-auth-no-challenge-url.py       \
-    Test-auth-no-challenge.py       \
-    Test-auth-retcode.py            \
-    Test-auth-with-content-disposition.py   \
-    Test-c-full.py              \
-    Test-cookie-401.py          \
-    Test-cookie-domain-mismatch.py      \
-    Test-cookie-expires.py          \
-    Test-cookie.py              \
-    WgetTest.py
+TESTS = $(PY_TESTS)
+XFAIL_TESTS = $(PY_XFAIL_TESTS)
+
+TEST_EXTENSIONS = .py
+AM_TESTS_ENVIRONMENT = export WGETRC=/dev/null; export SYSTEM_WGETRC=/dev/null; MAKE_CHECK=True; export MAKE_CHECK; export PYTHONPATH=$$PYTHONPATH:$(srcdir);
+PY_LOG_COMPILER = python3
+#AM_PY_LOG_FLAGS diff --git a/testenv/server/http/http_server.py b/testenv/server/http/http_server.py
index 12e0434..b4237ef 100644
--- a/testenv/server/http/http_server.py
+++ b/testenv/server/http/http_server.py
@@ -39,7 +39,8 @@ class HTTPSServer (StoppableHTTPServer):
     def __init__ (self, address, handler):
         BaseServer.__init__ (self, address, handler)
         print (os.getcwd())
-        CERTFILE = os.path.abspath(os.path.join('..', 'certs', 'wget-cert.pem'))
+        # step one up because test suite change directory away from $srcdir (don't do that !!!)
+        CERTFILE = os.path.abspath(os.path.join('..',os.getenv('srcdir','.'), 'certs', 'wget-cert.pem'))
         print (CERTFILE)
         fop = open (CERTFILE)
         print (fop.readline())
--
2.1.1

Attachment: signature.asc
Description: This is a digitally signed message part.

Reply via email to