Changeset 1a85a3d in mod_gnutls for test/mgstest/tests.py


Ignore:
Timestamp:
Apr 7, 2020, 2:27:05 PM (7 months ago)
Author:
Fiona Klute <fiona.klute@…>
Branches:
master, proxy-ticket
Children:
b0695c6
Parents:
e60e3b9
Message:

mgstest.tests.TestConnection?: Read environment variables at runtime

Previously environment variables were evaluated during init, which
has confusing results if environment variables are changed (e.g. in a
prepare_env hook) between the time the configuration is read and the
test runs.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • test/mgstest/tests.py

    re60e3b9 r1a85a3d  
    140140        self.transport = Transports[transport.upper()]
    141141        self.description = description
    142         if host:
    143             self.host = subst_env(host)
    144         else:
    145             self.host = os.environ.get('TEST_TARGET', 'localhost')
    146         if port:
    147             self.port = int(subst_env(port))
    148         else:
    149             self.port = int(os.environ.get('TEST_PORT', 8000))
     142        self.host = host
     143        self.port = port
    150144
    151145    def __repr__(self):
     
    158152    def run(self, timeout=5.0, conn_log=None, response_log=None):
    159153        """Set up an HTTP connection and run the configured actions."""
     154
     155        if self.host:
     156            self.host = subst_env(self.host)
     157        else:
     158            self.host = os.environ.get('TEST_TARGET', 'localhost')
     159        if self.port:
     160            self.port = int(subst_env(self.port))
     161        else:
     162            self.port = int(os.environ.get('TEST_PORT', 8000))
    160163
    161164        # note: "--logfile" option requires GnuTLS version >= 3.6.7
Note: See TracChangeset for help on using the changeset viewer.