From: Florent Xicluna Date: Mon, 13 Sep 2010 16:35:02 +0000 (+0000) Subject: Make test.regrtest.__file__ absolute, this was not always the case when running profi... X-Git-Tag: v3.2a3~286 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=dc69e7217a78dfbc3586f07920a4c6967baaa275;p=python Make test.regrtest.__file__ absolute, this was not always the case when running profile or trace, for example. (issue #9323) --- diff --git a/Lib/test/regrtest.py b/Lib/test/regrtest.py index 308baf4627..366cedfda1 100755 --- a/Lib/test/regrtest.py +++ b/Lib/test/regrtest.py @@ -1458,7 +1458,13 @@ class _ExpectedSkips: return self.expected if __name__ == '__main__': - # Simplification for findtestdir(). + # findtestdir() gets the dirname out of __file__, so we have to make it + # absolute before changing the working directory. + # For example __file__ may be relative when running trace or profile. + # See issue #9323. + __file__ = os.path.abspath(__file__) + + # sanity check assert __file__ == os.path.abspath(sys.argv[0]) # When tests are run from the Python build directory, it is best practice diff --git a/Misc/NEWS b/Misc/NEWS index 2281892327..2392b24428 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -142,6 +142,12 @@ Tools/Demos as wide (UCS4) unicode builds for both the host interpreter (embedded inside gdb) and the interpreter under test. +Tests +----- + +- Issue #9323: Make test.regrtest.__file__ absolute, this was not always the + case when running profile or trace, for example. + Build -----