From 926e42d4678689195a0bbed210c6d027db7cc390 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tim=20R=C3=BChsen?= <tim.ruehsen@gmx.de>
Date: Fri, 8 Apr 2016 16:31:08 +0200
Subject: [PATCH] Use test file name for temp working directory name

* testenv/test/base_test.py (__init__): Use test file name for name,
  remove 'name' parameter
* testenv/test/http_test.py (__init__): Remove 'name' parameter
* testenv/*.py: Remove TEST_NAME

Using a fixed string (TEST_NAME) to build the working directory
for testing caused random failures (or successes) when tests
share the same TEST_NAME value. Not easy to find without digging
into the python test suite code.
We now use the test file name, which is unique within the test
environment.
---
 testenv/Test--convert-links--content-on-error.py | 2 --
 testenv/Test--https-crl.py                       | 2 --
 testenv/Test--https.py                           | 2 --
 testenv/Test--rejected-log.py                    | 2 --
 testenv/Test--spider-r.py                        | 2 --
 testenv/Test-504.py                              | 2 --
 testenv/Test-Content-disposition-2.py            | 2 --
 testenv/Test-Content-disposition.py              | 2 --
 testenv/Test-Head.py                             | 2 --
 testenv/Test-O.py                                | 2 --
 testenv/Test-Parallel-Proto.py                   | 2 --
 testenv/Test-Post.py                             | 2 --
 testenv/Test-Proto.py                            | 2 --
 testenv/Test-auth-basic-fail.py                  | 2 --
 testenv/Test-auth-basic.py                       | 2 --
 testenv/Test-auth-both.py                        | 2 --
 testenv/Test-auth-digest.py                      | 2 --
 testenv/Test-auth-no-challenge-url.py            | 2 --
 testenv/Test-auth-no-challenge.py                | 2 --
 testenv/Test-auth-retcode.py                     | 2 --
 testenv/Test-auth-with-content-disposition.py    | 2 --
 testenv/Test-c-full.py                           | 2 --
 testenv/Test-condget.py                          | 2 --
 testenv/Test-cookie-401.py                       | 2 --
 testenv/Test-cookie-domain-mismatch.py           | 2 --
 testenv/Test-cookie-expires.py                   | 2 --
 testenv/Test-cookie.py                           | 2 --
 testenv/Test-hsts.py                             | 2 --
 testenv/Test-metalink-http.py                    | 2 --
 testenv/Test-metalink-xml.py                     | 2 --
 testenv/Test-redirect-crash.py                   | 2 --
 testenv/Test-reserved-chars.py                   | 2 --
 testenv/test/base_test.py                        | 5 +++--
 testenv/test/http_test.py                        | 4 +---
 34 files changed, 4 insertions(+), 69 deletions(-)
 mode change 100755 => 100644 testenv/Test--convert-links--content-on-error.py
 mode change 100755 => 100644 testenv/Test--https-crl.py
 mode change 100755 => 100644 testenv/Test--https.py
 mode change 100755 => 100644 testenv/Test--rejected-log.py
 mode change 100755 => 100644 testenv/Test--spider-r.py
 mode change 100755 => 100644 testenv/Test-504.py
 mode change 100755 => 100644 testenv/Test-Content-disposition-2.py
 mode change 100755 => 100644 testenv/Test-Content-disposition.py
 mode change 100755 => 100644 testenv/Test-Head.py
 mode change 100755 => 100644 testenv/Test-O.py
 mode change 100755 => 100644 testenv/Test-Parallel-Proto.py
 mode change 100755 => 100644 testenv/Test-Post.py
 mode change 100755 => 100644 testenv/Test-Proto.py
 mode change 100755 => 100644 testenv/Test-auth-basic-fail.py
 mode change 100755 => 100644 testenv/Test-auth-basic.py
 mode change 100755 => 100644 testenv/Test-auth-both.py
 mode change 100755 => 100644 testenv/Test-auth-digest.py
 mode change 100755 => 100644 testenv/Test-auth-no-challenge-url.py
 mode change 100755 => 100644 testenv/Test-auth-no-challenge.py
 mode change 100755 => 100644 testenv/Test-auth-retcode.py
 mode change 100755 => 100644 testenv/Test-auth-with-content-disposition.py
 mode change 100755 => 100644 testenv/Test-c-full.py
 mode change 100755 => 100644 testenv/Test-condget.py
 mode change 100755 => 100644 testenv/Test-cookie-401.py
 mode change 100755 => 100644 testenv/Test-cookie-domain-mismatch.py
 mode change 100755 => 100644 testenv/Test-cookie-expires.py
 mode change 100755 => 100644 testenv/Test-cookie.py
 mode change 100755 => 100644 testenv/Test-hsts.py
 mode change 100755 => 100644 testenv/Test-metalink-http.py
 mode change 100755 => 100644 testenv/Test-metalink-xml.py
 mode change 100755 => 100644 testenv/Test-redirect-crash.py
 mode change 100755 => 100644 testenv/Test-reserved-chars.py

diff --git a/testenv/Test--convert-links--content-on-error.py b/testenv/Test--convert-links--content-on-error.py
old mode 100755
new mode 100644
index bfa9d9b4..37fcc475
--- a/testenv/Test--convert-links--content-on-error.py
+++ b/testenv/Test--convert-links--content-on-error.py
@@ -6,7 +6,6 @@ from misc.wget_file import WgetFile
 """
     This test ensures that Wget link conversion works also on HTTP error pages.
 """
-TEST_NAME = "Test--convert-links--content-on-error"
 ############# File Definitions ###############################################
 a_x_FileContent = """
 <!DOCTYPE html>
@@ -70,7 +69,6 @@ post_test = {
 }
 
 err = HTTPTest (
-                name=TEST_NAME,
                 pre_hook=pre_test,
                 test_params=test_options,
                 post_hook=post_test
diff --git a/testenv/Test--https-crl.py b/testenv/Test--https-crl.py
old mode 100755
new mode 100644
index 88ea7f14..7f957f9a
--- a/testenv/Test--https-crl.py
+++ b/testenv/Test--https-crl.py
@@ -8,7 +8,6 @@ import os
 """
     This test ensures that Wget can download files from HTTPS Servers
 """
-TEST_NAME = "HTTPS CRL"
 if os.getenv('SSL_TESTS') is None:
     exit (77)
 
@@ -43,7 +42,6 @@ post_test = {
 }
 
 err = HTTPTest (
-                name=TEST_NAME,
                 pre_hook=pre_test,
                 test_params=test_options,
                 post_hook=post_test,
diff --git a/testenv/Test--https.py b/testenv/Test--https.py
old mode 100755
new mode 100644
index d2338350..426c3683
--- a/testenv/Test--https.py
+++ b/testenv/Test--https.py
@@ -8,7 +8,6 @@ import os
 """
     This test ensures that Wget can download files from HTTPS Servers
 """
-TEST_NAME = "HTTPS Downloads"
 if os.getenv('SSL_TESTS') is None:
     exit (77)
 
@@ -48,7 +47,6 @@ post_test = {
 }
 
 err = HTTPTest (
-                name=TEST_NAME,
                 pre_hook=pre_test,
                 test_params=test_options,
                 post_hook=post_test,
diff --git a/testenv/Test--rejected-log.py b/testenv/Test--rejected-log.py
old mode 100755
new mode 100644
index 03f62c29..ae6254ab
--- a/testenv/Test--rejected-log.py
+++ b/testenv/Test--rejected-log.py
@@ -6,7 +6,6 @@ from misc.wget_file import WgetFile
 """
     This test executed Wget in recursive mode with a rejected log outputted.
 """
-TEST_NAME = "Rejected Log"
 ############# File Definitions ###############################################
 mainpage = """
 <html>
@@ -93,7 +92,6 @@ post_test = {
 }
 
 err = HTTPTest (
-                name=TEST_NAME,
                 pre_hook=pre_test,
                 test_params=test_options,
                 post_hook=post_test
diff --git a/testenv/Test--spider-r.py b/testenv/Test--spider-r.py
old mode 100755
new mode 100644
index 5eb01e46..992d5af5
--- a/testenv/Test--spider-r.py
+++ b/testenv/Test--spider-r.py
@@ -6,7 +6,6 @@ from misc.wget_file import WgetFile
 """
     This test executed Wget in Spider mode with recursive retrieval.
 """
-TEST_NAME = "Recursive Spider"
 ############# File Definitions ###############################################
 mainpage = """
 <html>
@@ -97,7 +96,6 @@ post_test = {
 }
 
 err = HTTPTest (
-                name=TEST_NAME,
                 pre_hook=pre_test,
                 test_params=test_options,
                 post_hook=post_test
diff --git a/testenv/Test-504.py b/testenv/Test-504.py
old mode 100755
new mode 100644
index 4d82704f..036f85d5
--- a/testenv/Test-504.py
+++ b/testenv/Test-504.py
@@ -18,7 +18,6 @@ from misc.wget_file import WgetFile
     considered 504 as a general Server Error, it would be a fatal failure and
     Wget would request File1 only once.
 """
-TEST_NAME = "504 Gateway Timeouts"
 ############# File Definitions ###############################################
 File1 = """All happy families are alike;
 Each unhappy family is unhappy in its own way"""
@@ -63,7 +62,6 @@ post_test = {
 }
 
 err = HTTPTest (
-                name=TEST_NAME,
                 pre_hook=pre_test,
                 test_params=test_options,
                 post_hook=post_test
diff --git a/testenv/Test-Content-disposition-2.py b/testenv/Test-Content-disposition-2.py
old mode 100755
new mode 100644
index 44ea77db..debd8333
--- a/testenv/Test-Content-disposition-2.py
+++ b/testenv/Test-Content-disposition-2.py
@@ -7,7 +7,6 @@ from misc.wget_file import WgetFile
     This test ensures that Wget parses the Content-Disposition header
     correctly and creates the appropriate file when the said filename exists.
 """
-TEST_NAME = "Content Disposition Clobber"
 ############# File Definitions ###############################################
 File1 = "Teapot"
 File2 = "The Teapot Protocol"
@@ -45,7 +44,6 @@ post_test = {
 }
 
 err = HTTPTest (
-                name=TEST_NAME,
                 pre_hook=pre_test,
                 test_params=test_options,
                 post_hook=post_test
diff --git a/testenv/Test-Content-disposition.py b/testenv/Test-Content-disposition.py
old mode 100755
new mode 100644
index 027a9e8c..d5177a7f
--- a/testenv/Test-Content-disposition.py
+++ b/testenv/Test-Content-disposition.py
@@ -7,7 +7,6 @@ from misc.wget_file import WgetFile
     This test ensures that Wget parses the Content-Disposition header
     correctly and creates a local file accordingly.
 """
-TEST_NAME = "Content Disposition Header"
 ############# File Definitions ###############################################
 File1 = """All that is gold does not glitter,
         Not all those who wander are lost;
@@ -47,7 +46,6 @@ post_test = {
 }
 
 err = HTTPTest (
-                name=TEST_NAME,
                 pre_hook=pre_test,
                 test_params=test_options,
                 post_hook=post_test
diff --git a/testenv/Test-Head.py b/testenv/Test-Head.py
old mode 100755
new mode 100644
index 77e5c575..b653b2da
--- a/testenv/Test-Head.py
+++ b/testenv/Test-Head.py
@@ -7,7 +7,6 @@ from misc.wget_file import WgetFile
     This test ensures that Wget correctly handles responses to HEAD requests
     and does not actually download any data
 """
-TEST_NAME = "HEAD Requests"
 ############# File Definitions ###############################################
 File1 = "You shall not pass!"
 
@@ -35,7 +34,6 @@ post_test = {
 }
 
 err = HTTPTest (
-                name=TEST_NAME,
                 pre_hook=pre_test,
                 test_params=test_options,
                 post_hook=post_test
diff --git a/testenv/Test-O.py b/testenv/Test-O.py
old mode 100755
new mode 100644
index 90cb146a..f93e118b
--- a/testenv/Test-O.py
+++ b/testenv/Test-O.py
@@ -7,7 +7,6 @@ from misc.wget_file import WgetFile
     This test ensures that Wget correctly handles the -O command for output
     filenames.
 """
-TEST_NAME = "Output Filename Command"
 ############# File Definitions ###############################################
 File1 = "Test Contents."
 
@@ -36,7 +35,6 @@ post_test = {
 }
 
 err = HTTPTest (
-                name=TEST_NAME,
                 pre_hook=pre_test,
                 test_params=test_options,
                 post_hook=post_test
diff --git a/testenv/Test-Parallel-Proto.py b/testenv/Test-Parallel-Proto.py
old mode 100755
new mode 100644
index beb768c5..cc744aea
--- a/testenv/Test-Parallel-Proto.py
+++ b/testenv/Test-Parallel-Proto.py
@@ -8,7 +8,6 @@ from misc.wget_file import WgetFile
     This is a Prototype Test File for multiple servers.
     Ideally this File should be copied and edited to write new tests.
 """
-TEST_NAME = "Parallel Prototype"
 ############# File Definitions ###############################################
 File1 = "Would you like some Tea?"
 File2 = "With lemon or cream?"
@@ -44,7 +43,6 @@ post_test = {
 }
 
 err = HTTPTest (
-                name=TEST_NAME,
                 pre_hook=pre_test,
                 test_params=test_options,
                 post_hook=post_test,
diff --git a/testenv/Test-Post.py b/testenv/Test-Post.py
old mode 100755
new mode 100644
index 223641af..b2fa7d7d
--- a/testenv/Test-Post.py
+++ b/testenv/Test-Post.py
@@ -6,7 +6,6 @@ from misc.wget_file import WgetFile
 """
     Simple test for HTTP POST Requests usiong the --method command
 """
-TEST_NAME = "HTTP POST Requests"
 ############# File Definitions ###############################################
 File1 = """A reader lives a thousand lives before he dies, said Jojen.
 The man who never reads lives only one"""
@@ -39,7 +38,6 @@ post_test = {
 }
 
 err = HTTPTest (
-                name=TEST_NAME,
                 pre_hook=pre_test,
                 test_params=test_options,
                 post_hook=post_test
diff --git a/testenv/Test-Proto.py b/testenv/Test-Proto.py
old mode 100755
new mode 100644
index cc71fb9d..6dcbfb69
--- a/testenv/Test-Proto.py
+++ b/testenv/Test-Proto.py
@@ -8,7 +8,6 @@ from misc.wget_file import WgetFile
     This is a Prototype Test File.
     Ideally this File should be copied and edited to write new tests.
 """
-TEST_NAME = "Prototype"
 ############# File Definitions ###############################################
 File1 = "Would you like some Tea?"
 File2 = "With lemon or cream?"
@@ -65,7 +64,6 @@ post_test = {
 }
 
 err = HTTPTest (
-                name=TEST_NAME,
                 pre_hook=pre_test,
                 test_params=test_options,
                 post_hook=post_test,
diff --git a/testenv/Test-auth-basic-fail.py b/testenv/Test-auth-basic-fail.py
old mode 100755
new mode 100644
index 0badf693..4d32bea5
--- a/testenv/Test-auth-basic-fail.py
+++ b/testenv/Test-auth-basic-fail.py
@@ -7,7 +7,6 @@ from misc.wget_file import WgetFile
     This test ensures that Wget returns the correct exit code when Basic
     authentcation failes due to a username/password error.
 """
-TEST_NAME = "Basic Authentication Failure"
 ############# File Definitions ###############################################
 File1 = "I am an invisble man."
 
@@ -42,7 +41,6 @@ post_test = {
 }
 
 err = HTTPTest (
-                name=TEST_NAME,
                 pre_hook=pre_test,
                 test_params=test_options,
                 post_hook=post_test
diff --git a/testenv/Test-auth-basic.py b/testenv/Test-auth-basic.py
old mode 100755
new mode 100644
index 49bb27b2..b94faaa6
--- a/testenv/Test-auth-basic.py
+++ b/testenv/Test-auth-basic.py
@@ -8,7 +8,6 @@ from misc.wget_file import WgetFile
     Also, we ensure that Wget saves the host after a successfull auth and
     doesn't wait for a challenge the second time.
 """
-TEST_NAME = "Basic Authorization"
 ############# File Definitions ###############################################
 File1 = "I am an invisble man."
 File2 = "I too am an invisible man."
@@ -50,7 +49,6 @@ post_test = {
 }
 
 err = HTTPTest (
-                name=TEST_NAME,
                 pre_hook=pre_test,
                 test_params=test_options,
                 post_hook=post_test
diff --git a/testenv/Test-auth-both.py b/testenv/Test-auth-both.py
old mode 100755
new mode 100644
index 23bdaf57..5913a1ab
--- a/testenv/Test-auth-both.py
+++ b/testenv/Test-auth-both.py
@@ -8,7 +8,6 @@ from misc.wget_file import WgetFile
     Also, we ensure that Wget saves the host after a successfull auth and
     doesn't wait for a challenge the second time.
 """
-TEST_NAME = "Multiple authentication support"
 ############# File Definitions ###############################################
 File1 = "Would you like some Tea?"
 File2 = "With lemon or cream?"
@@ -78,7 +77,6 @@ post_test = {
 }
 
 err = HTTPTest (
-                name=TEST_NAME,
                 pre_hook=pre_test,
                 test_params=test_options,
                 post_hook=post_test
diff --git a/testenv/Test-auth-digest.py b/testenv/Test-auth-digest.py
old mode 100755
new mode 100644
index 6f58daa5..a5e624fb
--- a/testenv/Test-auth-digest.py
+++ b/testenv/Test-auth-digest.py
@@ -6,7 +6,6 @@ from misc.wget_file import WgetFile
 """
     This test ensures Wget's Digest Authorization Negotiation.
 """
-TEST_NAME = "Digest Authorization"
 ############# File Definitions ###############################################
 File1 = "Need a cookie?"
 File2 = "Want cookies with milk!"
@@ -57,7 +56,6 @@ post_test = {
 }
 
 err = HTTPTest (
-                name=TEST_NAME,
                 pre_hook=pre_test,
                 test_params=test_options,
                 post_hook=post_test
diff --git a/testenv/Test-auth-no-challenge-url.py b/testenv/Test-auth-no-challenge-url.py
old mode 100755
new mode 100644
index 9e062600..60252325
--- a/testenv/Test-auth-no-challenge-url.py
+++ b/testenv/Test-auth-no-challenge-url.py
@@ -7,7 +7,6 @@ from misc.wget_file import WgetFile
     This test ensures Wget's Basic Authorization Negotiation, when credentials
     are provided in-URL
 """
-TEST_NAME = "Auth no challenge in URL"
 ############# File Definitions ###############################################
 File1 = "Need a cookie?"
 
@@ -45,7 +44,6 @@ post_test = {
 }
 
 err = HTTPTest (
-                name=TEST_NAME,
                 pre_hook=pre_test,
                 test_params=test_options,
                 post_hook=post_test
diff --git a/testenv/Test-auth-no-challenge.py b/testenv/Test-auth-no-challenge.py
old mode 100755
new mode 100644
index d155d725..2022ac80
--- a/testenv/Test-auth-no-challenge.py
+++ b/testenv/Test-auth-no-challenge.py
@@ -7,7 +7,6 @@ from misc.wget_file import WgetFile
     This test ensures Wget's Basic Authorization Negotiation, when the
     --auth-no-challenge command is used.
 """
-TEST_NAME = "Auth No Challenge Command"
 ############# File Definitions ###############################################
 File1 = "Need a cookie?"
 
@@ -45,7 +44,6 @@ post_test = {
 }
 
 err = HTTPTest (
-                name=TEST_NAME,
                 pre_hook=pre_test,
                 test_params=test_options,
                 post_hook=post_test
diff --git a/testenv/Test-auth-retcode.py b/testenv/Test-auth-retcode.py
old mode 100755
new mode 100644
index 13eb583b..6414b5b3
--- a/testenv/Test-auth-retcode.py
+++ b/testenv/Test-auth-retcode.py
@@ -8,7 +8,6 @@ from misc.wget_file import WgetFile
     a 403 Forbidden by the Server.
 """
 
-TEST_NAME = "Forbidden Retcode"
 
 ############# File Definitions ###############################################
 File1 = "Apples and Oranges? Really?"
@@ -41,7 +40,6 @@ post_test = {
 }
 
 err = HTTPTest (
-                name=TEST_NAME,
                 pre_hook=pre_test,
                 test_params=test_options,
                 post_hook=post_test
diff --git a/testenv/Test-auth-with-content-disposition.py b/testenv/Test-auth-with-content-disposition.py
old mode 100755
new mode 100644
index df28c91e..074b0933
--- a/testenv/Test-auth-with-content-disposition.py
+++ b/testenv/Test-auth-with-content-disposition.py
@@ -7,7 +7,6 @@ from misc.wget_file import WgetFile
     This test ensures that Wget handles Content-Disposition correctly when
     coupled with Authentication
 """
-TEST_NAME = "Authentication with Content Disposition"
 ############# File Definitions ###############################################
 File1 = "Need a cookie?"
 
@@ -45,7 +44,6 @@ post_test = {
 }
 
 err = HTTPTest (
-                name=TEST_NAME,
                 pre_hook=pre_test,
                 test_params=test_options,
                 post_hook=post_test
diff --git a/testenv/Test-c-full.py b/testenv/Test-c-full.py
old mode 100755
new mode 100644
index 6dc3f5e2..ada3c047
--- a/testenv/Test-c-full.py
+++ b/testenv/Test-c-full.py
@@ -7,7 +7,6 @@ from misc.wget_file import WgetFile
     Test Wget's response when the file requested already exists on disk with
     a filesize greater than or equal to the requested file.
 """
-TEST_NAME = "Test continue option"
 ############# File Definitions ###############################################
 File1 = "abababababababababababababababababababababababababababababababababab"
 File2 = "ababababababababababababababababababab"
@@ -44,7 +43,6 @@ post_test = {
 }
 
 err = HTTPTest (
-                name=TEST_NAME,
                 pre_hook=pre_test,
                 test_params=test_options,
                 post_hook=post_test
diff --git a/testenv/Test-condget.py b/testenv/Test-condget.py
old mode 100755
new mode 100644
index c9e8b2ab..297556ee
--- a/testenv/Test-condget.py
+++ b/testenv/Test-condget.py
@@ -6,7 +6,6 @@ from misc.wget_file import WgetFile
 """
     Simple test for HTTP Conditional-GET Requests using the -N command
 """
-TEST_NAME = "HTTP Conditional-GET Requests"
 ############# File Definitions ###############################################
 # Keep same length !
 Cont1 = """THIS IS 1 FILE"""
@@ -131,7 +130,6 @@ post_test = {
 }
 
 err = HTTPTest (
-                name=TEST_NAME,
                 pre_hook=pre_test,
                 test_params=test_options,
                 post_hook=post_test
diff --git a/testenv/Test-cookie-401.py b/testenv/Test-cookie-401.py
old mode 100755
new mode 100644
index 4ffb1ff9..b6ad5b88
--- a/testenv/Test-cookie-401.py
+++ b/testenv/Test-cookie-401.py
@@ -7,7 +7,6 @@ from misc.wget_file import WgetFile
     This test ensures that Wget stores the cookie even in the event of a
     401 Unauthorized Response
 """
-TEST_NAME = "Basic Cookie 401 Response"
 ############# File Definitions ###############################################
 File1 = """All happy families are alike;
 Each unhappy family is unhappy in its own way"""
@@ -50,7 +49,6 @@ post_test = {
 }
 
 err = HTTPTest (
-                name=TEST_NAME,
                 pre_hook=pre_test,
                 test_params=test_options,
                 post_hook=post_test
diff --git a/testenv/Test-cookie-domain-mismatch.py b/testenv/Test-cookie-domain-mismatch.py
old mode 100755
new mode 100644
index 05b3289c..06a9b691
--- a/testenv/Test-cookie-domain-mismatch.py
+++ b/testenv/Test-cookie-domain-mismatch.py
@@ -7,7 +7,6 @@ from misc.wget_file import WgetFile
     This test ensures that Wget identifies bad servers trying to set cookies
     for a different domain and rejects them.
 """
-TEST_NAME = "Cookie Domain Mismatch"
 ############# File Definitions ###############################################
 File1 = "Would you care for a cup of coffee?"
 File2 = "Anyone for chocochip cookies?"
@@ -49,7 +48,6 @@ post_test = {
 }
 
 err = HTTPTest (
-                name=TEST_NAME,
                 pre_hook=pre_test,
                 test_params=test_options,
                 post_hook=post_test
diff --git a/testenv/Test-cookie-expires.py b/testenv/Test-cookie-expires.py
old mode 100755
new mode 100644
index 06245499..16fb980f
--- a/testenv/Test-cookie-expires.py
+++ b/testenv/Test-cookie-expires.py
@@ -8,7 +8,6 @@ from misc.wget_file import WgetFile
     Simultaneuously, we also check if multiple cookies to the same domain
     are handled correctly
 """
-TEST_NAME = "Cookie Expires"
 ############# File Definitions ###############################################
 File1 = "Hello World!"
 File2 = "'Ello! This is Amazing!"
@@ -72,7 +71,6 @@ post_test = {
 }
 
 err = HTTPTest (
-                name=TEST_NAME,
                 pre_hook=pre_test,
                 test_params=test_options,
                 post_hook=post_test
diff --git a/testenv/Test-cookie.py b/testenv/Test-cookie.py
old mode 100755
new mode 100644
index 13935181..ba6c055e
--- a/testenv/Test-cookie.py
+++ b/testenv/Test-cookie.py
@@ -6,7 +6,6 @@ from misc.wget_file import WgetFile
 """
     This test ensures that Wget's cookie jar support works correctly.
 """
-TEST_NAME = "Basic Cookie Functionality"
 ############# File Definitions ###############################################
 File1 = """All happy families are alike;
 Each unhappy family is unhappy in its own way"""
@@ -48,7 +47,6 @@ post_test = {
 }
 
 err = HTTPTest (
-                name=TEST_NAME,
                 pre_hook=pre_test,
                 test_params=test_options,
                 post_hook=post_test
diff --git a/testenv/Test-hsts.py b/testenv/Test-hsts.py
old mode 100755
new mode 100644
index 64f84af6..f601ba6a
--- a/testenv/Test-hsts.py
+++ b/testenv/Test-hsts.py
@@ -10,7 +10,6 @@ import os
 This test makes sure Wget can parse a given HSTS database and apply the indicated HSTS policy.
 """
 
-TEST_NAME = "HSTS basic test"
 print (os.getenv('SSL_TESTS'))
 if os.getenv('SSL_TESTS') is None:
     exit (77)
@@ -63,7 +62,6 @@ test_options = {
 }
 
 test = HTTPTest(
-        name = TEST_NAME,
         pre_hook = pre_test,
         post_hook = post_test,
         test_params = test_options,
diff --git a/testenv/Test-metalink-http.py b/testenv/Test-metalink-http.py
old mode 100755
new mode 100644
index 53b08018..993642b2
--- a/testenv/Test-metalink-http.py
+++ b/testenv/Test-metalink-http.py
@@ -9,7 +9,6 @@ from base64 import b64encode
 """
     This is to test Metalink as HTTP file support in Wget.
 """
-TEST_NAME = "Metalink in HTTP"
 
 # Helper function for hostname, port and digest substitution
 def SubstituteServerInfo (text, host, port, digest):
@@ -109,7 +108,6 @@ post_test = {
 }
 
 http_test = HTTPTest (
-                name=TEST_NAME,
                 pre_hook=pre_test,
                 test_params=test_options,
                 post_hook=post_test,
diff --git a/testenv/Test-metalink-xml.py b/testenv/Test-metalink-xml.py
old mode 100755
new mode 100644
index eded04d6..16591654
--- a/testenv/Test-metalink-xml.py
+++ b/testenv/Test-metalink-xml.py
@@ -8,7 +8,6 @@ import hashlib
 """
     This is to test Metalink as XML file support in Wget.
 """
-TEST_NAME = "Metalink in XML"
 ############# File Definitions ###############################################
 File1 = "Would you like some Tea?"
 File1_lowPref = "Do not take this"
@@ -69,7 +68,6 @@ post_test = {
 }
 
 http_test = HTTPTest (
-                name=TEST_NAME,
                 pre_hook=pre_test,
                 test_params=test_options,
                 post_hook=post_test,
diff --git a/testenv/Test-redirect-crash.py b/testenv/Test-redirect-crash.py
old mode 100755
new mode 100644
index ac37b523..1f5bb0da
--- a/testenv/Test-redirect-crash.py
+++ b/testenv/Test-redirect-crash.py
@@ -20,7 +20,6 @@ redirected = [
         "File%20formats/Images/SVG,%20Scalable%20Vector%20Graphics/html,%20W3C%20v1.2%20rec%20(tiny)/directory/"
 ]
 
-TEST_NAME = "Redirection crash"
 ############# File Definitions ###############################################
 Index = ""
 for i in urls:
@@ -65,7 +64,6 @@ post_test = {
 }
 
 err = HTTPTest (
-                name=TEST_NAME,
                 pre_hook=pre_test,
                 test_params=test_options,
                 post_hook=post_test
diff --git a/testenv/Test-reserved-chars.py b/testenv/Test-reserved-chars.py
old mode 100755
new mode 100644
index e5d33d07..fb617f54
--- a/testenv/Test-reserved-chars.py
+++ b/testenv/Test-reserved-chars.py
@@ -11,7 +11,6 @@ This test ensures that Wget keeps reserved characters in URLs in non-UTF-8 chars
 # so we need to set LC_ALL="C" in order to reproduce it.
 environ["LC_ALL"] = "C"
 
-TEST_NAME = "URLs with reserved characters"
 ######### File Definitions #########
 RequestList = [
     [
@@ -50,7 +49,6 @@ post_test = {
 }
 
 err = HTTPTest (
-                name=TEST_NAME,
                 pre_hook=pre_test,
                 test_params=test_options,
                 post_hook=post_test
diff --git a/testenv/test/base_test.py b/testenv/test/base_test.py
index 9bb4151b..b0087e9e 100644
--- a/testenv/test/base_test.py
+++ b/testenv/test/base_test.py
@@ -4,6 +4,7 @@ import shlex
 import traceback
 import re
 import time
+import sys
 from subprocess import call
 from misc.colour_terminal import print_red, print_blue
 from exc.test_failed import TestFailed
@@ -22,12 +23,12 @@ class BaseTest:
         * instantiate_server_by(protocol)
     """
 
-    def __init__(self, name, pre_hook, test_params, post_hook, protocols, req_protocols):
+    def __init__(self, pre_hook, test_params, post_hook, protocols, req_protocols):
         """
         Define the class-wide variables (or attributes).
         Attributes should not be defined outside __init__.
         """
-        self.name = name
+        self.name = os.path.basename(os.path.realpath(sys.argv[0]))
         # if pre_hook == None, then {} (an empty dict object) is passed to
         # self.pre_configs
         self.pre_configs = pre_hook or {}
diff --git a/testenv/test/http_test.py b/testenv/test/http_test.py
index 5a13d4f6..fef0c2ef 100644
--- a/testenv/test/http_test.py
+++ b/testenv/test/http_test.py
@@ -13,14 +13,12 @@ class HTTPTest(BaseTest):
     # immediately after the call to Wget returns.
 
     def __init__(self,
-                 name="Unnamed Test",
                  pre_hook=None,
                  test_params=None,
                  post_hook=None,
                  protocols=(HTTP,),
                  req_protocols=None):
-        super(HTTPTest, self).__init__(name,
-                                       pre_hook,
+        super(HTTPTest, self).__init__(pre_hook,
                                        test_params,
                                        post_hook,
                                        protocols,