diff --git a/lib/netrc.c b/lib/netrc.c
index b069c8c49a9c74a748a4042b55301f448d81fe39..6b616c6ad9932f010d8074841791e8b9be5ad47b 100644
--- a/lib/netrc.c
+++ b/lib/netrc.c
@@ -80,21 +80,6 @@ int Curl_parsenetrc(const char *host,
 
 #define NETRC DOT_CHAR "netrc"
 
-#ifdef DEBUGBUILD
-  {
-    /* This is a hack to allow testing.
-     * If compiled with --enable-debug and CURL_DEBUG_NETRC is defined,
-     * then it's the path to a substitute .netrc for testing purposes *only* */
-
-    char *override = curl_getenv("CURL_DEBUG_NETRC");
-
-    if(override) {
-      fprintf(stderr, "NETRC: overridden " NETRC " file: %s\n", override);
-      netrcfile = override;
-      netrc_alloc = TRUE;
-    }
-  }
-#endif /* DEBUGBUILD */
   if(!netrcfile) {
     home = curl_getenv("HOME"); /* portable environment reader */
     if(home) {
diff --git a/tests/data/test130 b/tests/data/test130
index 43ab24c09fbc92fd36fa755bd8717bb290678dc2..fbcf5251b458c58c7299eef8d0d2679a97cb5f7b 100644
--- a/tests/data/test130
+++ b/tests/data/test130
@@ -30,9 +30,6 @@ dr-xr-xr-x   5 0        1            512 Oct  1  1997 usr
 #
 # Client-side
 <client>
-<features>
-netrc_debug
-</features>
 <server>
 ftp
 </server>
@@ -40,7 +37,7 @@ ftp
 FTP (optional .netrc; no user/pass) dir list PASV
  </name>
  <command>
---netrc-optional ftp://%HOSTIP:%FTPPORT/
+--netrc-optional --netrc-file log/netrc ftp://%HOSTIP:%FTPPORT/
 </command>
 <file name="log/netrc" >
 # the following two lines were created while testing curl
diff --git a/tests/data/test131 b/tests/data/test131
index 4e9ba6d9a784a0de0e68cb55d0bc9d4a7431d9d9..ad7f9e22aa95341fd120c8d0dc2bf5d991ee5ee1 100644
--- a/tests/data/test131
+++ b/tests/data/test131
@@ -31,9 +31,6 @@ dr-xr-xr-x   5 0        1            512 Oct  1  1997 usr
 #
 # Client-side
 <client>
-<features>
-netrc_debug
-</features>
 <server>
 ftp
 </server>
@@ -41,7 +38,7 @@ ftp
 FTP (optional .netrc; user/no pass) dir list PASV
  </name>
  <command>
---netrc-optional ftp://user2@%HOSTIP:%FTPPORT/
+--netrc-optional --netrc-file log/netrc ftp://user2@%HOSTIP:%FTPPORT/
 </command>
 <file name="log/netrc" >
 # the following two lines were created while testing curl
diff --git a/tests/data/test132 b/tests/data/test132
index 2ff39fb9a7bd887fafde33318f5e9040f82c6d67..8d9e3ed60715cfae7efda2aa4e8b6d29b8ac9f5b 100644
--- a/tests/data/test132
+++ b/tests/data/test132
@@ -30,9 +30,6 @@ dr-xr-xr-x   5 0        1            512 Oct  1  1997 usr
 #
 # Client-side
 <client>
-<features>
-netrc_debug
-</features>
 <server>
 ftp
 </server>
@@ -40,7 +37,7 @@ ftp
 FTP (optional .netrc; user/passwd supplied) dir list PASV
  </name>
  <command>
---netrc-optional ftp://mary:mark@%HOSTIP:%FTPPORT/
+--netrc-optional --netrc-file log/netrc ftp://mary:mark@%HOSTIP:%FTPPORT/
 </command>
 <file name="log/netrc" >
 # the following two lines were created while testing curl
diff --git a/tests/data/test133 b/tests/data/test133
index 2e6b2c3a40147efaa03530ccd18839abdc7d2702..a15cfc3718e2b96513a77f46b149bd34a73fee11 100644
--- a/tests/data/test133
+++ b/tests/data/test133
@@ -30,9 +30,6 @@ dr-xr-xr-x   5 0        1            512 Oct  1  1997 usr
 #
 # Client-side
 <client>
-<features>
-netrc_debug
-</features>
 <server>
 ftp
 </server>
@@ -40,7 +37,7 @@ ftp
 FTP (compulsory .netrc; ignored user/passwd) dir list PASV
  </name>
  <command>
--n ftp://mary:mark@%HOSTIP:%FTPPORT/
+-n --netrc-file log/netrc ftp://mary:mark@%HOSTIP:%FTPPORT/
 </command>
 <file name="log/netrc" >
 # the following two lines were created while testing curl
diff --git a/tests/data/test134 b/tests/data/test134
index 8ff9c190283fc709db599daefefa27c4310bb1c8..83035849eafddbc0c3b5e9c792cabbd153dd6095 100644
--- a/tests/data/test134
+++ b/tests/data/test134
@@ -30,9 +30,6 @@ dr-xr-xr-x   5 0        1            512 Oct  1  1997 usr
 #
 # Client-side
 <client>
-<features>
-netrc_debug
-</features>
 <server>
 ftp
 </server>
@@ -40,7 +37,7 @@ ftp
 FTP (optional .netrc; programmatic user/passwd) dir list PASV
  </name>
  <command>
---netrc-optional -u romulus:rhemus ftp://mary:mark@%HOSTIP:%FTPPORT/
+--netrc-optional --netrc-file log/netrc -u romulus:rhemus ftp://mary:mark@%HOSTIP:%FTPPORT/
 </command>
 <file name="log/netrc" >
 # the following two lines were created while testing curl
diff --git a/tests/data/test257 b/tests/data/test257
index c211c2f4704ff981e75f9b41c9f274e7e3a11a8d..cc3b7f00a3e6bd53bc8fde7605c4cfa3698a0ff3 100644
--- a/tests/data/test257
+++ b/tests/data/test257
@@ -64,9 +64,6 @@ If this is received, the location following worked
 
 # Client-side
 <client>
-<features>
-netrc_debug
-</features>
 <server>
 http
 </server>
@@ -74,7 +71,7 @@ http
 HTTP Location: following with --netrc-optional
  </name>
  <command>
-http://supersite.com/want/257 -L -x http://%HOSTIP:%HTTPPORT --netrc-optional
+http://supersite.com/want/257 -L -x http://%HOSTIP:%HTTPPORT --netrc-optional --netrc-file log/netrc
 </command>
 
 # netrc auth for two out of three sites:
diff --git a/tests/runtests.pl b/tests/runtests.pl
index e37241523571e8e547f5e177a1754596e1c6d528..d931b15b4a1aa7293816a736ec736dc3dae2803a 100755
--- a/tests/runtests.pl
+++ b/tests/runtests.pl
@@ -2146,8 +2146,6 @@ sub checksystem {
             if($feat =~ /debug/i) {
                 # curl was built with --enable-debug
                 $debug_build = 1;
-                # set the NETRC debug env
-                $ENV{'CURL_DEBUG_NETRC'} = "$LOGDIR/netrc";
             }
             if($feat =~ /SSL/i) {
                 # ssl enabled
@@ -2476,20 +2474,12 @@ sub singletest {
                 next;
             }
         }
-	elsif($f eq "axTLS") {
-	    if($has_axtls) {
-		next;
-	    }
-	}
-        elsif($f eq "netrc_debug") {
-            if($debug_build) {
+        elsif($f eq "axTLS") {
+            if($has_axtls) {
                 next;
             }
         }
         elsif($f eq "unittest") {
-            # Unit tests should set the netrc filename directly, thus unset the
-            # environment variable.
-            delete($ENV{'CURL_DEBUG_NETRC'}) if $ENV{'CURL_DEBUG_NETRC'};
             if($debug_build) {
                 next;
             }