bug-wget
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug-wget] Fixed python test suite to succeed distcheck


From: 'Darshit Shah'
Subject: Re: [Bug-wget] Fixed python test suite to succeed distcheck
Date: Wed, 8 Oct 2014 17:14:12 +0530
User-agent: Mutt/1.5.23 (2014-03-12)

On 10/02, Tim Rühsen wrote:
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

Hi,

Sorry for the delay in responding. I had already prepared a patch to fix make distcheck on the python tests. Was waiting for the Perl tests to start working perfectly before pushing these.

Some comments about your patch though:

From bf08ac2f5c633b4adb15e1279920f6810566eecd Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tim=20R=C3=BChsen?= <address@hidden>
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)
The automake environment, if I understood it correctly requires *all* tests to be listed in the TESTS variable. The XFAIL_TESTS var is supposed to list the expected failures. Hence, $(PY_XFAIL_TESTS) must be listed under TESTS too.

Also, I would prefer that XFAIL_TESTS explicitly lists the tests which are failing since this variable would be frequently changed as the status of tests change.
+
+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);
The SYSTEM_WGETRC environment variable is not required for the Python tests because all the tests are invoked with the --no-config command line option.
+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

--- end quoted text ---

I've attached my version of the fixes and another patch that lends some code cleanup to the python tests.

Do check it out. I'll push it soon.

--
Thanking You,
Darshit Shah

Attachment: 0001-Fix-make-distcheck-for-Python-tests.patch
Description: Text Data

Attachment: 0002-Minor-optimizations-of-Python-tests.patch
Description: Text Data

Attachment: pgpjpSL0D8Pxv.pgp
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]