diff options
author | Florent Xicluna <florent.xicluna@gmail.com> | 2010-09-13 16:35:02 (GMT) |
---|---|---|
committer | Florent Xicluna <florent.xicluna@gmail.com> | 2010-09-13 16:35:02 (GMT) |
commit | dc69e7217a78dfbc3586f07920a4c6967baaa275 (patch) | |
tree | 80b98d269feb9bd8ad99831264a3631c6d33b324 /Lib/test/regrtest.py | |
parent | 1df1536fb98c1c2bbeefe373bc38877129f905e1 (diff) | |
download | cpython-dc69e7217a78dfbc3586f07920a4c6967baaa275.zip cpython-dc69e7217a78dfbc3586f07920a4c6967baaa275.tar.gz cpython-dc69e7217a78dfbc3586f07920a4c6967baaa275.tar.bz2 |
Make test.regrtest.__file__ absolute, this was not always the case when running profile or trace, for example. (issue #9323)
Diffstat (limited to 'Lib/test/regrtest.py')
-rwxr-xr-x | Lib/test/regrtest.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/Lib/test/regrtest.py b/Lib/test/regrtest.py index 308baf4..366cedf 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 |