D5199: test: fix self._testdir to use ues the right mercurial library during testing
This revision was automatically updated to reflect the committed changes. Closed by commit rHG78e5b9d815fa: test: fix self._testdir to use the right mercurial library during testing (authored by sangeet259, committed by ). CHANGED PRIOR TO COMMIT https://phab.mercurial-scm.org/D5199?vs=12390=12392#toc REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D5199?vs=12390=12392 REVISION DETAIL https://phab.mercurial-scm.org/D5199 AFFECTED FILES tests/run-tests.py CHANGE DETAILS diff --git a/tests/run-tests.py b/tests/run-tests.py --- a/tests/run-tests.py +++ b/tests/run-tests.py @@ -2543,17 +2543,18 @@ os.umask(oldmask) def _run(self, testdescs): +testdir = getcwdb() self._testdir = osenvironb[b'TESTDIR'] = getcwdb() # assume all tests in same folder for now if testdescs: pathname = os.path.dirname(testdescs[0]['path']) if pathname: -osenvironb[b'TESTDIR'] = os.path.join(osenvironb[b'TESTDIR'], - pathname) +testdir = os.path.join(testdir, pathname) +self._testdir = osenvironb[b'TESTDIR'] = testdir if self.options.outputdir: self._outputdir = canonpath(_bytespath(self.options.outputdir)) else: -self._outputdir = self._testdir +self._outputdir = getcwdb() if testdescs and pathname: self._outputdir = os.path.join(self._outputdir, pathname) previoustimes = {} @@ -2901,7 +2902,7 @@ testcls = cls break -refpath = os.path.join(self._testdir, path) +refpath = os.path.join(getcwdb(), path) tmpdir = os.path.join(self._hgtmp, b'child%d' % count) # extra keyword parameters. 'case' is used by .t tests To: sangeet259, #hg-reviewers Cc: yuja, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5199: test: fix self._testdir to use ues the right mercurial library during testing
yuja added a comment. Queued, thanks. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D5199 To: sangeet259, #hg-reviewers Cc: yuja, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: D5199: test: fix self._testdir to use ues the right mercurial library during testing
Queued, thanks. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5199: test: fix self._testdir to use ues the right mercurial library during testing
sangeet259 added a comment. @yuja This passes the tests now. I had missed the subsequent code that was dependent on the earlier initialisation of `self._testdir`. Fixed it. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D5199 To: sangeet259, #hg-reviewers Cc: yuja, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5199: test: fix self._testdir to use ues the right mercurial library during testing
sangeet259 updated this revision to Diff 12390. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D5199?vs=12389=12390 REVISION DETAIL https://phab.mercurial-scm.org/D5199 AFFECTED FILES tests/run-tests.py CHANGE DETAILS diff --git a/tests/run-tests.py b/tests/run-tests.py --- a/tests/run-tests.py +++ b/tests/run-tests.py @@ -2542,17 +2542,18 @@ os.umask(oldmask) def _run(self, testdescs): +testdir = getcwdb() self._testdir = osenvironb[b'TESTDIR'] = getcwdb() # assume all tests in same folder for now if testdescs: pathname = os.path.dirname(testdescs[0]['path']) if pathname: -osenvironb[b'TESTDIR'] = os.path.join(osenvironb[b'TESTDIR'], - pathname) +testdir = os.path.join(testdir,pathname) +self._testdir = osenvironb[b'TESTDIR'] = testdir if self.options.outputdir: self._outputdir = canonpath(_bytespath(self.options.outputdir)) else: -self._outputdir = self._testdir +self._outputdir = getcwdb() if testdescs and pathname: self._outputdir = os.path.join(self._outputdir, pathname) previoustimes = {} @@ -2900,7 +2901,7 @@ testcls = cls break -refpath = os.path.join(self._testdir, path) +refpath = os.path.join(getcwdb(), path) tmpdir = os.path.join(self._hgtmp, b'child%d' % count) # extra keyword parameters. 'case' is used by .t tests To: sangeet259, #hg-reviewers Cc: yuja, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5199: test: fix self._testdir to use ues the right mercurial library during testing
sangeet259 updated this revision to Diff 12389. sangeet259 edited the summary of this revision. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D5199?vs=12351=12389 REVISION DETAIL https://phab.mercurial-scm.org/D5199 AFFECTED FILES tests/run-tests.py CHANGE DETAILS diff --git a/tests/run-tests.py b/tests/run-tests.py --- a/tests/run-tests.py +++ b/tests/run-tests.py @@ -722,6 +722,7 @@ shell is the shell to execute tests in. """ + if timeout is None: timeout = defaults['timeout'] if startport is None: @@ -2516,6 +2517,7 @@ def run(self, args, parser=None): """Run the test suite.""" + oldmask = os.umask(0o22) try: parser = parser or getparser() @@ -2542,17 +2544,19 @@ os.umask(oldmask) def _run(self, testdescs): +testdir = getcwdb() self._testdir = osenvironb[b'TESTDIR'] = getcwdb() # assume all tests in same folder for now if testdescs: pathname = os.path.dirname(testdescs[0]['path']) if pathname: -osenvironb[b'TESTDIR'] = os.path.join(osenvironb[b'TESTDIR'], - pathname) +testdir = os.path.join(testdir,pathname) + +self._testdir = osenvironb[b'TESTDIR'] = testdir if self.options.outputdir: self._outputdir = canonpath(_bytespath(self.options.outputdir)) else: -self._outputdir = self._testdir +self._outputdir = getcwdb() if testdescs and pathname: self._outputdir = os.path.join(self._outputdir, pathname) previoustimes = {} @@ -2891,6 +2895,7 @@ Returns a Test instance. The Test may not be runnable if it doesn't map to a known type. """ + path = testdesc['path'] lctest = path.lower() testcls = Test @@ -2900,7 +2905,7 @@ testcls = cls break -refpath = os.path.join(self._testdir, path) +refpath = os.path.join(getcwdb(), path) tmpdir = os.path.join(self._hgtmp, b'child%d' % count) # extra keyword parameters. 'case' is used by .t tests To: sangeet259, #hg-reviewers Cc: yuja, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5199: test: fix self._testdir to use ues the right mercurial library during testing
yuja added a comment. > - a/tests/run-tests.py +++ b/tests/run-tests.py @@ -2527,13 +2527,14 @@ os.umask(oldmask) > > def _run(self, testdescs): +testdir = getcwdb() > self._testdir = osenvironb[b'TESTDIR'] = getcwdb() Nit: maybe this line has to be removed. > 1. assume all tests in same folder for now if testdescs: pathname = os.path.dirname(testdescs[0]['path']) if pathname: > - osenvironb[b'TESTDIR'] = os.path.join(osenvironb[b'TESTDIR'], > - pathname) +testdir = os.path.join(testdir,pathname) + self._testdir = osenvironb[b'TESTDIR'] = testdir The idea sounds good, but test-run-tests.t failed. Can you investigate? REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D5199 To: sangeet259, #hg-reviewers Cc: yuja, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: D5199: test: fix self._testdir to use ues the right mercurial library during testing
> --- a/tests/run-tests.py > +++ b/tests/run-tests.py > @@ -2527,13 +2527,14 @@ > os.umask(oldmask) > > def _run(self, testdescs): > +testdir = getcwdb() > self._testdir = osenvironb[b'TESTDIR'] = getcwdb() Nit: maybe this line has to be removed. > # assume all tests in same folder for now > if testdescs: > pathname = os.path.dirname(testdescs[0]['path']) > if pathname: > -osenvironb[b'TESTDIR'] = os.path.join(osenvironb[b'TESTDIR'], > - pathname) > +testdir = os.path.join(testdir,pathname) > +self._testdir = osenvironb[b'TESTDIR'] = testdir The idea sounds good, but test-run-tests.t failed. Can you investigate? ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5199: test: fix self._testdir to use ues the right mercurial library during testing
sangeet259 created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY currently if you run tests from some other directory other than the ../tests/, you will get a warning stating warning: Testing with unexpected mercurial lib: mercurial (expected /tmp/hgtests.xx/install/lib/python/mercurial) This is because the the current directory being added to the 'PATH', if the self._testdir != runtestdir, owing to this line if self._testdir != runtestdir: path = [self._testdir] + path Also say you ran the tests from the hg base directory, because directory is being added in the PATH(see the above snippet, at that stage the `self._testdir` has the value as `cwd`, owing to a faulty initialisation). And since the current directory already has the 'hg', that is used in place of the hg that is installed for the testing purposes in `/tmp/hgtests.xx/...`. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D5199 AFFECTED FILES tests/run-tests.py CHANGE DETAILS diff --git a/tests/run-tests.py b/tests/run-tests.py --- a/tests/run-tests.py +++ b/tests/run-tests.py @@ -2527,13 +2527,14 @@ os.umask(oldmask) def _run(self, testdescs): +testdir = getcwdb() self._testdir = osenvironb[b'TESTDIR'] = getcwdb() # assume all tests in same folder for now if testdescs: pathname = os.path.dirname(testdescs[0]['path']) if pathname: -osenvironb[b'TESTDIR'] = os.path.join(osenvironb[b'TESTDIR'], - pathname) +testdir = os.path.join(testdir,pathname) +self._testdir = osenvironb[b'TESTDIR'] = testdir if self.options.outputdir: self._outputdir = canonpath(_bytespath(self.options.outputdir)) else: To: sangeet259, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel